Zigbee2mqtt device availability

Hi,

I have some zigbee lights with are switched on/off with “regular” wall switches. HA is used to control them once they are powered on.
When they are powered off, HA continues to report their latest status known. They never become unavailable.
Looking at zigbee2mqtt, I see that the availability parameter is disabled:

The zigbee2mqtt documentation suggest the following:

I tried various ways to do it, but was not successful.

Anyone to help me here? If something is possible, I would prefer to have it done somewhere else than in the configuration.yaml

Many thanks

Changing the global availability option can be set from the z2m front end under settings->availability.

You will not get immediate notification when the switch is flipped. The default “simple” availability marks mains devices unavailable after they’ve been silent for 10 minutes and do not respond to a ping. Choose advanced if you want to change the default timeout.

4 Likes

Thanks for the quick answer! Already implemented :smiley:

But where do i see that availability in HomeAssistant

1 Like

In the zigbee2mqtt addon (supervisor).

Hi,
in my case, i needed add these lines in the config of zigbee2mqtt to have the availability

advanced:
    legacy_availability_payload: false

I’m also enabling the availability on my zigbee devices and I see the message being published to the topics, but I don’t see any sensor in home assistant itself.
image

Anyone any idea what I’m missing here?
Or aren’t there any sensors created to reflect the availability status?

No new sensor. Existing sensor state(s) will change to “unavailable.”

So no sensor is available to just check the state, right?
Because I was thinking of creating an automation for detecting ‘offline’ states… So I won’t be able to do it with a specific sensor (unless I make it myself of course).

What do I need in the config for home asisstant for the legacy settings?

As now I have this:
image
image

While I see this in some online configs:
image

Not sure what’s the impact of those legacy flags?

I’m interested as well into having the availability of a device shown as an entity in HA.

I think you can use just state of the entity itself for the automation.

As soon as my light is offline its sate becomes “unavailable”, like that:

image
image

In Z2M config I have availability on global level as false but allowed it on device level only:

image

1 Like

Using the state is indeed a possible solution.
I’m currently using the availability option on global level, as I want it for all the zigbee devices.