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. General Discussion
  3. Possibility of Intercepting Serial Messages in Gateway for own Message Handling?

Possibility of Intercepting Serial Messages in Gateway for own Message Handling?

Scheduled Pinned Locked Moved General Discussion
7 Posts 3 Posters 1.7k Views 5 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.
  • M Offline
    M Offline
    Mathea90
    wrote on last edited by Mathea90
    #1

    Hello guys,

    I built myself a gateway on 1.5.4 which also did a lot of other functions. E.g. controlling locally connected lights and a ventilation controller.

    To achieve this I intercepted the serial messages from the controller in my gateway Arduino and handled them by myself. To have a logic order I gave every different attached "device" an own Node ID. This means that I have basically three additional devices which show up in my controller as if they were independent Arduinos connected to the MySensors network via radio link, but actually those were just functions locally wired to my gateway. I like it this way because everything is logically separated and not cluttered in my controller.

    Now my Problem: I want to migrate my gateway to the 2.0 MySensors version but the programming is vastly different. For the serial handling I previously directly used the "void SerialEvent()" function and checked if the Node ID of a received serial command matches my "locally attached" Node IDs and handled them myself in this case. MySensors 2.0 doesn't have this function anymore.

    Do I have some different way of directly intercepting the Serial messages sent from my Controller to my Gateway?

    Thanks a lot in advance for your help!
    Martin

    1 Reply Last reply
    0
    • hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by
      #2

      Messages sent to the gateway will end up in the receive()-function (if you add it to the gateway sketch). Just like any other node.

      1 Reply Last reply
      1
      • M Offline
        M Offline
        Mathea90
        wrote on last edited by
        #3

        So if I understand this correctly, I can just check for "if (message.destination == my custom node id)" in the receive() - function of my gateway?

        This would be really awesome.

        1 Reply Last reply
        0
        • hekH Offline
          hekH Offline
          hek
          Admin
          wrote on last edited by
          #4

          Messages for other nodes will not be directed to receive() in he gateway. You have to send the to nodeId=0 from the controller. To distinguish them use childId instead.

          1 Reply Last reply
          1
          • M Offline
            M Offline
            Mathea90
            wrote on last edited by
            #5

            Hm that's a pity. This functionality is specifically what I'm looking for because I want my gateway to function as three different devices with own Node IDs so that those different functionalities show up in my controller as separate devices.

            TheoLT 1 Reply Last reply
            0
            • M Mathea90

              Hm that's a pity. This functionality is specifically what I'm looking for because I want my gateway to function as three different devices with own Node IDs so that those different functionalities show up in my controller as separate devices.

              TheoLT Offline
              TheoLT Offline
              TheoL
              Contest Winner
              wrote on last edited by
              #6

              @Mathea90 I don't advice to put logic like this in the gateway. If you're controller is running on linux it's easy to write a proxy application between the gateway and your controller and let do the transformation of child id's to unique node id's.

              That would save you a lot of trouble whenever a new MySensor's version will be released.

              But in my opinion logic like this should be handled in the controller not on the gateway side.

              M 1 Reply Last reply
              1
              • TheoLT TheoL

                @Mathea90 I don't advice to put logic like this in the gateway. If you're controller is running on linux it's easy to write a proxy application between the gateway and your controller and let do the transformation of child id's to unique node id's.

                That would save you a lot of trouble whenever a new MySensor's version will be released.

                But in my opinion logic like this should be handled in the controller not on the gateway side.

                M Offline
                M Offline
                Mathea90
                wrote on last edited by
                #7

                @TheoL Hm yeah I guess that makes sense. The point with the future updates is a good one and I think I will now try to alter the structure in my controller to fit my needs.

                Thanks for the input!

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


                13

                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