Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. [SOLVED] Serial to MQTT conversion by Node-red

[SOLVED] Serial to MQTT conversion by Node-red

Scheduled Pinned Locked Moved Development
3 Posts 2 Posters 2.5k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pavel Polititsky
    wrote on last edited by Yveaux
    #1

    Hi
    I'm trying to connect my serial mysensors gateway to orange PC with domoticz
    Domoticz accept only USB-serial device, LAN and MQTT.
    Now I want to convert serial data to MQTT with node-red and use MQTT gateway in Domoticz

    My node red clipboard:
    alt text

    serial to mqtt code:

    var sensor = msg.payload.split(";");
    msg.topic = "MySensors" + "/" + sensor[0] + "/" + sensor[1] + "/" + sensor[2] + "/" + sensor[3] + "/" + sensor[4];
    msg.payload = sensor[5];
    return msg;
    

    Output MQTT text when the gateway initializing:

    object
    payload: "0 MCO:BGN:INIT GW,CP=RNNGA---,VER=2.2.0↵"
    port: "/dev/ttyS1"
    _msgid: "619c024c.85ed8c"
    topic: "MySensors/0/255/3/0/9"
    

    other messages same like this

    Button node

    object
    payload: "328523 TSF:MSG:READ,1-1-0,s=4,c=1,t=16,pt=1,l=1,sg=0:0↵"
    port: "/dev/ttyS1"
    _msgid: "11581f7a.7c16b1"
    topic: "MySensors/0/255/3/0/9"
    
    object
    payload: "0↵"
    port: "/dev/ttyS1"
    _msgid: "782972d9.6e0e3c"
    topic: "MySensors/1/4/1/0/16"
    

    But gateway receiving nothing
    Also serial gateway node not found

    What im doing wrong?

    1 Reply Last reply
    0
    • rozpruwaczR Offline
      rozpruwaczR Offline
      rozpruwacz
      wrote on last edited by
      #2

      I don't have an answer for your question but maybe my python script could help You:
      https://github.com/mczerski/MySensorsSerial2MQTT

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Pavel Polititsky
        wrote on last edited by
        #3

        Lol. I just forgot to change the topic in my code from "MySensors" to "domoticz/out/MyMQTT"
        Now working fine

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        33

        Online

        11.7k

        Users

        11.2k

        Topics

        113.1k

        Posts


        Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • MySensors
        • OpenHardware.io
        • Categories
        • Recent
        • Tags
        • Popular