List unavailable entities sometimes not working

For a list of unavailable entities in a dashboard I use the auto entities card:

type: custom:auto-entities
card:
  type: entities
  title: Offline entities
filter:
  include:
    - domain: button
      integration: zha
      state: unavailable
  exclude:
    - label: Unavailable_OK
    - label: Unavailable_possible

It is working fine in a browser using a proxy https://…domain. It is working fine in a browser using my home URL (homeassistant:8123) without proxy. It is working fine in the Home Assistant companion app using the proxy https://…domain (used when I’m not at home in the WLAN).

But if my mobile is connected at home (homeassistant:8123) using the companion app for Android, the list is not ok! Instead of listing one or two entities, there is a lot of devices listed, most of them having the excluded label set. Seems the exclude filters are not doing the restriction.

Is there any obvious reason for this behavior?

No idea. But why do you need to list unavailable entities?

There are usually two reasons why a device of ZigBee type gets unavailable:

  1. It has no reception
  2. It has no power

To 1.:

Some Styr remote control by IKEA in my house lost reception in the past until battery is removed and installed again. Maybe a reset would have helped also.

Some window sensor also has flaky contact, probably bad reception. Available often once an hour for several minutes.

I’d like to have that in a list, but not get notified several times a day because that sensor is unavailable again.

To 2.:

Many light bulbs are behind a real switch and/or a Shelly. For these is is ok to get unavailable.

Some components are not always installed or may change places. I have for instance a power measuring plug which I sometimes use for different devices to check their consumption, but it also may be completely offline. For these devices it is possible that is OK that they are offline.

Purpose:

I’d like to know which lights, remote controls, window or door sensors or temperature sensors which are expected to be always available are offline.

Maybe I want a notification in the future, but currently I just have that list, mainly for the Styr. For these I want a notification, but I haven’t configured it yet.

But all those light bulbs behind a switch appear in the unavailable list in the app, if the app is being used in the home WLAN.

I’d like to know the reason for this behavior. If I don’t use that list anymore at a later time, I’d still like to know why there are circumstances for the auto entities card not to work fine and if I can use it for other lists.

Have you looked at the Watchman integration?

It won’t meet all your requirements as it only monitors config files, but it might be a useful supplement to your list.

I have been using this and it works well on both mobile app and browser:

unavailable-entities-sensor/README.md at e003e809e45404ee0a9af7aaaa3e698f216952bb · jazzyisj/unavailable-entities-sensor · GitHub.

This is probably causing your first issue. Zigbee bulbs that do routing do not do well when being switched on and off at the switch. This WILL causes issues in your mesh, which is what I think you are seeing. Most Zigbee end devices (buttons, remotes, sensors, etc) will continue to try to route through whatever router they are attached to and it may take up to 2 hours (or more) to re-route again when the source router is offline. This is why after a battery pull or re-pair, the device works again. If you have bulbs that absolutely must be controlled with a hard on/off, I’d go with bulbs that are specifically NOT router devices (Sengleds fit this criteria).

@code-in-progress:

As I’m aware that ZigBee builds a mesh and devices with power usually are routers, my first action was to plug ZigBee plugs into some central plug in ground floor and 1st floor. Usually that works fine, the last time the remote controls weren’t available is several weeks ago.

The switches aren’t replaced, nearly all bulbs are ZigBee bulbs and behind a switch.

A special case it the SILVERGLANS from IKEA. It was planned to have always power. But the transformer does a sound which gets louder the darker the light is. One does not want to be in the same room with that light, if it is not turned on. So I put it behind a shelly to turn the power off and have silence.

Everything works fine. I would not put such a mechanism in place if it wouldn’t work in general.

@Stiltjack: Thanks for the hint, I’ll have a look at the Watchman integration. But the way it works as told in the readme sounds as if it would do many unnecessary checks. Iterating overall entities, even those that are not relevant. But I’ll have a look.

@MaxK: Thank you, the unavailable-entities-sensor seems to do the same as I do manually and could be an indirection that prevents my current problem.

Yeah, but those bulbs are routers. When you switch them off (even though they are annoying), you break the routes in the mesh. There’s no getting around that. Even if you have other routers in the mesh, Zigbee is a SLOW protocol and can take hours (or days, depending on the size of your mesh) to rebuild routes and some end devices won’t even bother rebuilding routes. They just give up and drop off the mesh. I get the silence thing, but honestly, your mesh is always going to be in a repairing state due to the power to some bulbs being cut.