Maybe I’m missing something very obvious, but I don’t see why “deep_sleep.allow” is not an option here… deep_sleep.prevent is working fine for the on_switch.on
Try this with adding your “rtttl.play” and “logger.log” in
on_turn_on:
then:
- deep_sleep.prevent: deep_sleep_1
- rtttl.play: 'scale_up:d=32 fill it in xyz'
- logger.log: "Switch Turned On!"
on_turn_off:
then:
- deep_sleep.allow: deep_sleep_1
- logger.log: "switch Turned Off!"
or you could try
- deep_sleep.enter: deep_sleep_1
Hi Blacky, I don’t quite follow you, I’m aware of the command “deep_sleep.enter” but that is exactly what I don’t want at that moment (for the board to go directly into sleep). I want it to go to sleep when it’s time for sleep. Hence the (documented) command “deep_sleep.allow” that resumes the timer set by the deep_sleep definition (else in the config).
On using the “then:”: The documentation says otherwise, apart from that the sleep.prevent (and sound) is working perfectly without the “then”…
Also:
ok I understand
does the command “deep_sleep.enter” work?
I know you don’t want to use it and I understand why, just seeing if that will work.
It works and puts the esp to sleep right after it’s boot up because the switch is off
I never though of it, because I have ESPHome as an add-on and everything is supposed to auto-update, but for some reason ESPHome did not!
Good find, I was scratching my head on this one.