zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

Testing: device availability

Open Koenkk opened this issue 7 years ago • 119 comments

This allows zigbee2mqtt to mark individual devices as offline. E.g. when you switch a bulb off using the regular switch.

The device availability is published on zigbee2mqtt/[FRIENLDY_NAME]/availability with possible payloads being offline and online.

Home Assistant integration has been updated, devices will be shown as unavailable when they are offline.

Device availability is only checked for AC powered routers.

Todos

How to test Update zigbee2mqtt to the latest dev branch (edge for hassio users). Stop zigbee2mqtt, add to zigbee2mqtt configuration.yaml

advanced:
  availability_timeout: 60 # Availability check interval

start zigbee2mqtt and restart Home Assistant.

Most of the credits of this feature go to @ugrug

Koenkk avatar Dec 29 '18 18:12 Koenkk

doesnt work with hassio/zigbee2mqtt-edge. Can't see anything different. (when is zigbee2mqtt-edge updated to most recent source?)

wimpie007 avatar Dec 30 '18 10:12 wimpie007

Should be, can you post your startup log?

Koenkk avatar Dec 30 '18 11:12 Koenkk

sure. https://pastebin.com/VaamLD4M and in configuration.yaml: experimental: availablility_timeout: 60

regards,

wimpie007 avatar Dec 30 '18 11:12 wimpie007

@wimpie007 I see that your are running #2a197a4, this was introduced in a later commit #afeed4f372bced737206bd91f8e62ce65b127eb9 (this can be seen in the startup log).

Note that also a typo has just been fixed availablility -> availability, I've updated the configuration in the OP. Wait at least one hour to give the hassio addon some time to regenerate.

Koenkk avatar Dec 30 '18 19:12 Koenkk

I stopped/started the zigbee2mqtt-edge addon in hassio this morningn (auto-update is on), but still on commit #2a197a4. In hassio, i can't do more to 'force' the update?

wimpie007 avatar Dec 31 '18 09:12 wimpie007

I dont understand why, the image has been updated 14 hours ago which makes sense (https://hub.docker.com/r/dwelch2101/zigbee2mqtt-edge-armhf/tags). @danielwelch could you help?

Koenkk avatar Dec 31 '18 12:12 Koenkk

I don’t think starting and stopping alone should work, as this doesn’t pull the new image. You need to uninstall and re-install.

danielwelch avatar Dec 31 '18 13:12 danielwelch

Thanks! uninstall/install did the trick, bit annoying, but ok!:) will report later on....

wimpie007 avatar Dec 31 '18 14:12 wimpie007

doesnt seem to do anything... here is the start-log. https://pastebin.com/u5kANWCm

wimpie007 avatar Dec 31 '18 15:12 wimpie007

Can you post a bit more of you startup log? I'm especially interested in the homeassistant/ topic it publishes to.

Koenkk avatar Dec 31 '18 18:12 Koenkk

sure! https://pastebin.com/WmXvQ2Qz PS Happy 2019!!:)

wimpie007 avatar Jan 01 '19 13:01 wimpie007

Happy 2019! Somehow the functionallity is not enabled yet (because it still publishes zigbee2mqtt/bridge/state as availabillity topic). Can you post the experimental part of your configuration.yaml again?

Koenkk avatar Jan 01 '19 16:01 Koenkk

config in hass.io: { "data_path": "/share/zigbee2mqtt", "homeassistant": true, "permit_join": false, "mqtt_base_topic": "zigbee2mqtt", "mqtt_server": "mqtt://homeassistant:1883", "serial_port": "/dev/ttyACM0", "disable_led": true, "log_level": "debug", "zigbee_shepherd_debug": false }

and config yaml: https://pastebin.com/mtYCa2G4

EDIT! DOH! i did a paste from the instruction site, and copied also the typo: availablility_timeout: 60

will test again with availability_timeout

wimpie007 avatar Jan 01 '19 17:01 wimpie007

YES! we are getting somewhere! for the lights it works! show up as "unavailable" when powered-off. BUT... also for al the sensors. Sensors show all up as unavailable as they do not respond to ping... "Device availability is only checked for AC powered routers.": not true!:)

wimpie007 avatar Jan 01 '19 17:01 wimpie007

Can you post your log_level: debug log?

Koenkk avatar Jan 01 '19 17:01 Koenkk

https://pastebin.com/bbu0MEnD see for example device: 0x00158d00029c076d (0x00158d00029c076d): RTCGQ11LM - Xiaomi Aqara human body movement and illuminance sensor (EndDevice)

wimpie007 avatar Jan 01 '19 18:01 wimpie007

Found the bug, should be fixed

Koenkk avatar Jan 01 '19 21:01 Koenkk

Koen, thanks! it works now! state of the lamps doesnt reflect reality after power off/on, but that is another issue... a big step for this project! nice!

wimpie007 avatar Jan 02 '19 19:01 wimpie007

I think that could be fixed relatively easy, we just need to poll the state when yhe bulb comes back online. (unfortunately I dont have access to my laptop for a few days)

Koenkk avatar Jan 02 '19 20:01 Koenkk

@Koenkk I can also confirm that it works for me on a bunch of different Trådfri bulbs as well as some Philips Hues. I don't see any updates for my battery driven sensors/buttons as expected..

It would be great if you also manage the state of the lights send to Home Assistant as mentioned by @wimpie007.

Under all circumstances - thanks for doing/maintaining this brilliant project !

martinrosenauer avatar Jan 03 '19 19:01 martinrosenauer