Thank you. I'd been battling with some of this for a few days now and you stepped me through it. I'd tried several other videos but they didn't quite cover things at the right level (either too basic or too advanced). This was spot on. I'm going to be watching a lot of your videos now as you seem to have done exactly what I am trying to achieve.
Very useful explanation, I used this video step-by-tep to learn how an mqtt-message is converted from a string into an object and convert into values to GUI display. The fact that i had to manually copy the code from the still-video forced me to learn how the syntax is ;-)
Another good way to test / view MQTT data is to use MQTT-spy which works on both Windows and Linux. This can be used to see data being processed by MQTT, it can also send messages that the user sets up. A very good tool IMHO.
Hi Steve, I attempt to drag the nodes for "Receive JSON Data Over MQTT with Node-Red" to my node-red but I receive an error yesterday that reads: Error: Invalid Flow: JSON parser: unpected non-whitespace character after JSON Data at line 1 column 2 of the JSON data. Today I try this again and I receive: Error: Invalid Flow: JSON parser: Unable to parse JSON string. Can you help resolve this?
@@stevecope When I used MQTT to receive the status for switch. The data I received below: 21:26:53, 18/6/2022node: 8bd53e94befc73b9 CBL/NamKa/Control/Pub/mp3 : msg.payload : Object object d: object mp3: array[1] 0: true ts: "2022-06-18T13:26:53.297214" However, the switch didn't change status. The JSON in "On Payload", I set it up like below : { "d": { "mp3": [ true ] } } Maybe, I didn't process timestamp.
@@stevecope , When I used MQTT to receive the status for switch. The data I receive below: 21:26:53, 18/6/2022node: 8bd53e94befc73b9 CBL/NamKa/Control/Pub/mp3 : msg.payload : Object object d: object mp3: array[1] 0: true ts: "2022-06-18T13:26:53.297214" However, the switch didn't change status. The JSON in "On Payload", I set it up like below: { "d": { "mp3": [ true ] } } Maybe, I didn't process the timestamp.
@@jennifergarner6318 Not sure this applies to the video. Not sure were you are getting the data you are receiving. Many devices will send status information on a periodic basis regardless of state change. If it is JSON data with a time stamp or counter then you need to extract the status from the data and check if that has changed. Is that what you need? rgds Steve
could you please upload the python code if you don't mind the download page contain only the JSON related to the experiment to import it into the Node-Red
The mosca broker replaces the mosquitto broker not the python script. You could generate test data manually or use the flow from the publishing video to publish Json data.
Thank you. I'd been battling with some of this for a few days now and you stepped me through it. I'd tried several other videos but they didn't quite cover things at the right level (either too basic or too advanced). This was spot on. I'm going to be watching a lot of your videos now as you seem to have done exactly what I am trying to achieve.
Very useful explanation, I used this video step-by-tep to learn how an mqtt-message is converted from a string into an object and convert into values to GUI display. The fact that i had to manually copy the code from the still-video forced me to learn how the syntax is ;-)
Another good way to test / view MQTT data is to use MQTT-spy which works on both Windows and Linux. This can be used to see data being processed by MQTT, it can also send messages that the user sets up. A very good tool IMHO.
Very good videos. Thank you
Hi Steve, I attempt to drag the nodes for "Receive JSON Data Over MQTT with Node-Red" to my node-red but I receive an error yesterday that reads: Error: Invalid Flow: JSON parser: unpected non-whitespace character after JSON Data at line 1 column 2 of the JSON data.
Today I try this again and I receive: Error: Invalid Flow: JSON parser: Unable to parse JSON string. Can you help resolve this?
Hi
Is it your flow or one that you downloaded?
@@stevecope , This is one that I downloaded from your downloads link. I drag the flow in and I get this error. I tried others and they work.
hi
can you email me the flow steve.w.cope@gmail.com
Thank you very much for your video. How about the switch (on/off)?
Sorry what switch
@@stevecope
When I used MQTT to receive the status for switch. The data I received below:
21:26:53, 18/6/2022node: 8bd53e94befc73b9
CBL/NamKa/Control/Pub/mp3 : msg.payload : Object
object
d: object
mp3: array[1]
0: true
ts: "2022-06-18T13:26:53.297214"
However, the switch didn't change status. The JSON in "On Payload", I set it up like below :
{
"d": {
"mp3": [ true ]
}
}
Maybe, I didn't process timestamp.
@@stevecope ,
When I used MQTT to receive the status for switch. The data I receive below:
21:26:53, 18/6/2022node: 8bd53e94befc73b9
CBL/NamKa/Control/Pub/mp3 : msg.payload : Object
object
d: object
mp3: array[1]
0: true
ts: "2022-06-18T13:26:53.297214"
However, the switch didn't change status. The JSON in "On Payload", I set it up like below:
{
"d": {
"mp3": [ true ]
}
}
Maybe, I didn't process the timestamp.
@@jennifergarner6318 Not sure this applies to the video. Not sure were you are getting the data you are receiving. Many devices will send status information on a periodic basis regardless of state change. If it is JSON data with a time stamp or counter then you need to extract the status from the data and check if that has changed. Is that what you need?
rgds
Steve
@@stevecope , thank you for your help. I cut the timestamp in the receive data, the switch understand it.
could you please upload the python code if you don't mind
the download page contain only the JSON related to the experiment to import it into the Node-Red
I've uploaded it to the download page
thanks steve!
how do we make the same process, but with local mosca broker, which mean local server without relying on python ?!
The mosca broker replaces the mosquitto broker not the python script. You could generate test data manually or use the flow from the publishing video to publish Json data.