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. Controllers
  3. Node-RED
  4. myscontroller with ethernet gateway

myscontroller with ethernet gateway

Scheduled Pinned Locked Moved Node-RED
5 Posts 2 Posters 523 Views 2 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.
  • J Offline
    J Offline
    JohnDoe2991
    wrote on last edited by
    #1

    Hi everyone!

    I currently try to setup my first MySensors network.
    I have a sensor and an ethernet gateway sitting on a breadboard and I try to get the sensor data into my database with NodeRed.
    NodeRed is running in a docker container on my database server.
    But I am not able to get the NodeRed myscontroller to work.
    Here is my test flow:

    [
        {
            "id": "16a94524.a7f49b",
            "type": "tab",
            "label": "MySensors",
            "disabled": false,
            "info": ""
        },
        {
            "id": "5ee1d371.4bf144",
            "type": "myscontroller",
            "z": "16a94524.a7f49b",
            "database": "6211fee5.94057",
            "name": "",
            "handleid": true,
            "timeresponse": true,
            "timezone": "Europe/Berlin",
            "measurementsystem": "M",
            "mqttroot": "mys-out",
            "x": 870,
            "y": 180,
            "wires": [
                [
                    "8fd52d51.33df68",
                    "dfec2cf6.42e45"
                ]
            ]
        },
        {
            "id": "c9f3dd7.76aa4a",
            "type": "tcp in",
            "z": "16a94524.a7f49b",
            "name": "MySensors Gateway In",
            "server": "client",
            "host": "mysensors-gateway",
            "port": "5003",
            "datamode": "stream",
            "datatype": "utf8",
            "newline": "",
            "topic": "",
            "base64": false,
            "x": 280,
            "y": 180,
            "wires": [
                [
                    "dc2b7145.4ea57"
                ]
            ]
        },
        {
            "id": "dc2b7145.4ea57",
            "type": "mysdecode",
            "z": "16a94524.a7f49b",
            "database": "6211fee5.94057",
            "name": "decode",
            "mqtt": false,
            "enrich": true,
            "x": 460,
            "y": 180,
            "wires": [
                [
                    "5ee1d371.4bf144",
                    "d63bd8aa.d34ef8"
                ]
            ]
        },
        {
            "id": "9e6d49f6.34fef",
            "type": "tcp out",
            "z": "16a94524.a7f49b",
            "host": "mysensors-gateway",
            "port": "5003",
            "beserver": "reply",
            "base64": false,
            "end": false,
            "name": "MySensors Gateway Out",
            "x": 1490,
            "y": 180,
            "wires": []
        },
        {
            "id": "8fd52d51.33df68",
            "type": "mysencode",
            "z": "16a94524.a7f49b",
            "name": "encode",
            "mqtt": false,
            "mqtttopic": "",
            "x": 1260,
            "y": 180,
            "wires": [
                [
                    "9e6d49f6.34fef"
                ]
            ]
        },
        {
            "id": "d63bd8aa.d34ef8",
            "type": "mysdebug",
            "z": "16a94524.a7f49b",
            "name": "",
            "x": 670,
            "y": 300,
            "wires": [
                [
                    "4170e76.d577f98"
                ]
            ]
        },
        {
            "id": "4170e76.d577f98",
            "type": "debug",
            "z": "16a94524.a7f49b",
            "name": "request",
            "active": true,
            "tosidebar": true,
            "console": false,
            "tostatus": false,
            "complete": "payload",
            "targetType": "msg",
            "statusVal": "",
            "statusType": "auto",
            "x": 660,
            "y": 380,
            "wires": []
        },
        {
            "id": "dfec2cf6.42e45",
            "type": "mysdebug",
            "z": "16a94524.a7f49b",
            "name": "",
            "x": 1070,
            "y": 300,
            "wires": [
                [
                    "5653b23b.03664c"
                ]
            ]
        },
        {
            "id": "5653b23b.03664c",
            "type": "debug",
            "z": "16a94524.a7f49b",
            "name": "response",
            "active": true,
            "tosidebar": true,
            "console": false,
            "tostatus": false,
            "complete": "payload",
            "targetType": "msg",
            "statusVal": "",
            "statusType": "auto",
            "x": 1080,
            "y": 380,
            "wires": []
        },
        {
            "id": "6211fee5.94057",
            "type": "mysensorsdb",
            "name": "mysensorsnodedb",
            "file": "/data/mysensorsnode.db"
        }
    ]
    

    For me it looks like the controller receives messages from the gateway and response to them within the flow but the messages don't go to back to the gateway.

    I tested my setup with the MyController controller just to be sure my hardware works and everything worked instantly.

    I'm not very familiar with NodeRed so I guess I made some mistake. Can someone point me to the right direction?

    electrikE 1 Reply Last reply
    0
    • J JohnDoe2991

      Hi everyone!

      I currently try to setup my first MySensors network.
      I have a sensor and an ethernet gateway sitting on a breadboard and I try to get the sensor data into my database with NodeRed.
      NodeRed is running in a docker container on my database server.
      But I am not able to get the NodeRed myscontroller to work.
      Here is my test flow:

      [
          {
              "id": "16a94524.a7f49b",
              "type": "tab",
              "label": "MySensors",
              "disabled": false,
              "info": ""
          },
          {
              "id": "5ee1d371.4bf144",
              "type": "myscontroller",
              "z": "16a94524.a7f49b",
              "database": "6211fee5.94057",
              "name": "",
              "handleid": true,
              "timeresponse": true,
              "timezone": "Europe/Berlin",
              "measurementsystem": "M",
              "mqttroot": "mys-out",
              "x": 870,
              "y": 180,
              "wires": [
                  [
                      "8fd52d51.33df68",
                      "dfec2cf6.42e45"
                  ]
              ]
          },
          {
              "id": "c9f3dd7.76aa4a",
              "type": "tcp in",
              "z": "16a94524.a7f49b",
              "name": "MySensors Gateway In",
              "server": "client",
              "host": "mysensors-gateway",
              "port": "5003",
              "datamode": "stream",
              "datatype": "utf8",
              "newline": "",
              "topic": "",
              "base64": false,
              "x": 280,
              "y": 180,
              "wires": [
                  [
                      "dc2b7145.4ea57"
                  ]
              ]
          },
          {
              "id": "dc2b7145.4ea57",
              "type": "mysdecode",
              "z": "16a94524.a7f49b",
              "database": "6211fee5.94057",
              "name": "decode",
              "mqtt": false,
              "enrich": true,
              "x": 460,
              "y": 180,
              "wires": [
                  [
                      "5ee1d371.4bf144",
                      "d63bd8aa.d34ef8"
                  ]
              ]
          },
          {
              "id": "9e6d49f6.34fef",
              "type": "tcp out",
              "z": "16a94524.a7f49b",
              "host": "mysensors-gateway",
              "port": "5003",
              "beserver": "reply",
              "base64": false,
              "end": false,
              "name": "MySensors Gateway Out",
              "x": 1490,
              "y": 180,
              "wires": []
          },
          {
              "id": "8fd52d51.33df68",
              "type": "mysencode",
              "z": "16a94524.a7f49b",
              "name": "encode",
              "mqtt": false,
              "mqtttopic": "",
              "x": 1260,
              "y": 180,
              "wires": [
                  [
                      "9e6d49f6.34fef"
                  ]
              ]
          },
          {
              "id": "d63bd8aa.d34ef8",
              "type": "mysdebug",
              "z": "16a94524.a7f49b",
              "name": "",
              "x": 670,
              "y": 300,
              "wires": [
                  [
                      "4170e76.d577f98"
                  ]
              ]
          },
          {
              "id": "4170e76.d577f98",
              "type": "debug",
              "z": "16a94524.a7f49b",
              "name": "request",
              "active": true,
              "tosidebar": true,
              "console": false,
              "tostatus": false,
              "complete": "payload",
              "targetType": "msg",
              "statusVal": "",
              "statusType": "auto",
              "x": 660,
              "y": 380,
              "wires": []
          },
          {
              "id": "dfec2cf6.42e45",
              "type": "mysdebug",
              "z": "16a94524.a7f49b",
              "name": "",
              "x": 1070,
              "y": 300,
              "wires": [
                  [
                      "5653b23b.03664c"
                  ]
              ]
          },
          {
              "id": "5653b23b.03664c",
              "type": "debug",
              "z": "16a94524.a7f49b",
              "name": "response",
              "active": true,
              "tosidebar": true,
              "console": false,
              "tostatus": false,
              "complete": "payload",
              "targetType": "msg",
              "statusVal": "",
              "statusType": "auto",
              "x": 1080,
              "y": 380,
              "wires": []
          },
          {
              "id": "6211fee5.94057",
              "type": "mysensorsdb",
              "name": "mysensorsnodedb",
              "file": "/data/mysensorsnode.db"
          }
      ]
      

      For me it looks like the controller receives messages from the gateway and response to them within the flow but the messages don't go to back to the gateway.

      I tested my setup with the MyController controller just to be sure my hardware works and everything worked instantly.

      I'm not very familiar with NodeRed so I guess I made some mistake. Can someone point me to the right direction?

      electrikE Offline
      electrikE Offline
      electrik
      wrote on last edited by
      #2

      @JohnDoe2991
      I'm wondering if you have to decode before going to myscontroller

      So like this

      [
          {
              "id": "16a94524.a7f49b",
              "type": "tab",
              "label": "MySensors",
              "disabled": false,
              "info": ""
          },
          {
              "id": "5ee1d371.4bf144",
              "type": "myscontroller",
              "z": "16a94524.a7f49b",
              "database": "6211fee5.94057",
              "name": "",
              "handleid": true,
              "timeresponse": true,
              "timezone": "Europe/Berlin",
              "measurementsystem": "M",
              "mqttroot": "mys-out",
              "x": 870,
              "y": 180,
              "wires": [
                  [
                      "8fd52d51.33df68",
                      "dfec2cf6.42e45"
                  ]
              ]
          },
          {
              "id": "c9f3dd7.76aa4a",
              "type": "tcp in",
              "z": "16a94524.a7f49b",
              "name": "MySensors Gateway In",
              "server": "client",
              "host": "mysensors-gateway",
              "port": "5003",
              "datamode": "stream",
              "datatype": "utf8",
              "newline": "",
              "topic": "",
              "base64": false,
              "x": 280,
              "y": 180,
              "wires": [
                  [
                      "dc2b7145.4ea57"
                  ]
              ]
          },
          {
              "id": "dc2b7145.4ea57",
              "type": "mysdecode",
              "z": "16a94524.a7f49b",
              "database": "6211fee5.94057",
              "name": "decode",
              "mqtt": false,
              "enrich": true,
              "x": 460,
              "y": 180,
              "wires": [
                  [
                      "5ee1d371.4bf144",
                      "d63bd8aa.d34ef8"
                  ]
              ]
          },
          {
              "id": "9e6d49f6.34fef",
              "type": "tcp out",
              "z": "16a94524.a7f49b",
              "host": "mysensors-gateway",
              "port": "5003",
              "beserver": "reply",
              "base64": false,
              "end": false,
              "name": "MySensors Gateway Out",
              "x": 1490,
              "y": 180,
              "wires": []
          },
          {
              "id": "8fd52d51.33df68",
              "type": "mysencode",
              "z": "16a94524.a7f49b",
              "name": "encode",
              "mqtt": false,
              "mqtttopic": "",
              "x": 1260,
              "y": 180,
              "wires": [
                  [
                      "9e6d49f6.34fef"
                  ]
              ]
          },
          {
              "id": "d63bd8aa.d34ef8",
              "type": "mysdebug",
              "z": "16a94524.a7f49b",
              "name": "",
              "x": 670,
              "y": 300,
              "wires": [
                  [
                      "4170e76.d577f98"
                  ]
              ]
          },
          {
              "id": "4170e76.d577f98",
              "type": "debug",
              "z": "16a94524.a7f49b",
              "name": "request",
              "active": true,
              "tosidebar": true,
              "console": false,
              "tostatus": false,
              "complete": "payload",
              "targetType": "msg",
              "statusVal": "",
              "statusType": "auto",
              "x": 660,
              "y": 380,
              "wires": []
          },
          {
              "id": "dfec2cf6.42e45",
              "type": "mysdebug",
              "z": "16a94524.a7f49b",
              "name": "",
              "x": 1070,
              "y": 300,
              "wires": [
                  [
                      "5653b23b.03664c"
                  ]
              ]
          },
          {
              "id": "5653b23b.03664c",
              "type": "debug",
              "z": "16a94524.a7f49b",
              "name": "response",
              "active": true,
              "tosidebar": true,
              "console": false,
              "tostatus": false,
              "complete": "payload",
              "targetType": "msg",
              "statusVal": "",
              "statusType": "auto",
              "x": 1080,
              "y": 380,
              "wires": []
          },
          {
              "id": "6211fee5.94057",
              "type": "mysensorsdb",
              "name": "mysensorsnodedb",
              "file": "/data/mysensorsnode.db"
          }
      ]
      
      1 Reply Last reply
      0
      • J Offline
        J Offline
        JohnDoe2991
        wrote on last edited by
        #3

        @electrik
        Thanks for the reply, I think I've figured it out now:
        If i connect the myscontroller directly with the TCP connections, it won't send any messages. More importantly it looks like the whole gateway stops working correctly then. I don't receive any messages from the TCP connection.
        I have to add an decode and encode on each side of the myscontroller and restart the gateway so it will work properly.

        I guess when I tried my first flow yesterday I connected the myscontroller directly to the TCP connections and crashed my gateway this way. I didn't noticed that and thats why my second flow with the decode and encode didn't work either.

        So, all in all, it was just a "Have you tried turning it off and on again?" problem.

        1 Reply Last reply
        0
        • electrikE Offline
          electrikE Offline
          electrik
          wrote on last edited by
          #4

          Good to hear you solved it!

          1 Reply Last reply
          0
          • J Offline
            J Offline
            JohnDoe2991
            wrote on last edited by
            #5

            Well, I'm back again, because it broke again ... and I fixed it somehow again.
            I was playing around with my sensor to get it up and running the way I want it to and resetted its node id.
            It couldn't get a new node ID and I was back where I was yesterday.
            Deleted everything, rebuild the complete flow, restarted everything. Nothing helped. So I added debug messages everywhere and also had a look into the raw Serial protocol here: https://www.mysensors.org/download/serial_api_20
            It looks like you don't need the encode and decode, at least for me the encode after myscontroller totally destroyed the payload. Why did it work yesterday? I have no idea.
            The payload looked fine now without the decode and encode according to the protocol, but it still didn't work. I noticed that the incoming TCP payload always ended with a linefeed "\n", so I added a custom function between the myscontroller and tcp output to also add a linefeed to the outgoing payload and it's working again.

            1 Reply Last reply
            0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            18

            Online

            12.0k

            Users

            11.2k

            Topics

            113.4k

            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