Hello Everyone
I am trying to prevent deepsleep from a sensor.
But when I publish the code on hassio for preventing the deepsleep while the sensor is sleeping, it doesn’t get the message when it wakes up. It only works when I publish it while it is awake.
Any idea how to get it to update the message on wakeup?
Look for the on_boot settings “Priority” in ESPhome
first on_boot check of the inpoot_boolean “weerstation_wakker_blijven” from within HA is set or not (weerstation wakker blijven is dutch for weatherstation stay awake)
If the input boolean “weerstation_wakker_blijven” is swiched back to the original off state then the ESP needs to be reset bij the restart switch.
type or paste code here
```on_boot:
priority: -200
then:
- delay: 35s
- logger.log: "controleer diepe slaap"
- lambda: |-
if(id(weerstation_wakker_blijven).state) {
ESP_LOGD("main", "!!!! WAKKER BLIJVEN !!! voorkom diepe slaap"); //dutch for stay awake
id(deep_sleep_1).prevent_deep_sleep();
} else {
ESP_LOGD("main", "alles ok !!!!! SLAAP ZACHT !!!!"); // dutch for Ok, sleep well
}
- logger.log: "diepe slaap gecontroleerd" // dutch for deep sleep checked
switch: // switch to restart the ESP so the proces of checking deep sleep restart on_boot
- platform: restart
name: "Herstart weerstation"
icon: "mdi:restart"
deep_sleep:
run_duration: 50sec ## needs some time to calculate measurements
sleep_duration: 20min
id: deep_sleep_1
- platform: homeassistant #input boolean made in HA, the ESP checks it state on_boot
name: "wakker blijven"
internal: true
id: weerstation_wakker_blijven
entity_id: input_boolean.swicth_weerstation_wakker_blijven
on_press:
then:
- logger.log: "press afstand wakker houden"
- deep_sleep.prevent: deep_sleep_1
on_state:
then:
- delay: 4s
- logger.log: "switch weerstation wakker blijven getriggerd vanuit HA"
> Blockquote
Hello ilfuriano,
I understand you can switch the ESPHome to listen for ota at next boot by HA automation, which can happen in next hours. But how do you then actually push ota to ESPHome? Do you somehow trigger it at same time when the automation script sends “disable next sleep” mqtt message to ESPHome, or you need to wait until ESPHome is online and then push it manually with command line? Thanks, Jan