Page 1 of 1

"Generic - MQTT Import" problem

Posted: 12 Jun 2020, 16:47
by Andrew Mamohin
I would like to transfer data from nodered over MQTT to my ESPeasy device.
I can not configure this.
I configured Controller, and I saw in mosquitto_sub how ESP sends data.
AxO3fXmXXu.png
AxO3fXmXXu.png (23.35 KiB) Viewed 1381 times
"
Client mosqsub|11803-orange received PUBLISH (d0, q0, r1, m0, 'cellar/status/LWT', ... (9 bytes))
Connected
Client mosqsub|11803-orange received PUBLISH (d0, q0, r1, m0, 'cellar/out/LWT', ... (9 bytes))
"
My data that I want to receive in ESP is as follows:
"
Client mosqsub|11803-orange received PUBLISH (d0, q0, r0, m0, 'cellar/in', ... (59 bytes))
{"idx":10,"nvalue":31.19,"svalue1":"31.19","t3":31,"t4":19}
Client mosqsub|11803-orange received PUBLISH (d0, q0, r0, m0, 'cellar/in', ... (55 bytes))
{"idx":7,"nvalue":29.3,"svalue1":"29.3","t1":29,"t2":3}
"
I configured device in ESP. What mistakes have I made? I tried different options in Generic setup - MQTT Import, but I did not receive the data.
9DUOWOTvHB.png
9DUOWOTvHB.png (25.52 KiB) Viewed 1381 times
Maybe MQTT is not working correctly in my firmware version? But, I can not use another version because of the PZEM-004 device.
jrA1SWDKvh.png
jrA1SWDKvh.png (26.48 KiB) Viewed 1381 times

Re: "Generic - MQTT Import" problem

Posted: 13 Jun 2020, 11:26
by TD-er
The strings you receive don't look like numerical values, but more like JSON formatted data.
MQTT import currently only supports simple strings which can be read as either an int or a float value.

Re: "Generic - MQTT Import" problem

Posted: 13 Jun 2020, 14:47
by Andrew Mamohin
Can you write me an example of such an MQTT message so I can make it in NodeRed?

Re: "Generic - MQTT Import" problem

Posted: 13 Jun 2020, 15:06
by grovkillen
The message should be a simple numerical value.

Code: Select all

123.456

Re: "Generic - MQTT Import" problem

Posted: 13 Jun 2020, 21:08
by Andrew Mamohin
Wow! Thank! I did the conversion in NodeRed and everything started working correctly.
[attachment=0]FwlFnNf8Mf.png[/attachment]
[attachment=1]ceshLXdFhh.png[/attachment]