From f5463dbf0e7fa1a2a0825c92dc9aeea1c1156836 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Thu, 12 Sep 2019 22:50:51 +0200 Subject: [PATCH] Add last seen to zigbee2mqtt/bridge/config/devices/get. https://github.com/Koenkk/zigbee2mqtt/issues/1910 --- lib/extension/bridgeConfig.js | 1 + test/bridgeConfig.test.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/extension/bridgeConfig.js b/lib/extension/bridgeConfig.js index 0bf8ef944b..41aee44633 100644 --- a/lib/extension/bridgeConfig.js +++ b/lib/extension/bridgeConfig.js @@ -151,6 +151,7 @@ class BridgeConfig { payload.hardwareVersion = device.hardwareVersion; payload.softwareBuildID = device.softwareBuildID; payload.dateCode = device.dateCode; + payload.lastSeen = device.lastSeen; } return payload; diff --git a/test/bridgeConfig.test.js b/test/bridgeConfig.test.js index 1500749529..97bb57ba2b 100644 --- a/test/bridgeConfig.test.js +++ b/test/bridgeConfig.test.js @@ -159,7 +159,7 @@ describe('Bridge config', () => { const payload = JSON.parse(MQTT.publish.mock.calls[0][1]); expect(payload.length).toStrictEqual(Object.values(zigbeeHerdsman.devices).length); expect(payload[0]).toStrictEqual({"ieeeAddr": "0x00124b00120144ae", "type": "Coordinator"}); - expect(payload[1]).toStrictEqual({"friendly_name": "bulb", "ieeeAddr": "0x000b57fffec6a5b2", "manufacturerID": 4476, "model": "LED1545G12", "modelID": "TRADFRI bulb E27 WS opal 980lm", "networkAddress": 40369, "powerSource": "Mains (single phase)", "type": "Router"}); + expect(payload[1]).toStrictEqual({"friendly_name": "bulb", "ieeeAddr": "0x000b57fffec6a5b2", "lastSeen": 1000, "manufacturerID": 4476, "model": "LED1545G12", "modelID": "TRADFRI bulb E27 WS opal 980lm", "networkAddress": 40369, "powerSource": "Mains (single phase)", "type": "Router"}); }); it('Should allow to get groups', async () => {