ESP-12 + Relay board - can I flash it to ESPHome?

Please read the instructions for posting at the top of each forum and edit your post to correctly display the code. The forum editor doesn’t keep the sketch formatting without code tags which makes it unreadable. If you post your code in code tags, more forum members will read it.

managed to get it working, leaving the config in case anyone ever stumbles across this page facing the same issue:

esphome:
  name: relay-x16

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxx"

ota:
  password: "xxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Relay-X16 Fallback Hotspot"
    password: "xxx"

captive_portal:

web_server:
  port: 80

i2c:

- id: i2c_1

  scan: true

  scl: GPIO5

  sda: GPIO4

pcf8574:

- address: '0x27'

  id: pcf8575_1

  pcf8575: true

switch:

  - platform: gpio

    name: "relay 1"

    pin:

      pcf8574: pcf8575_1

      # Use pin number 0

      number: 0

      mode:

        output: true

      inverted: false

  - platform: gpio

    name: "relay 2"

    pin:

      pcf8574: pcf8575_1

      # Use pin number 1

      number: 1

      mode:

        output: true

      inverted: false

  - platform: gpio

    name: "relay 3"

    pin:

      pcf8574: pcf8575_1

      # Use pin number 2

      number: 2

      mode:

        output: true

      inverted: false

  - platform: gpio

    name: "relay 4"

    pin:

      pcf8574: pcf8575_1

      # Use pin number 3

      number: 3

      mode:

        output: true

      inverted: false

  - platform: gpio

    name: "relay 5"

    pin:

      pcf8574: pcf8575_1

      # Use pin number 4

      number: 4

      mode:

        output: true

      inverted: false

  - platform: gpio

    name: "relay 6"

    pin:

      pcf8574: pcf8575_1

      # Use pin number 5

      number: 5

      mode:

        output: true

      inverted: false

  - platform: gpio

    name: "relay 7"

    pin:

      pcf8574: pcf8575_1

      # Use pin number 6

      number: 6

      mode:

        output: true

      inverted: false

  - platform: gpio

    name: "relay 8"

    pin:

      pcf8574: pcf8575_1

      # Use pin number 7

      number: 7

      mode:

        output: true

      inverted: false

  - platform: gpio

    name: "relay 9"

    pin:

      pcf8574: pcf8575_1

      # Use pin number 8

      number: 8

      mode:

        output: true

      inverted: false

  - platform: gpio

    name: "relay 10"

    pin:

      pcf8574: pcf8575_1

      # Use pin number 9

      number: 9

      mode:

        output: true

      inverted: false


  - platform: gpio

    name: "relay 11"

    pin:

      pcf8574: pcf8575_1

      # Use pin number 10

      number: 10

      mode:

        output: true

      inverted: false

  - platform: gpio

    name: "relay 12"

    pin:

      pcf8574: pcf8575_1

      # Use pin number 11

      number: 11

      mode:

        output: true

      inverted: false

  - platform: gpio

    name: "relay 13"

    pin:

      pcf8574: pcf8575_1

      # Use pin number 12

      number: 12

      mode:

        output: true

      inverted: false

  - platform: gpio

    name: "relay 14"

    pin:

      pcf8574: pcf8575_1

      # Use pin number 13

      number: 13

      mode:

        output: true

      inverted: false

  - platform: gpio

    name: "relay 15"

    pin:

      pcf8574: pcf8575_1

      # Use pin number 14

      number: 14

      mode:

        output: true

      inverted: false

  - platform: gpio

    name: "relay 16"

    pin:

      pcf8574: pcf8575_1

      # Use pin number 15

      number: 15

      mode:

        output: true

      inverted: false
1 Like