8000 Fixed issue has recurred: ESPhome deep sleep sensor values get 'unavailable' as soon as api is not connected · Issue #99860 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Fixed issue has recurred: ESPhome deep sleep sensor values get 'unavailable' as soon as api is not connected #99860
Closed
@Jeppedy

Description

@Jeppedy

The problem

See #97827, 90925 @OttoWinter @jesserockz @bdraco

As soon as the device goes to DeepSleep, it flips to Unknown in HA. Is there something basic I'm missing?
There was a pull request for this exact issue, and it is said to have been resolved, but I'm still seeing the same behavior others described before the pull request.

What version of Home Assistant Core has the issue?

core-2023.8.4

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

No response

Diagnostics information

No response

Example YAML snippet

`substitutions:
  device_name: househumidity-esp32s
  friendly_name: househumidity-esp32s
  deepsleep_time: 30s
  update_interval: 5min
  sleep_check_interval: 5s       # As soon as the switch is toggled, we want to go to sleep.
  initial_sleep_check_delay: 30s  # Allows API to connect and give sleep boolean to us

esphome:
  name: ${device_name}
  friendly_name: ${friendly_name}

  on_boot:
    then:
      #- logger.log: 'on_boot - Before initial delay'
      - delay: ${initial_sleep_check_delay}
      #- logger.log: 'on_boot - executing script'
      - script.execute: consider_deep_sleep

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxx"

#ota:
#  password: "xxxxx"

#captive_portal:
   

wifi:
  power_save_mode: none

  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
#  ap:
#    ssid: ${device_name}
#    password: "xxxxx"

sensor:
  - platform: dht
    pin: 16
    temperature:
      name: "Temperature"
    humidity:
      name: "Humidity"
    update_interval: ${update_interval}
    model: DHT11


## Deep Sleep

deep_sleep:
  id: deep_sleep_control
  sleep_duration: ${deepsleep_time}

# Will only pick up a value if this device is configured in Home Assistant > Integrations
# If the device isn't configured, or Home Assistant is offline, it'll default to false
binary_sensor:
  - platform: homeassistant
    id: prevent_deep_sleep
    entity_id: input_boolean.prevent_deep_sleep

script:
  - id: consider_deep_sleep
    mode: queued
    then:
#      - logger.log: 'Starting Script iteration'
      - delay: ${sleep_check_interval}
#      - logger.log: 'After Script delay'
      - if:
          condition:
            - api.connected:
          then:
            - delay: 5s
            - if:
                condition:
                  - binary_sensor.is_off: prevent_deep_sleep
                then:
                  - logger.log: 'No prevent_deep_sleep, so nappy nap time'
                  - deep_sleep.enter: deep_sleep_control
                else:
                  - logger.log: 'Staying awake; prevent_deep_sleep set.'
          else:
            - logger.log: 'Skipping sleep - no API connection.'
      - script.execute: consider_deep_sleep
`

Anything in the logs that might be useful for us?

![Screenshot_2023-09-07-12-51-48-14_c3a231c25ed346e59462e84656a70e50](https://github.com/home-assistant/core/assets/7842787/3bac7650-ff88-4bd1-8c85-7fbbe4003ee4)
![Screenshot_2023-09-07-12-52-01-29_c3a231c25ed346e59462e84656a70e50](https://github.com/home-assistant/core/assets/7842787/c0f952b6-dee3-4f56-9561-e24c187faa5f)

Additional information

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0