Receive JSON Data Over MQTT with Node-Red

Поделиться
HTML-код
  • Опубликовано: 27 авг 2024

Комментарии • 25

  • @HaccasDave
    @HaccasDave 3 года назад

    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.

  • @codemees1916
    @codemees1916 5 лет назад +1

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

  • @bobcroft9610
    @bobcroft9610 5 лет назад

    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.

  • @The_Unobtainium
    @The_Unobtainium 3 года назад

    Very good videos. Thank you

  • @gilquinones6652
    @gilquinones6652 4 года назад

    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
      @stevecope  4 года назад

      Hi
      Is it your flow or one that you downloaded?

    • @gilquinones6652
      @gilquinones6652 4 года назад

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

    • @stevecope
      @stevecope  4 года назад

      hi
      can you email me the flow steve.w.cope@gmail.com

  • @jennifergarner6318
    @jennifergarner6318 2 года назад

    Thank you very much for your video. How about the switch (on/off)?

    • @stevecope
      @stevecope  2 года назад

      Sorry what switch

    • @jennifergarner6318
      @jennifergarner6318 2 года назад

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

    • @jennifergarner6318
      @jennifergarner6318 2 года назад

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

    • @stevecope
      @stevecope  2 года назад

      @@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

    • @jennifergarner6318
      @jennifergarner6318 2 года назад

      @@stevecope , thank you for your help. I cut the timestamp in the receive data, the switch understand it.

  • @petersamoaa8535
    @petersamoaa8535 6 лет назад

    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

    • @stevecope
      @stevecope  6 лет назад

      I've uploaded it to the download page

  • @aeny
    @aeny 5 лет назад

    thanks steve!

  • @petersamoaa8535
    @petersamoaa8535 6 лет назад

    how do we make the same process, but with local mosca broker, which mean local server without relying on python ?!

    • @stevecope
      @stevecope  6 лет назад

      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.