Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PCF8574 IO Expansion i2c relay board -DO8 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_out_1'  # for output channel 1-8
    address: 0x24    #replace by your PCF8574 address

switch:
  - platform: gpio
    name: "a8-light1"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 0
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "a8-light2"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 1
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "a8-light3"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 2
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "a8-light4"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 3
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "a8-light5"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 4
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "a8-light6"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 5
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "a8-light7"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 6
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "a8-light8"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 7
      mode: OUTPUT
      inverted: true

download yaml demo for ESPHome:

.txt   DO8_config_yaml.txt (Size: 1.58 KB / Downloads: 117)

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)