Zigbee2mqtt light still showing up even when powered off

I just installed Zigbee2mqtt from the hassio addon and paired two IKEA trådfri lightbulbs. I also made a router from a CC2530 module. I noticed that the modules still show up in hassio even if I remove power from them. I can for example turn on a light and then pull the power for it, it will still show up as ON in hassio. If I try to turn it off it just pops back to ON state. I also still see the linkquality.
I can see in the Zigbee2mqtt log that it reports an issue:

zigbee2mqtt:info 10/1/2019, 12:05:11 PM Zigbee publish to device '0x000d6ffffe21a263', genOnOff - on - {} - {"manufSpec":0,"disDefaultRsp":0} - 1
  zigbee2mqtt:error 10/1/2019, 12:05:12 PM Zigbee publish to device '0x000d6ffffe21a263', genOnOff - on - {} - {"manufSpec":0,"disDefaultRsp":0} - null failed with error Error: AF data request fails, status code: 233. MAC no ack.
  zigbee2mqtt:info 10/1/2019, 12:05:12 PM MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"zigbee_publish_error","message":"Error: AF data request fails, status code: 233. MAC no ack.","meta":{"entity":{"ID":"0x000d6ffffe21a263","type":"device","friendlyName":"0x000d6ffffe21a263"},"message":"{\"state\": \"ON\"}"}}'

When I was using the IKEA trådfri gateway I think the lights became sort of greyed out and it said “unavailable” or something like that.

Is this the way it is supposed to work?

I think so.See this topic:

Hi francisp,
I think I found the solution, there is a setting in the Zigbee2mqtt config called availability_timeout.
I found it in the zigbee2mqtt documentation

I added that to my hassio config and it looks like it is working fine. I set it to 60 seconds and now I get the light to show up as unavailable if I unplug it and wait a minute. I guess you can set it to one second as well but not sure what kind of impact that will have on performance…

This only works for non battery powered zigbee modules but that is good enough for me.

"network_key": [
    "availability_timeout": 60,
    "availability_blacklist": []

Thanks. That is good news. I will try it out !!!

I will try it today.

Do you have retain:true in your config for that device.

HA is looking at mqtt for its state, if you removed the power whilst its in the on state, that is the last state on the mqtt server. that’s why HA still sees it as on and toggles the switch back

I does have an impact on the performance. Normally I have a htop of 0.16 0.16 0.16. When I put the

"availability_timeout": 60,

in the configuration, I have a htop of 0.63 0.60 0.50

(zigbee2mqtt on bare metal, hassio in container on same RBpi, mosquitto on separate RBpi)

Interesting. Going to check this out, thanks for the information.

@francisp How many AC powered routers do you have? The documentation mentions that only those devices will be checked:

# Only AC powered routers are checked for availability

Light bulbs included, I guess, they act as routers. But yeah, that’s a bit of a change in load. I’m going to check mine as well when I have the time to do it.

For the moment, 5 ikea plugs and a CC2531 stick flashed as router. Still need to buy some bulbs.