Introduction: Lights Relay Rail

Home assistant simple project with 2 esp8266, 1 relay module and 1 stc013 on aller retour stairway ligths

The stc913 reading the voltage when ligths are on and an automation switch's momentary the relay module after a delay

Supplies

Step 1:

After adding each esp8266 to the esphome builder via esphome web , edit the code adding simple attched codes

There is no need for accurancy for the stc013 ,only the amperage changes,so resistors and capacitors are not needed

Step 2:

Adding the automation ,home assistant reading amperage changes when lights are on and after 75 seconds delay fires up the relay.This is a aller-retour connection so i made an If statement to specify the code running only if at the end delay lights are still on , or someone closed manually


Step 3:

Final step to add the switch with the on-off state to the dashboard with 2 automations(can easily be at one automation combined but i prefer pure simplicity)

Thats all