fix topic filter
This commit is contained in:
@@ -38,9 +38,9 @@ class Lineplug extends DeviceBase {
|
|||||||
// monitor queue
|
// monitor queue
|
||||||
this.mqtt.on('message', (topic, message) => {
|
this.mqtt.on('message', (topic, message) => {
|
||||||
// message is Buffer
|
// message is Buffer
|
||||||
|
if (topic == this.topic_set) { // verify that the topic is correct
|
||||||
let payload = message.toString()
|
let payload = message.toString()
|
||||||
this.logger.debug(`input ${topic}: ${payload}`)
|
this.logger.debug(`input ${topic}: ${payload}`)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const jsonpayload = JSON.parse(payload)
|
const jsonpayload = JSON.parse(payload)
|
||||||
if (jsonpayload.value != undefined) {
|
if (jsonpayload.value != undefined) {
|
||||||
@@ -54,6 +54,7 @@ class Lineplug extends DeviceBase {
|
|||||||
this.logger.trace(payload)
|
this.logger.trace(payload)
|
||||||
this.logger.trace(error)
|
this.logger.trace(error)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user