more status handling
This commit is contained in:
@ -24,13 +24,16 @@ export class RelayBoxThing extends AItem {
|
||||
}
|
||||
|
||||
processMessage(topic: string, payload: string) {
|
||||
logger.info(`RT: ${topic}, ${payload}`)
|
||||
// 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}`)
|
||||
logger.info(`RT: device: ${status.metadata.device}`)
|
||||
logger.info(`RT: uptime: ${status.data.uptime}`)
|
||||
} 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}`)
|
||||
|
Reference in New Issue
Block a user