Publishing a topic in JSON Format

476 views
Skip to first unread message

David Tschank

unread,
May 31, 2019, 6:25:14 PM5/31/19
to Routix
Dear developer,
I'm using the MQTT Dash app and i enjoy it very much. Im currently trying to publish a topic in the JSON format but it doesnt seem to work. do you have an example for me which i can use?

Im trying to use a dimmer and my device expects a JSON in the format below:

/my/topic/
{
  "state": "ON",
  "brightness": 10
}

How can i do it with the MQTT Dash app.

Thank you in advance

Best regards
David

SK Foo

unread,
Sep 5, 2019, 3:37:05 AM9/5/19
to Routix
I am also interested with this , publishing via json format.

Routix.net

unread,
Sep 13, 2019, 3:23:52 PM9/13/19
to Routix
Sorry guys. Not possible for now.

Michael Wu

unread,
Apr 24, 2020, 9:10:22 AM4/24/20
to Routix
waitting for new version !!

在 2019年6月1日星期六 UTC+8上午6:25:14,David Tschank写道:

LeX Xai

unread,
Apr 24, 2020, 2:31:38 PM4/24/20
to Routix

mq11.jpg



on Receive
if (!event.data) { event.data = {}; }
event.data['obj'] = JSON.parse(event.payload);
on Tap
event.preventDefault = true;
if (event.data['obj']) {
 s
=event.data['obj'].state=='ON';
 
event.data['obj'].state=s?'OFF':'ON';
 app
.publish('/wrt/butt', JSON.stringify(event.data['obj']), false, 1);
}

mosquitto_sub -h  host -t /my/topic/
{"state":"OFF","brightness":10}
{"state":"ON","brightness":10}
{"state":"OFF","brightness":10}
{"state":"ON","brightness":10}



субота, 1 червня 2019 р. 01:25:14 UTC+3 користувач David Tschank написав:
Reply all
Reply to author
Forward
0 new messages