I used a template in HA to normalise data coming from a weather station. Scrub out states you don’t want
I essentially use the method described at the below link, which uses API to prevent deep sleep from reoccurring. I haven’t fully implemented my final product, but the deep sleep/prevention works fine. It’s set to delay going back into deep sleep for 10s, and that seems to be plenty of time to connect to the api.
I haven’t played around with it enough to see how low I can get the delay to be, but 10s doesn’t seem that bad to me.
ESPHome: Batteries, Deep Sleep, and Over-the-Air Updates – Tatham Oddie
Hi, I’ve just tried to use that link - I got to this thread after trying to do the setup - exactly as described and I just get errors about not being allow to map id: when the yaml is parsed. Can you please share what you have done if it is something different?
I’m working with an esp8266 by that shouldn’t matter as I’m not getting past the binary_sensor/homeassistant config for some reason.
Relevant code below (also note that my helper boolean is created within Home Assistant, not the ESPHome YAML:
substitutions:
device_name: water-pump-01
name_: water_pump_01
name_pretty: Water Pump
# sleep parameters
sleep_time: 10min
esphome:
name: "${device_name}"
platform: ESP8266
board: esp01_1m
on_boot:
then:
- script.execute: consider_deep_sleep
# --- DEEP SLEEP CONFIG ---
deep_sleep:
id: deep_sleep_control
sleep_duration: ${sleep_time}
# pull in Helper from Home Assistant for deep sleep config
binary_sensor:
- platform: homeassistant
id: prevent_deep_sleep
name: Prevent Deep Sleep
entity_id: input_boolean.prevent_deep_sleep
# deep sleep script
script:
- id: consider_deep_sleep
mode: queued
then:
- delay: 10s
- if:
condition:
binary_sensor.is_on: prevent_deep_sleep
then:
- logger.log: 'Skipping sleep, per prevent_deep_sleep'
else:
- deep_sleep.enter: deep_sleep_control
- script.execute: consider_deep_sleep
Hello everyone!
i need some help with deep sleep…
so i what to make doors to open at 7 in the morning and close in evening at 6.
i have “cover” to open and close doors and it already works… BUT… now i would
like to sleep between this two times…
im reading topics but i just dont get it how to set deep sleep to make it work.
(mostly is just wake up every 20min and go back to sleep after 15s)
This is what times when to open and close doors look like right now:
time:
- platform: homeassistant
on_time:
- seconds: 0
minutes: 00
hours: 07
days_of_week: MON-SUN
then:
- cover.open: vrata_kurnik
- platform: homeassistant
on_time:
- seconds: 0
minutes: 0
hours: 18
days_of_week: MON-SUN
then:
- cover.close: vrata_kurnik
there is some more code but it is just buttons,relays and cover + stuff that
must be there…
someone may ask why… im planing to put it on battery + solar
Thanks in advance for any help
You can look at deep_sleep.enter
until:
Thanks for your reply
yes i did find this… but didnt figured out where to put it and didnt find any more
detailed example… Do you mind giving me some more details? like do i just put it
in there between times i alredy have or do i need to compleatly replace what i
alredy have,…?
sorry if its a stupid question but i really cant figure it out or find what i am looking
for.
Thanks in advance
You could probably just add a delay action after this (however long it takes the cover to open) and then add the deep sleep action there too.
Similar to what I’ve done under time:
here:
Thanks for your time. Your code looks very good.
for now i just did this and will test it out:
deep_sleep:
id: deep_sleep_1
run_duration: 30s
time:
- platform: homeassistant
id: homeassistant_time
- platform: homeassistant
on_time:
- seconds: 5
minutes: 00
hours: 07
days_of_week: MON-SUN
then:
- cover.open: vrata_kurnik
- delay: 25s
- deep_sleep.enter:
id: deep_sleep_1
until: "18:00:00"
time_id: homeassistant_time
- platform: homeassistant
on_time:
- seconds: 5
minutes: 00
hours: 18
days_of_week: MON-SUN
then:
- cover.close: vrata_kurnik
- delay: 25s
- deep_sleep.enter:
id: deep_sleep_1
until: "07:00:00"
time_id: homeassistant_time
will later add things if needed. would love to hear any pro tip / comment on what i have right now
Thanks again