Anyone use CANADUINO 4-Channel Wi-Fi Relay kit with ESPhome? i dont know how to program it

i bought the CANADUINO 4-Channel Wi-Fi Relay
its written in Ardunio software… but i wanted to incorporated in Esphome to work with

i know it uses address and then number address 27…

but thats all i understand
i have it working with there ardunio and the website it makes but like to incorporate it in the esphome

here is the link to the device… and has the ardunio software

Looking at the schematic for this device, it uses the MCP23008 i/o expander chip.

ok so i looked at the link you provided and i tried to add and then label 4 relays… but its not liking it… the error i get is duplicated “name:” says relay 1 and relay 2 have the same name? even if i do realy1 relay2 it still says duplicate

how do i do the 4 relays? the example only does 1 relay… so i not 100% sure what i need to change?

here is the code…

esphome:
  name: relay-test
  platform: ESP8266
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "846275095a37ffccac08182de7ef7d0b"

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


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

captive_portal:

i2c:
  sda: D2
  scl: D1
  scan: true
  
# Example configuration entry
mcp23008:
  - id: 'mcp23008_hub'
    address: 0x27

# Individual outputs
switch:
  - platform: gpio
    name: "relay 1"
    mcp23xxx: mcp23008_hub
    pin:
 #     mcp23xxx: mcp23008_hub
      # Use pin number 0
      number: 0
      mode:
        output: true
      inverted: false

    name: "relay 2"
    pin:
#      mcp23xxx: mcp23008_hub
      # Use pin number 1
      number: 1
      mode:
        output: true
      inverted: false

    name: "relay 3"
    pin:
#      mcp23xxx: mcp23008_hub
      # Use pin number 2
      number: 2
      mode:
        output: true
      inverted: false

    name: "relay 4"
    pin:
#      mcp23xxx: mcp23008_hub
      # Use pin number 3
      number: 3
      mode:
        output: true
      inverted: false

Try this:

switch:
  - platform: gpio
    name: "relay 1"
    mcp23xxx: mcp23008_hub
    pin:
 #     mcp23xxx: mcp23008_hub
      # Use pin number 0
      number: 0
      mode:
        output: true
      inverted: false

  - platform: gpio
    name: "relay 2"
    pin:
#      mcp23xxx: mcp23008_hub
      # Use pin number 1
      number: 1
      mode:
        output: true
      inverted: false

  - platform: gpio
    name: "relay 3"
    pin:
#      mcp23xxx: mcp23008_hub
      # Use pin number 2
      number: 2
      mode:
        output: true
      inverted: false

  - platform: gpio
    name: "relay 4"
    pin:
#      mcp23xxx: mcp23008_hub
      # Use pin number 3
      number: 3
      mode:
        output: true
      inverted: false

i get different error now… so i needed to gpio each time as i thought like in HA you just do gpio once?

well with that… i get a problem with the mcp23008

switch:
  - platform: gpio
    name: "relay 1"
    pin:
      mcp23xxx: mcp23008_hub
      # Use pin number 0
      number: 0
      mode:
        output: true
      inverted: false

  - platform: gpio
    name: "relay 2"
    pin:
      mcp23xxx: mcp23008_hub
      # Use pin number 1
      number: 1
      mode:
        output: true
      inverted: false

  - platform: gpio
    name: "relay 3"
    pin:
      mcp23xxx: mcp23008_hub
      # Use pin number 2
      number: 2
      mode:
        output: true
      inverted: false

  - platform: gpio
    name: "relay 4"
    pin:
      mcp23xxx: mcp23008_hub
      # Use pin number 3
      number: 3
      mode:
        output: true
      inverted: false

awesome you rock… its working

all to do with spaces… etc… be nice if the example showed more then 1 pin (relay) or so

but it works… and working in home assistant very well… very much appreciated !!!

1 Like