From bd4bced0c06883e4ea52853c450549963412e688 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Tue, 27 Mar 2018 20:54:27 +0200 Subject: [PATCH] relaybox status handling --- dist/RelayBox.js | 3 +++ src/RelayBox.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/dist/RelayBox.js b/dist/RelayBox.js index 0b1b092..5af4c58 100644 --- a/dist/RelayBox.js +++ b/dist/RelayBox.js @@ -19,6 +19,9 @@ class RelayBoxThing extends AItem_1.AItem { logger.info(`RT: ${topic}, ${payload}`); if (topic == this.deviceStatusTopic) { logger.info(`RT: status received`); + let status = JSON.parse(payload); + let statusParsed = JSON.stringify(status); + logger.info(`RT: status parsed: ${statusParsed}`); } else { let thingRelatedPart = topic.substring(this.stateTopicPre.length + 1); diff --git a/src/RelayBox.ts b/src/RelayBox.ts index fc8c1ba..8e4b21f 100644 --- a/src/RelayBox.ts +++ b/src/RelayBox.ts @@ -27,6 +27,9 @@ export class RelayBoxThing extends AItem { logger.info(`RT: ${topic}, ${payload}`) if (topic == this.deviceStatusTopic) { logger.info(`RT: status received`) + let status : any = JSON.parse(payload) + let statusParsed: string = JSON.stringify(status) + logger.info(`RT: status parsed: ${statusParsed}`) } else { let thingRelatedPart = topic.substring(this.stateTopicPre.length+1) let itemIdx = parseInt(thingRelatedPart)