From fda1246fcac81b0ebf392a42c2766e4293aecb90 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Mon, 1 Jun 2020 16:38:24 +0200 Subject: [PATCH] Attempt to fix lastSeen incorrect leading to incorrect offline state. #3650 --- lib/extension/availability.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/extension/availability.js b/lib/extension/availability.js index dbf48651..f0dd1979 100644 --- a/lib/extension/availability.js +++ b/lib/extension/availability.js @@ -95,12 +95,12 @@ class Availability extends Extension { } async handleIntervalNotPingable(device) { - const ago = Date.now() - device.lastSeen; const resolvedEntity = this.zigbee.resolveEntity(device.ieeeAddr); if (!resolvedEntity || !device.lastSeen) { return; } + const ago = Date.now() - resolvedEntity.device.lastSeen; logger.debug(`Non-pingable device '${resolvedEntity.name}' was last seen '${ago / 1000}' seconds ago.`); if (ago > Hours25) {