mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-18 05:26:19 +00:00
At startup list all currently joined deviced and set them to be "online" so shepherd wont try to query them for info (that would fail, because the devices go to sleep)
This commit is contained in:
@@ -13,7 +13,13 @@ var shepherd = new ZShepherd('/dev/ttyACM0', {
|
||||
});
|
||||
|
||||
shepherd.on('ready', function() {
|
||||
console.log('Server is ready.');
|
||||
console.log('Server is ready. Current devices:');
|
||||
shepherd.list().forEach(function(dev){
|
||||
if (dev.type === 'EndDevice')
|
||||
console.log(dev.ieeeAddr + ' ' + dev.nwkAddr + ' ' + dev.modelId);
|
||||
if (dev.manufId === 4151) // set all xiaomi devices to be online, so shepherd won't try to query info from devices (which would fail because they go tosleep)
|
||||
shepherd.find(dev.ieeeAddr,1).getDevice().update({ status: 'online', joinTime: Math.floor(Date.now()/1000) });
|
||||
});
|
||||
// allow devices to join the network within 60 secs
|
||||
shepherd.permitJoin(60, function(err) {
|
||||
if (err)
|
||||
|
||||
Reference in New Issue
Block a user