When switch is open it seems working,
but when I close it, esphome seems loop it - continuously wake up - without staying in deep sleep.
What am I missing here?
Thanks for any help.
-f
Quite confusing…
-Not described on your wish list, but your code is sending esp to sleep any time gpio14 changes state.
-Is your sensor open (no continuity) when door is open or opposite?
-your deep_sleep component only wakes up on high signal. And It’s pulled up by binary sensor.
The idea is: deep sleep all the time,
wake up on switch open, send state to mqtt then sleep,
wake up on switch close, send state to mqtt then sleep.
If on_state automation is not right, which you should I use?
in normally closed config.
Specifiyng inverted: True in esphome config, when I open the contact the state is set to Open, when I close the contact is set to Closed in HA.
Without deep sleep, it seems to be working fine.
How to change the config in order to trigger both conditions?
Thanks for your help!
-f
It’s not a question if on_state is wright. It’s a question what the automation does. Yours is sending Esp to sleep. Not waking it up. So you might want to remove it.
You didn’t really answer to my question about door opening vs switch.
It’s difficult to describe logic of the setup because there are 3 different open definitions.
-Switch electric circuit can open (NO or NC)
-Switch magnet can open (which can open or close the electric circuit)
-Door can open (which can open or close the magnetic field)
Adding here that the circuit can be wired either to 3.3V or to gnd, and that it can be logically inverted on esphome…
Anyway, add this line to your deep_sleep component: wakeup_pin_mode: INVERT_WAKEUP
I have never used it, but according to documentation it should be able to invert the wake-up logic according to actual pin state.