From 3179c84684341ce1c74011833ae709cd2743c798 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Tue, 27 Mar 2018 21:03:07 +0200 Subject: [PATCH] still status handling --- dist/RelayBox.js | 10 +++++++++- src/RelayBox.ts | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/dist/RelayBox.js b/dist/RelayBox.js index 5af4c58..9154dce 100644 --- a/dist/RelayBox.js +++ b/dist/RelayBox.js @@ -16,14 +16,22 @@ class RelayBoxThing extends AItem_1.AItem { ]; } processMessage(topic, payload) { - logger.info(`RT: ${topic}, ${payload}`); + // 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}`); + logger.info(`RT: device: ${status.metadata.device}`); + logger.info(`RT: uptime: ${status.data.uptime}`); + for (let i = 0; i < this.itemNames.length; i++) { + logger.info(`RT: state: ${status.data.switchstatus[i].state}`); + logger.info(`RT: feedb: ${status.data.switchstatus[i].feedbackState}`); + logger.info(`RT: confl: ${status.data.switchstatus[i].stateConflict}`); + } } else { + logger.info(`RT: ${topic}, ${payload}`); let thingRelatedPart = topic.substring(this.stateTopicPre.length + 1); let itemIdx = parseInt(thingRelatedPart); logger.info(`RT: pre: ${this.stateTopicPre}, thingRelatedPart: ${thingRelatedPart}, itemIdx: ${itemIdx}`); diff --git a/src/RelayBox.ts b/src/RelayBox.ts index 56b069a..495d879 100644 --- a/src/RelayBox.ts +++ b/src/RelayBox.ts @@ -32,6 +32,11 @@ export class RelayBoxThing extends AItem { logger.info(`RT: status parsed: ${statusParsed}`) logger.info(`RT: device: ${status.metadata.device}`) logger.info(`RT: uptime: ${status.data.uptime}`) + for (let i : number = 0; i < this.itemNames.length; i ++) { + logger.info(`RT: state: ${status.data.switchstatus[i].state}`) + logger.info(`RT: feedb: ${status.data.switchstatus[i].feedbackState}`) + logger.info(`RT: confl: ${status.data.switchstatus[i].stateConflict}`) + } } else { logger.info(`RT: ${topic}, ${payload}`) let thingRelatedPart = topic.substring(this.stateTopicPre.length+1)