comet424
(Comet424)
November 30, 2021, 1:04am
1
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
tom_l
November 30, 2021, 1:22am
2
Looking at the schematic for this device, it uses the MCP23008 i/o expander chip.
comet424
(Comet424)
November 30, 2021, 1:39am
3
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
tom_l
November 30, 2021, 1:48am
4
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
comet424
(Comet424)
November 30, 2021, 1:53am
5
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
tom_l
November 30, 2021, 2:02am
6
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
comet424
(Comet424)
November 30, 2021, 2:21am
7
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