core: ESPHome - Sensor value is shown as Unavailable after several minutes of deep sleep
This issue is waiting for the following issue to be resolved
https://github.com/esphome/issues/issues/4794
The problem
I have a node (ESP8266) which reports a voltage value (adc sensor) and then goes into deep sleep for about 1h, and again… When I added such a sensor to dashboards its value is presented as Unavailable after a few minutes when the node is asleep.
Version of esphome at the node: 2023.7.1
What version of Home Assistant Core has the issue?
2023.8.1
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
esphome
Link to integration documentation on our website
https://www.home-assistant.io/integrations/esphome/
Diagnostics information
No response
Example YAML snippet
Part of node configuration:
deep_sleep:
id: deep_sleep_id
sleep_duration: 60s
sensor:
- platform: adc
id: adc_sensor
pin: A0
name: "Car Voltage"
update_interval: 60000s
filters:
- multiply: 14.02
- platform: homeassistant
name: "Deep Sleep Duration"
id: deep_sleep_time
entity_id: input_number.carvoltage_deep_sleep_time
on_value:
then:
- logger.log:
format: "Received deep sleep duration"
- lambda: 'id(adc_sensor).update();'
- if:
condition:
lambda: 'return id(deep_sleep_time).state>0;'
then:
- deep_sleep.enter:
id: deep_sleep_id
sleep_duration: !lambda |-
return id(deep_sleep_time).state * 1000;
- platform: uptime
id: uptime_sensor
name: Uptime Sensor
internal: True
on_value:
then:
- if:
condition:
lambda: 'return id(uptime_sensor).state>=180 && !id(wifi_id).is_connected();'
then:
- deep_sleep.enter:
id: deep_sleep_id
sleep_duration: 3600s
Anything in the logs that might be useful for us?
No response
Additional information
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 40 (20 by maintainers)
Commits related to this issue
- Make ESPHome deep sleep tests more robust related issue #98221 — committed to home-assistant/core by bdraco 10 months ago
- Add additional connection logging related issue https://github.com/home-assistant/core/issues/98221 — committed to esphome/aioesphomeapi by bdraco 10 months ago
- Increase expected disconnect cooldown to 5.0 seconds Since the connect logic is much faster now we might be reconnecting before the device goes into deep sleep after an expected disconnect. Increase ... — committed to esphome/aioesphomeapi by bdraco 10 months ago
- Bump aioesphomeapi to 16.0.5 changelog: https://github.com/esphome/aioesphomeapi/compare/v16.0.4...v16.0.5 fixes `RuntimeError: set changed size during iteration` https://github.com/esphome/aioesph... — committed to home-assistant/core by bdraco 10 months ago
- Bump aioesphomeapi to 16.0.5 (#99698) changelog: https://github.com/esphome/aioesphomeapi/compare/v16.0.4...v16.0.5 fixes `RuntimeError: set changed size during iteration` https://github.com/es... — committed to home-assistant/core by bdraco 10 months ago
- Bump aioesphomeapi to 16.0.5 (#99698) changelog: https://github.com/esphome/aioesphomeapi/compare/v16.0.4...v16.0.5 fixes `RuntimeError: set changed size during iteration` https://github.com/es... — committed to home-assistant/core by bdraco 10 months ago
- Bump aioesphomeapi to 16.0.5 (#99698) changelog: https://github.com/esphome/aioesphomeapi/compare/v16.0.4...v16.0.5 fixes `RuntimeError: set changed size during iteration` https://github.com/es... — committed to teharris1/home-assistant by bdraco 10 months ago
Thanks @bdraco for quick fixes and your help! Home Assistant and ESPHome are amazing thanks to people like you.
Thinking about the issue I am still a bit worried that the problem will re-appear in the future as this timeout is strictly empirical. It’s worth of thinking about more reliable mechanism based on some information exchanged from a device during disconnect process or maybe for doing this configurable per device.