02-23-2024, 04:21 AM
i2c:
sda: 4 #replace by your board's pin define
scl: 5 #replace by your board's pin define
scan: true
id: bus_a
pcf8574:
- id: 'pcf8574_hub_in_1' # for input channel 1-8
address: 0x22 #replace by your PCF8574 address
binary_sensor:
- platform: gpio
name: "a8-input1"
pin:
pcf8574: pcf8574_hub_in_1
number: 0
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input2"
pin:
pcf8574: pcf8574_hub_in_1
number: 1
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input3"
pin:
pcf8574: pcf8574_hub_in_1
number: 2
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input4"
pin:
pcf8574: pcf8574_hub_in_1
number: 3
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input5"
pin:
pcf8574: pcf8574_hub_in_1
number: 4
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input6"
pin:
pcf8574: pcf8574_hub_in_1
number: 5
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input7"
pin:
pcf8574: pcf8574_hub_in_1
number: 6
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input8"
pin:
pcf8574: pcf8574_hub_in_1
number: 7
mode: INPUT
inverted: true
download yaml demo for ESPHome:
DI8_config_yaml.txt (Size: 1.53 KB / Downloads: 112)
about A0,A1,A2 i2c address setting:
A0 A1 A2
0 0 0 =0x20
0 0 1 =0x21
0 1 0 =0x22
0 1 1 =0x23
1 0 0 =0x24
1 0 1 =0x25
1 1 0 =0x26
1 1 1 =0x27
sda: 4 #replace by your board's pin define
scl: 5 #replace by your board's pin define
scan: true
id: bus_a
pcf8574:
- id: 'pcf8574_hub_in_1' # for input channel 1-8
address: 0x22 #replace by your PCF8574 address
binary_sensor:
- platform: gpio
name: "a8-input1"
pin:
pcf8574: pcf8574_hub_in_1
number: 0
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input2"
pin:
pcf8574: pcf8574_hub_in_1
number: 1
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input3"
pin:
pcf8574: pcf8574_hub_in_1
number: 2
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input4"
pin:
pcf8574: pcf8574_hub_in_1
number: 3
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input5"
pin:
pcf8574: pcf8574_hub_in_1
number: 4
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input6"
pin:
pcf8574: pcf8574_hub_in_1
number: 5
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input7"
pin:
pcf8574: pcf8574_hub_in_1
number: 6
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input8"
pin:
pcf8574: pcf8574_hub_in_1
number: 7
mode: INPUT
inverted: true
download yaml demo for ESPHome:
DI8_config_yaml.txt (Size: 1.53 KB / Downloads: 112)
about A0,A1,A2 i2c address setting:
A0 A1 A2
0 0 0 =0x20
0 0 1 =0x21
0 1 0 =0x22
0 1 1 =0x23
1 0 0 =0x24
1 0 1 =0x25
1 1 0 =0x26
1 1 1 =0x27