Want ESPHome devices as "unavailable" when offline but not when in deep sleep

I have some simple ESPHome temperature sensors that have always used mqtt to report their data and they’ve always worked fine, but I wanted to start using the deep sleep function on them to allow me to put them in a small case without affecting the temperature readings.

With mqtt they would show as unavailable in HA the second they went to sleep, so I utilized the blank birth/will message trick to fix that which worked great except now they never show as unavailable even if they’ve been offline for 2 days.

Then I tried the API method in ESPHome rather than mqtt and found that while it works great I end up with the same issue where they never have the state as unavailable even if offline much longer than the configured deep sleep period.

I definitely want to know if these sensors go offline, for example one of them is used to control my heater and it would be nice to notice that it’s gone offline before going to bed on a cold night so I can default back to the analog thermostat. I could try to get fancy with other solutions like a ping monitor (far from ideal considering the device will be asleep most of the time) but would ideally love for these to just be marked as offline/unavailable when they don’t report back in on schedule.

Anyone have any solutions for that?

There’s no way to tell the difference between offline due to sleep mode or offline due to some other reason.

Your best bet would be an automation to alert you if the device has been offline for longer than the configured sleep time.

1 Like