01-12-2026, 06:40 PM
I've asked Claude Code and received an answer. I don't understand the ESP32 and ESPHome much enough to confirm that it can work or it just AI halucination 
Can someone take a look on this?
### ESPHome Configuration
Configuration - the `inverted: true` setting handles the active-low logic:
```yaml
binary_sensor:
- platform: gpio
name: "External Optocoupler 1"
pin:
pcf8574: pcf8574_hub_in
number: 0 # IN1
mode: INPUT
inverted: true # Required for active-low!
filters:
- delayed_on: 10ms
- delayed_off: 10ms
```### ESPHome Configuration
### Wiring External Optocoupler
#### Complete Wiring Diagram
```
External Device Optocoupler KC868-A6
─────────────── ──────────── ─────────
High Voltage ──────► LED+ (Anode)
Signal LED- (Cathode) ─────► External GND
[═══ Isolation Gap ═══]
Collector ──────────► 3.3V VCC
Emitter ────────────► IN1 (Digital Input)
GND (common reference)
```
#### Physical Connections
```
KC868-A6 Terminal Block:
┌──────┬──────┬──────┬──────┐
│ 3.3V │ GND │ IN1 │ IN2 │
└──────┴──────┴──────┴──────┘
│ │ │
│ │ └──────────────► Connect to Optocoupler Emitter
│ └─────────────────────► Common reference
└────────────────────────────► Connect to Optocoupler Collector
```### Wiring External Optocoupler
#### Complete Wiring Diagram
```
External Device Optocoupler KC868-A6
─────────────── ──────────── ─────────
High Voltage ──────► LED+ (Anode)
Signal LED- (Cathode) ─────► External GND
[═══ Isolation Gap ═══]
Collector ──────────► 3.3V VCC
Emitter ────────────► IN1 (Digital Input)
GND (common reference)
```
#### Physical Connections
```
KC868-A6 Terminal Block:
┌──────┬──────┬──────┬──────┐
│ 3.3V │ GND │ IN1 │ IN2 │
└──────┴──────┴──────┴──────┘
│ │ │
│ │ └──────────────► Connect to Optocoupler Emitter
│ └─────────────────────► Common reference
└────────────────────────────► Connect to Optocoupler Collector
```

Can someone take a look on this?
### ESPHome Configuration
Configuration - the `inverted: true` setting handles the active-low logic:
```yaml
binary_sensor:
- platform: gpio
name: "External Optocoupler 1"
pin:
pcf8574: pcf8574_hub_in
number: 0 # IN1
mode: INPUT
inverted: true # Required for active-low!
filters:
- delayed_on: 10ms
- delayed_off: 10ms
```### ESPHome Configuration
### Wiring External Optocoupler
#### Complete Wiring Diagram
```
External Device Optocoupler KC868-A6
─────────────── ──────────── ─────────
High Voltage ──────► LED+ (Anode)
Signal LED- (Cathode) ─────► External GND
[═══ Isolation Gap ═══]
Collector ──────────► 3.3V VCC
Emitter ────────────► IN1 (Digital Input)
GND (common reference)
```
#### Physical Connections
```
KC868-A6 Terminal Block:
┌──────┬──────┬──────┬──────┐
│ 3.3V │ GND │ IN1 │ IN2 │
└──────┴──────┴──────┴──────┘
│ │ │
│ │ └──────────────► Connect to Optocoupler Emitter
│ └─────────────────────► Common reference
└────────────────────────────► Connect to Optocoupler Collector
```### Wiring External Optocoupler
#### Complete Wiring Diagram
```
External Device Optocoupler KC868-A6
─────────────── ──────────── ─────────
High Voltage ──────► LED+ (Anode)
Signal LED- (Cathode) ─────► External GND
[═══ Isolation Gap ═══]
Collector ──────────► 3.3V VCC
Emitter ────────────► IN1 (Digital Input)
GND (common reference)
```
#### Physical Connections
```
KC868-A6 Terminal Block:
┌──────┬──────┬──────┬──────┐
│ 3.3V │ GND │ IN1 │ IN2 │
└──────┴──────┴──────┴──────┘
│ │ │
│ │ └──────────────► Connect to Optocoupler Emitter
│ └─────────────────────► Common reference
└────────────────────────────► Connect to Optocoupler Collector
```

