Hello everyone, hope you’re well. Please guide me through this configuration:
1. The lights in the house were installed using the https://www.findernet.com/en/worldwide/series/27-series-step-relays-10-a/ . These relays make a flip (conduct electricity) when there is momentary power sent to them and remain in that state untill again momentary power is applied. Momentary power is applied using push buttons (ringbell type) instead of classic light switches. There is no way to know if the light circuit is closed or opened (light on or off) unless you see the light . This type of wiring/solution is not an improvisation and allows me to use the lights without a working automation.
2. The automation hardware consists of: a 16 relay board based on an esp8266 driving a pcf8575 + a separate 16 ports live wire (220v) sensing board like this ones (https://www.aliexpress.com/w/wholesale-220V-Optocoupler-Isolation-Module%2F16-Channels-220V.html?spm=a2g0o.home.search.0) connected through also a pcf8575 to the other board’s esp8266 installed with esphome. Wires are routed from the relays (both finder and esp) and the setup works as intended.
3. To flip/flop the lighting relay (turn bulb on or off) from HA → Settings → Integrations → ESPLIGH → Controls I have to fast cycle the webpage switch on and off (1-2 seconds appart). This switch action always turns on and off the relay on the 16 relay automation board and, as said, this flip acts as the signal for the actual light action relay (finder) to toggle. When the actual light bulb is lighting/lit there is live power fed to the sensing board and I get the message “Pin #x turned on”. When the actual light bulb is off I get the opposite “Pin #x turned off”. From the wall obviously I just have to push that momentary button and it will toggle the light (by momentary power to the finder relay) and the state of the light will reflect in HA’s logbook as “Pin #x turned on” or off respectivelly.
Excerpts from the code:
pcf8574:
- id: 'pcf8575_relays' #Soldered on ESP board
address: 0x27
i2c_id: bus_a
pcf8575: true
## Phisical pin on device right-3 SCL right-4 SDA
- id: 'pcf8575_external_220v_sense' #External board
address: 0x20
i2c_id: bus_a
pcf8575: true
switch:
- platform: gpio
restore_mode: RESTORE_DEFAULT_OFF
name: "Relay_1"
id: relay_1
pin:
pcf8574: pcf8575_relays
number: 0
mode:
output: true
inverted: true
<snip
binary_sensor:
- platform: gpio
name: "Pin #1"
pin:
pcf8574: pcf8575_external_220v_sense
number: 0
mode:
input: true
inverted: true
Now the questions, please, since I’m new to HA and Esphome and trying to get my head around them surelly caused some confusion:
A. Is this the right way to define the Esphome components? Can there be a better and more complex way of doing it ?
B. How to integrate this in the HA as a usefull Light that can be used in automations since there are multiple actions involved for each bulb turned on/off. The 2 x relay switching actions are decoupled from the sensing of the actual light state.
Thank you for your help and expertise.