Can't figure out how to set up a reliable 'uptime' check for my bluetooth gas bottle sensor

I’m monitoring a gas bottle that we use for cooking and hot water, and I’m using the Mopeka Pro Check BLE Sensor component for ESPHome. I’ve set up a health check on https://healthchecks.io to ensure that the level data is being updated regularly. I have something already working for some BLE temp/humidity sensors in Node-RED:

These are working alright because the temperature regularly changes by at least 0.1C. But I’m into a problem with the BLE gas bottle sensor, because the level might not change that frequently. E.g. If we’re away on the weekend and not using any gas, then the level won’t change.

I assumed that Home Assistant would update the last_updated timestamp for a sensor whenever it received a value, even if the value hadn’t changed. But you can see the level is 96% and last_updated is 5:04pm:

But I’m still seeing regular updates from ESPHome logs at 5:55pm, but this doesn’t seem to affect the last_updated time:

Workarounds:

  • The “distance” sensor seems to be a little bit unstable and often changes by +/- 1mm, so I could use this one instead of the rounded percentage integer.
  • I could use the temperature sensor since this would change throughout the day and night.

Either of those probably would work fine, but I’m just wondering if there’s a nicer way to do this.

I saw that ESPHome Sensor components support a expire_after option, but that’s only available for MQTT sensors and I get an error when trying to use it on these sensors:

This would be awesome if it worked, since the sensors report a value every 30 seconds. It would be nice to get an alert immediately if they don’t report a value for a few minutes, so I’ll know that something is wrong with the sensor or ESP32 board. I’d like to get faster and more reliable downtime alerts for my BLE temp/humidity sensors as well.

Does anyone have any ideas or suggestions? Is there something like a “value received” event in Home Assistant?


I found these related discussions, but couldn’t find a solution: