Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update controller.js #1462

Merged
merged 4 commits into from
Apr 22, 2019
Merged

Update controller.js #1462

merged 4 commits into from
Apr 22, 2019

Conversation

andreasbrett
Copy link
Contributor

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).

I was happy to see the experimental feature to output attributes rather than JSON. Strings where published with quotes to the MQTT topic. Not sure if that is standard for MQTT but as there are no var types in MQTT everything should be handled as a string no matter if they are int, date or string.

Real issue I had:
I pointed openHAB's MQTT binding to the new MQTT topics while having the experimental z2m feature activated but openHAB complained that it didn't know the state '"OFF"' (see the double quotes?).

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).
@Koenkk
Copy link
Owner

Koenkk commented Apr 22, 2019

great, thanks!

@Koenkk Koenkk merged commit 32b76ed into Koenkk:dev Apr 22, 2019
@andreasbrett andreasbrett deleted the patch-8 branch May 12, 2019 12:20
wilmardo pushed a commit to wilmardo/zigbee2mqtt that referenced this pull request Sep 26, 2019
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants