Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PCF8574 IO Expansion i2c digital input board -DI8 ESPHome config yaml demo
#1
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:

.txt   DI8_config_yaml.txt (Size: 1.53 KB / Downloads: 123)
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
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)