Editing
Esphome example deep sleep
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Deep Sleep (API)== This is an example of how I use Deep Sleep on the ESP8266-01 module in my Jeep.<br> The ESP is used to determine if the Jeep is "home". If the API connects, the Jeep is "home". ;How OTA Updates work: In my Lovelace front end, I have a button to turn on a helper entity: <b>input_boolean.jeep_ota_mode</b>.<br> In the ESP yaml code, the first thing I do (on_boot) is to check this flag.<br> If the flag is on, I prevent deep sleep: <b> - deep_sleep.prevent: deep_sleep_handler</b><br> <nowiki># This is the ESP device inside the Jeep to provide presence (status=connected). substitutions: device_name: jeep friendly_name: jeep packages: wifi: !include common/wifi.yaml device_base: !include common/esp8266.yaml esphome: on_boot: priority: -100.0 then: - delay: 1s - script.execute: test_ota binary_sensor: - platform: status name: "Jeep Status" - platform: homeassistant id: otamode entity_id: input_boolean.jeep_ota_mode ################################################# # Script to test if the otamode switch is on or off script: - id: test_ota mode: queued then: - logger.log: "Checking OTA Mode" - if: condition: binary_sensor.is_on: otamode then: - logger.log: 'OTA Mode ON' - deep_sleep.prevent: deep_sleep_handler else: - logger.log: 'OTA Mode OFF' - delay: 2s - script.execute: test_ota ################################################# #Deep Sleep deep_sleep: id: deep_sleep_handler run_duration: 5s sleep_duration: 120s </nowiki> {{template:top}}
Summary:
Please note that all contributions to Notebook may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Notebook:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Home Page
C++ Reference
ESP Hardware
ESPHome
Home Assistant
Network Stuff
Tools
What links here
Related changes
Special pages
Page information