zigbeer / zigbee-shepherd

An open source ZigBee gateway solution with node.js.
MIT License
250 stars 89 forks source link

checkOnline in controller ZMemError #22

Open splitice opened 7 years ago

splitice commented 7 years ago

There is a function in controller.js _checkOnline which attempts by way of iteration of the database to determine what devices are online and joined to the network. The node descriptor request in this function always returns 0x10 - 0x11 corresponding to ZMemError & ZBufferFull which ensures the devices are never detected and hence marked as online.

This is using the ZNP build from Zigbeer.

splitice commented 7 years ago

I slowed the querying down and now most of the time it returns with a status code of 0, still ZNP online devices time out. & I can see with a packet sniffer that no node description request is actually being sent by the coordinator dongle.

Route Request packets do go out for those devices which are not on the network however. Those on the network are sent no packets.

splitice commented 7 years ago

Ok,

so there is two bugs in this function:

  1. Performing all of these (and anything else going on in the background, which is quite alot during initialization) at once results in memory exhaustion on the dongle.

  2. The timeout of 5s is insufficient for devices that sleep. In fact the devices I tested never return when queried here. If the device is not allowed to sleep during init, i.e for an IAS sensor if it is being toggled throught init then it does respond. ' I propose replacement of this method with an LQI based query to the routers in the network. This way the sleeping end devices are not involved.