MQTT topic

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
madru
New user
Posts: 2
Joined: 01 Nov 2019, 10:18

MQTT topic

#1 Post by madru » 01 Nov 2019, 10:30

Morning,

I am new to ESPEasy and I try to publish to my MQTT-Broker some values via a rule

reading the documentation it should be:

Code: Select all

Publish topic, payload 
some example show

Code: Select all

publish, top, payload

but I receive the following on the broker:

Topic = Publish, payload = topic

the log shows following:

Code: Select all

154584 : ACT  : Publish "topic", "payload"
154595 : Command: publish
I must do something wrong but I can't figure it out......


I searched the forum but did not find an answer :(

thank you for your help

M

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MQTT topic

#2 Post by TD-er » 01 Nov 2019, 13:50

Could you try with this test build: https://www.dropbox.com/s/7cbfjvg5ytlqc ... 8.zip?dl=0
Please let me know if these fixes do help you with your problem.

madru
New user
Posts: 2
Joined: 01 Nov 2019, 10:18

Re: MQTT topic

#3 Post by madru » 01 Nov 2019, 14:58

YEP :)

does fix the topic problem

👍

User avatar
dynamicdave
Normal user
Posts: 257
Joined: 30 Jan 2017, 20:25
Location: Hampshire, UK

Re: MQTT topic

#4 Post by dynamicdave » 01 Nov 2019, 16:08

I've just tried again with release... ESP_Easy_mega-20191028-21-PR_2698_normal_ESP8266_4M1M.bin

I have a publish command in a rule-set to publish a 'json' string.

It would seem if the payload is just a single item, then it works.
Publish,node24/ir_detector,{"ssid":"%ssid%"}

If it's more than one item, then is fails with "Failed to parse JSON string"
Publish,node24/ir_detector,{"ssid":"%ssid%","node_number":"node%unit%"}

Hope this helps to narrow-down the issue.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MQTT topic

#5 Post by TD-er » 01 Nov 2019, 17:43

Could you try wrapping the last parameter in the "other" quotes?

Code: Select all

Publish,node24/ir_detector,'{"ssid":"%ssid%","node_number":"node%unit%"}'

User avatar
dynamicdave
Normal user
Posts: 257
Joined: 30 Jan 2017, 20:25
Location: Hampshire, UK

Re: MQTT topic

#6 Post by dynamicdave » 01 Nov 2019, 18:39

Thanks for pointing out that I should have surrounded the json string (in the Publish command) with single quote marks.

I can confirm that the json string publishes correctly in this release ( ESP_Easy_mega-20191028-21-PR_2698_normal_ESP8266_4M1M.bin ).

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests