Deep_sleep at set times
Sometimes we want to sleep at set times; for example Mahko_Mahko’s ESPlanty solar powered plant watering wants to check his plant through the day - but to sleep all night.
He uses the time: component’s on_time trigger at 8pm (20:00:00 in 24-hour time) to enter deep_sleep and wake at 5am (05:00:00). When the ESP32 wakes (boots) in the morning it uses the run_duration and sleep_duration defined in the deep_sleep: section
deep_sleep:
id: deep_sleep_1
run_duration: ${auto_wake_time}
sleep_duration: ${sleep_time}
time:
- platform: homeassistant
id: esptime
on_time:
#Deep sleep at 8pm and wake up at 5am.
- hours: 20
then:
#Publish battery level to the end of day sensor since it will be our last update.
- lambda: return id(end_of_day_battery_percent).publish_state(id(batt_level).state);
#Reset culmulative light sesnor reset
- sensor.integration.reset: irrigation_cul_lux_hours
- delay: 1s
#Rest up
- deep_sleep.enter:
id: deep_sleep_1
until: "05:00:00"
time_id: esptime