Attempt to fix lastSeen incorrect leading to incorrect offline state. #3650

This commit is contained in:
Koen Kanters 2020-06-01 16:38:24 +02:00
parent a9b54ad668
commit fda1246fca

View File

@ -95,12 +95,12 @@ class Availability extends Extension {
} }
async handleIntervalNotPingable(device) { async handleIntervalNotPingable(device) {
const ago = Date.now() - device.lastSeen;
const resolvedEntity = this.zigbee.resolveEntity(device.ieeeAddr); const resolvedEntity = this.zigbee.resolveEntity(device.ieeeAddr);
if (!resolvedEntity || !device.lastSeen) { if (!resolvedEntity || !device.lastSeen) {
return; return;
} }
const ago = Date.now() - resolvedEntity.device.lastSeen;
logger.debug(`Non-pingable device '${resolvedEntity.name}' was last seen '${ago / 1000}' seconds ago.`); logger.debug(`Non-pingable device '${resolvedEntity.name}' was last seen '${ago / 1000}' seconds ago.`);
if (ago > Hours25) { if (ago > Hours25) {