zha-ng / zha-map

Build ZHA network topology map.
MIT License
57 stars 17 forks source link

Some devices are showing as offline when they are online #6

Closed code-in-progress closed 4 years ago

code-in-progress commented 4 years ago

First off, this is absolutely awesome. Fantastic work!

So, I have installed and did my first scan. Some of my devices are showing as offline when they are online. This is one, it's a Sengled bulb. According to my ZHA devices panel, it last checked in at 2020-01-23T17:34:42 and is able to respond to commands. I have a few others that are doing the same thing. I know it's possible for sleepy devices to not wake up for a scan, but mains powered should always wake up, right?

image

image

walthowd commented 4 years ago

You can poke around the websocket API at zha_map/devices, or turn the logging to debug and run an on demand scan. Getting that info for one of the problematic devices would be a good start.

Easy to do in Node-RED and you can filter through a switch node: [{"id":"a76e0e8d.5ad5e","type":"inject","z":"adecbc41.3a6d6","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"600","x":120,"y":2100,"wires":[["d7ef797d.967538"]]},{"id":"d7ef797d.967538","type":"ha-api","z":"adecbc41.3a6d6","name":"API","server":"e2a02faf.48099","protocol":"websocket","method":"get","path":"","data":"{\"type\": \"zha_map/devices\"}","location":"payload","locationType":"msg","x":290,"y":2100,"wires":[["796f2fa1.82641"]]},{"id":"796f2fa1.82641","type":"change","z":"adecbc41.3a6d6","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"zha_map","tot":"msg"},{"t":"move","p":"zha_map.devices","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":2100,"wires":[["48706b66.6f6354"]]},{"id":"48706b66.6f6354","type":"split","z":"adecbc41.3a6d6","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":810,"y":2100,"wires":[["7f0399e.a269168"]]},{"id":"7f0399e.a269168","type":"debug","z":"adecbc41.3a6d6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1010,"y":2100,"wires":[]},{"id":"e2a02faf.48099","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":false,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

Adminiuga commented 4 years ago

Hrm, it is an end device (never understood the point of it being an end device) and apparently it was not found in any of the routers neighbor tables? There should be neighbours folder in the HA configuration directory. Check if any of the files there contain the IEEE address of this light.

code-in-progress commented 4 years ago

I checked the neighbors files and that IEEE address is not there.

homeassistant@ha:/home/homeassistant/.homeassistant/neighbours $ grep -l 'b0:ce:18:14:03:54:f9:a4' *.txt

code-in-progress commented 4 years ago

So, just to add, I have 14 devices that are showing offline right now. 5 of them, I know about (they are truly offline). The other 9 are all online and available. What's odd is that they are all Sengleds (E11-N1EA bulbs). So, I wonder if there is something unique about them that might be causing it?

Adminiuga commented 4 years ago

Sengleds are unique in a sense, they are mains powered devices but act like a Zigbee End Device, i.e. words requiring a parent device for communication with the zigbee network. Since they require a "parent" device, one of the routers must have them in their neighbor table as a child device.

enable custom_componenst.zha_map debug logging. After the scan pass finishes, it should log a message and do a basic sanity check, like devices in the database but not in the neighbor table and vice versa. Something like

2020-01-24 10:54:04 DEBUG (MainThread) [custom_components.zha_map] Finished neighbour scan pass. Failed: [00:0b:57:ff:fe:xx:xx::xx, 7c:b0:3e:aa:00:xx:xx:xx]
2020-01-24 10:54:04 DEBUG (MainThread) [custom_components.zha_map] Neighbour not in 'zigbee.db': 00:15:8d:00:02:xx:xx:xx - End_Device
2020-01-24 10:54:04 DEBUG (MainThread) [custom_components.zha_map] Neighbour not in 'zigbee.db': 00:15:8d:00:02:xx:xx:xx - End_Device
2020-01-24 10:54:04 DEBUG (MainThread) [custom_components.zha_map] 00:0b:57:ff:fe:xx:xx:xx (Keen Home Inc SV02-612-MP-1.2) was not found in the neighbours tables
2020-01-24 10:54:04 DEBUG (MainThread) [custom_components.zha_map] 00:15:8d:00:02:xx:xx:xx (LUMI lumi.sensor_magnet.aq2) was not found in the neighbours tables
2020-01-24 10:54:04 DEBUG (MainThread) [custom_components.zha_map] 00:15:8d:00:02:xx:xx:xx (LUMI lumi.sensor_magnet.aq2) was not found in the neighbours tables

Maybe that would provide more details. I wonder if Sengleds are doing something not quite standard and don't actually pick a parent device. But how they communicate with the network then???

lightmaster commented 4 years ago

Unsure whether or not this is a related issue, but its telling me that my HUSBZB-1 is offline when its definitely not.

lluiscab commented 4 years ago

I'm experiencing a similar issue that seems to be related to https://github.com/dmulcahey/zha-network-visualization-card/issues/17#issuecomment-677576105

My Zigbee Coordinator coordinator seems to not be properly detected as it's device type appears as unk (which I assume from the code means Unknown) and it's offline status also appears as false on the neighbours file which I assume causes the visualization card to not work properly.

Aside from this, everything works perfectly and all my sensors are working so my only guess it that the scanner does not properly recognize the Sonoff Dongle device type.

I have enabled debug mode for this component and I can't see any apparent errors. Maybe someone can take a look.

[homeassistant.core] Bus:Handling <Event call_service[L]: domain=zha_map, service=scan_now, service_data=> [custom_components.zha_map] Building topology starting from coordinator [custom_components.zha_map.neighbour] [00:12:4b:00:1c:ce:33:0f]: neighbor request Status: Status.SUCCESS. Response: <Optional Entries=2 StartIndex=0 NeighborTableList=[, ]> [custom_components.zha_map.neighbour] [00:12:4b:00:1c:ce:33:0f]: Done scanning. Total 2 neighbours [custom_components.zha_map] Adding 00:12:4b:00:1f:94:2f:30 to all neighbours [custom_components.zha_map] Adding 00:12:4b:00:1f:91:8d:36 to all neighbours [custom_components.zha_map] Saving /config/neighbours/neighbours_00124b001cce330f.txt [custom_components.zha_map] Finished neighbour scan pass. Failed: [] [custom_components.zha_map] 00:12:4b:00:1c:ce:33:0f (Texas Instruments ZNP Coordinator) was not found in the neighbours tables [custom_components.zha_map] Building topology starting from coordinator [custom_components.zha_map.neighbour] [00:12:4b:00:1c:ce:33:0f]: neighbor request Status: Status.SUCCESS. Response: <Optional Entries=2 StartIndex=0 NeighborTableList=[, ]> [custom_components.zha_map.neighbour] [00:12:4b:00:1c:ce:33:0f]: Done scanning. Total 2 neighbours [custom_components.zha_map] Adding 00:12:4b:00:1f:94:2f:30 to all neighbours [custom_components.zha_map] Adding 00:12:4b:00:1f:91:8d:36 to all neighbours [custom_components.zha_map] Saving /config/neighbours/neighbours_00124b001cce330f.txt [custom_components.zha_map] Finished neighbour scan pass. Failed: [] [custom_components.zha_map] 00:12:4b:00:1c:ce:33:0f (Texas Instruments ZNP Coordinator) was not found in the neighbours tables

jimford-sudo commented 4 years ago

I’ve installed zha_map and the zha-network-visualisation-card, and am getting a partial map displayed.

The entities are there with the end devices as circles and my coordinator as a rectangle, but there are no linking lines. The rectangle for the coordinator shows ‘offline’.

The coordinator must in fact be online as my zigbee devices all work OK!

The coordinator is a Sonoff ZBridge flashed with Tasmota.