ESPHOME unknownn Sensor

Hellow

I got a Temp sensor configured in ESPHOME on a D1 mini
After latest update… the sensor last value does not stay.
How can I let the last value stay…got an automation running on values.

Thnx in advance.
Below is the Config.

esphome:
name: lya-sensor

esp8266:
board: d1_mini_lite

Enable logging

logger:

Enable Home Assistant API

api:

ota:

wifi:
ssid: “”
password: “”
manual_ip:

Set this to the IP of the ESP

static_ip: 192.168.1.67
# Set this to the IP address of the router. Often ends with .1
gateway: 192.168.1.1
# The subnet of the network. 255.255.255.0 works for most home networks.
subnet: 255.255.0.0

output_power: 8.5dB
power_save_mode: high

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:
ssid: “Lya-Sensor Fallback Hotspot”
password: “”

captive_portal:

i2c:
sda: GPIO04
scl: GPIO05
scan: True
id: bus_a

sensor:

  • platform: bme280
    temperature:
    name: “Lyang Temperature”
    oversampling: 16x
    pressure:
    name: “Lyang Pressure”
    humidity:
    name: “Lyang Humidity”
    address: 0x76
    update_interval: 60s

deep_sleep:
run_duration: 70s
sleep_duration: 3min

Hi - please follow the guidelines for posting YAML, outlined in this post:

Specifically - post the YAML in pre-formatted text tags - which can be accessed by using the </> button on the posting toolbar.

Sounds like the same issue that I have.

Esphome sensor with 10 minutes deep sleep. Measure, connect, transmit, deep sleep.

Before upstate:
Last value is shown in dashboard and history graph solid line.

After april update:
Last value is unknown and history graph dashed/dotted line.

The value is only shown in the very short time period the sensor is connected to HA.

My other sensor that are always on and connected to HA api, show values.

I have the impression that HA switches to unknown as soon as esphome client disconnects and does not retain the last value in dashboard and history graph.

Same issue - after last update all esphome sensors are in “Unknown” state while device in deep sleep

When you say “last update”, do you mean the ESPHome version to say 2023.3.2? Or the Home Assistant update?

Nothing jumps out in the breaking changes for either…

I think it is the april HA update that was released yesterday. Here in the screenshot you can see it.

21:45 I did the update. Before the line was solid and HA displayed the last value in dashboard. After HA april update 2023.04.0 (it was displayed as Supervisor 2023.04.0 update), the line gets dashed and the value in dashboard is unknown - unless the short periode the sensor connects to api.

I read in release logs, that something in recorder has been modified. Maybe this triggers this effect.

I mostly use MQTT rather than the API for deep sleep devices, along with fast connect WiFi and static IP.

I wonder if that will make a difference? It will be a couple of days before I upgrade HA to test.

1 Like

@zoogara It still works over MQTT for me. I do have both birth and will message set to none though,

1 Like

After updating home assistant to 2023.4.0 and i’m using native api, not mqtt.
Line in the graph became dashed until i’ve downgraded core back to 2023.3.6

Those that have this occurring should probably log an issue on GitHub.

Open a new issue - then each person affected add logs and relevant data to that issue.

Opened issue: https://github.com/home-assistant/core/issues/90923

Feel free to contribute

Update: Issue has been located, PR for fix done. Next step: Test needed. More Info in above link.

1 Like

Looks like there is a PR to fix this issue.

Ooops - missed the update on your post :grinning:

Just installed update 2023.4.1. The issue had been fixed. Sensors show last value again till next update. :grinning:

I don’t see where this is fixed because I get “unavailable” in HA when my esp8266 goes to sleep.

I’m running:
Core: 2023.11.2
Supervisor: 2023.11.0
Operating System: 11.1
Frontend: 20231030.2

It was fixed. Maybe it’s a new bug. I will delay/skip November update 11.2. for now - 11.1. works. Just check my entities.

Please report the issue and post here when a fixed version is released.

Just to be sure I’m on track to make this work. I shouldn’t have to do anything extra; like in the config files to make the last updated value remain displayed in Lovelace frontend instead of displaying “unavailable”. Correct?

When my ESPHome esp8266 device goes offline for any reason, like sleeping or shutoff, “unavailable” is displayed on my dashboards.

It appears to be working okay now. While trying to switch my esp8266 device over to MQTT it started to work correctly with the HA API configured. I’m not sure what all was going on with my system but it snapped out of it and looks correct now.

My esp8266 ESPHome device is configured for the HA API and for deep-sleep. When sleeping the dashboard continues to display the last updated readings. Only one thing is different with the esp8266 config file from before is I commented out the AP section that gets added when setting up a new device.

Actually, upon a deeped inspection of logs, it looks like it was a problem with the sensor, not HA.

I seem to be still experiencing the same issue even after the 2023.12.1 update… I have a temperature/humidity ESPHome sensor set up, but while it’s in deep sleep the dashboards show “Unknown” and the graph logs nothing: