I have a basic 8266 connected to a BME280 for temperature, pressure and humidity. Running “live”, it’s perfect. I put in the code for the deep sleep, plus the jumper wire from RST to D0, and it’s waking, running for 30s, then sleeping for 5min, which is what it is supposed to do.
The problem is that when it’s in sleep mode, the cards for the sensor in HA all show as unavailable. As soon as it wakes & connects, the data is back. I was under the impression that it would display the last known values.
I’m running HA 2023.10.3, ESPHome 2023.9.3.
Note: I added the sleep after the device and entities had already been configured in HA.
You haven’t shown your YAML code. Are you using MQTT? Going unavailable is the expected response. The device usually sends a will message when it goes to sleep. Search the forum for the hundreds of other people who had same problem and then found the solution.
I’ve struggled with the same issue. I finally had all my sensors behaving but I was trying so many things to make them stop displaying “unavailable” during sleep I was never sure what actually solved it, until…
I added a new esp8266 device and it also started showing the unavailable issue and then I realized when I add a device it initially isn’t configured for deep-sleep. I’ll add a few sensors to get it where I want it and then add the deep-sleep component. I believe that to be the problem. Deep-sleep should be configured and installed before adding any sensors.
So with this new device, I commented out the sensors, but left in the deep-sleep, in the config file and re-installed it.
Copied the config file for the device from the esphome folder in homeassistant/config. I have samba installed so I have access to these folders.
Deleted the device from esphome.
Restarted Home Assistant.
Copied the devices config file back to the esphome folder. This will add it back to esphome.
It then will show up in HA as a newly discovered device. Add it to HA.
Uncomment the sensors in the device’s config file and reinstall it.