I have followed the instructions and tried other things i found here and on other sites, but I cannot get it to work.
If i toggle the switch i can see in the log that the board is receiving the update, but it does not respond to it. No doubt user error, but I am not seeing what i did wrong. Basically the script runs 15 seconds, checks a state and if it is on, it will run another 15 seconds.
If it is off, it will go into deep_sleep for 30 seconds (thats just a trial time, the real time should be 10 minutes when I get it working) …rince and repeat.
My code in the espbord’s yaml is:
id: deep_sleep_control
sleep_duration: 30s
binary_sensor:
- platform: homeassistant
id: prevent_deep_sleep
entity_id: input_boolean.prevent_deep_sleep
script:
- id: consider_deep_sleep
mode: queued
then:
- delay: 15s
- if:
condition:
binary_sensor.is_on: prevent_deep_sleep
then:
- deep_sleep.prevent: deep_sleep_control
else:
- logger.log: 'Skipping sleep, per prevent_deep_sleep'
- script.execute: consider_deep_sleep```
The helper entity is called: input_boolean.prevent_deep_sleep
What am i missing?
PS: I know there is another way with MQTT, but I dont quite understand how that works yet, so i want to try this options first, since it is only for update and toggling a switch to put sensor in and update mode seem to make sense
Thanks lordzid, I updated the sensor with your code, but it doesnt seem to make any difference. I also removed the intergration with this board and added it again but that doesnt make any difference.
One thing that puzzles me, shouldn’t that binary sensor show up under the entities of the board?
One last thing i was wondering, the then statement now only has a logging line, shouldn’t there be a line like: deep_sleep.prevent: deep_sleep_control (Edit: No that cant be it, because the board doesnt go to sleep, no matter what the setting of the toggle is))
Edit2: I am also not seeing “Skipping sleep, per prevent_deep_sleep” when i look at the live log of the board, I see it sending temperature and humidity and i see it when i toggle the sleep control on and off, but not that sentence. Does that mean it doesnt even execute the script?