Zigbee device available but no status changes

I have a lot of sonoff zigbee temp sensors. And to detect if they are still working I check battery status and availability. it’s common that a battery dies when seconds ago it was still full for 80%.

but now I have a device, available, battery 100% (that can’t be right), but sensors havn’t updated for a month now.

I think I need to replace the battery, there is something wrong, but why is the device still available?

And my actual question. How would I spot such issues instead of stumbling on it by accident.
maybe check if the value is the same for 24 hours? but still, I use those sensors for heating and I would like to know this actually within the hour so I can stop heating the room if the sensor fails.

Battery is not a good datapoint for Zigbee sensors, but I can see that you have stale data. What’s your setup? Software, coordinator, how many routers etc.

You can set up an automation for stale data, example that you can modify:

  - platform: template
    value_template: >-
      {{ now() - states.sensor.yourzigbeesensor.last_updated >
      timedelta(minutes=yourtimeframe in minutes) }}

As software I use HAOS and ZHA. for the rest I have 1 coordinator, it’s also sonoff and 4 repaiters, with 20 endpoint devices. my topology is this.

and indeed a trigger like this would work for temperature if I won’t restart HA. because else the date gets updated.
also I would like to know this sooner, because when I use this for heating and I’m heating a room for 24 hours when the temp is reached, probably it will be very hot.
next to that I cannot use this for door sensors as some doors I do not open for days.

also last seen updates every few minutes

if there is no other way, there is no other way and i will need to create an automation or other kind of notification.

for now I added this template to my warning section which I see everytime I open HA.

type: custom:auto-entities
  type: entities
  state_color: true
  title: Warning!
  template: >-
    {{ states.sensor  | selectattr('attributes.device_class', '==',
    'temperature') | selectattr('last_updated', '<=', now() -
    timedelta(hours=12)) | map(attribute='entity_id') | list}}
    - attributes:
        device_class: battery
      state: < 5
    - attributes:
        device_class: battery
      state: unavailable
    - attributes:
        device_class: battery
      state: unknown
    - entity_id: binary_sensor.192_168_180_21
      state: 'off'
    - integration: mobile_app
  method: state
  numeric: true
show_empty: false

You could try adding more routers also.

true, but still there is a change this happens, and I would like to know.

Yesterday I reset the device, and now humidity is updating and temperature is not, it updated 1 time after the reset.
battery is still 100% but I think the battery is weak, and that issue would still persists with more routers.
more routers might increase the battery life, that’s true.

If I have the time I will replace the battery today, normally I wait for this when the kids are a sleep, but this is a sensor in one of their bedrooms, so I cannot do this when he is sleeping.

More routers will increase better response/signal from weaker devices. Battery life is a secondary benefit if anything.

thank you all,
I replaced the battery, and after 4 resets the device seems to work,
maybe there is something broken as I needed 4 resets.
but my question was not how to fix or improve, but it was how to detect stale sensors and that part has been answered. And if the issue occurs again in the coming few weeks, I will just replace the device.