mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-28 05:24:29 +00:00
Improve non-JSON output (#1462)
* Update controller.js Do not use JSON.stringify when outputting Non-JSON to MQTT. When using JSON.stringify strings are quoted in the MQTT messages but they should not be quoted (MQTT is different from JSON). * Update controller.js * Update controller.js * Update controller.js
This commit is contained in:
committed by
Koen Kanters
parent
0eaf0ad5d6
commit
32b76edb7c
+2
-2
@@ -257,10 +257,10 @@ class Controller {
|
||||
if (typeof messagePayload[key] == 'object') {
|
||||
Object.keys(messagePayload[key]).forEach((subKey) => {
|
||||
this.mqtt.publish(`${entity.friendlyName}/${key}-${subKey}`,
|
||||
JSON.stringify(messagePayload[key][subKey]), options);
|
||||
`${messagePayload[key][subKey]}`, options);
|
||||
});
|
||||
} else {
|
||||
this.mqtt.publish(`${entity.friendlyName}/${key}`, JSON.stringify(messagePayload[key]), options);
|
||||
this.mqtt.publish(`${entity.friendlyName}/${key}`, `${messagePayload[key]}`, options);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user