Use another node than gateway for control



  • Hi all,

    In a MySensors network a controller is connected with a gateway to read messages from sensor nodes and send messages to actuators.

    In my MySensors network I use a serial gateway mainly for reading the messages and for the sake of simplicity I would like to keep it that way. (I use a labview application for logging purposes).

    As my network grows I want to add some actuators, but I do not want to control them via the gateway as described before.

    Would it be possible to send the control-messages around using another node than the gateway using serial communication? Or in other words: would it be possible to send messages in a similar way as would be done via the gateway but now using a dedicated node for that?

    I read through the forum but could not find a real answer unfortunately

    Best regards,

    Boozz


  • Mod

    @boozz messages can be addressed to any node. It is done like this:

    message.setDestination(DESTINATION_NODE_ID);
    

    For a practical example, see https://www.openhardware.io/view/53#tabs-source

    Messages will still be routed through the gateway though.



  • @mfalkvidd

    hey thanks!

    I didn't think of using message.destination... I used it in the past to have 2 nodes talking to each other. Now I need some code to get serial input translated to messages.

    I think I know where I can find such code for that.

    If that idea works I'll post the sketch.

    Boozz


  • Mod

    @boozz Cool. What are you getting the serial input from? Is your actuator connected to serial?



  • @mfalkvidd
    Serial input will come from a windows based PC. Probably the same as the one that acts as the datalogger.
    The actuator could be any actuator-node.

    To give you some more info:
    I have some lights in my shed (mancave actually....🤣 ) that should turn on when pressing a button, somewhere nearby, i.e. near the door. This button is connected to a node that sends the command to the actuator node. setdestination will play a role in this node.
    There's also an automation scheme to turn on (and more important: off) the lights. As the shed is quite far away it is very handy to turn off the lights when I have returned to my home and forgotten to turn of the lights (for whatever reason). For this purpose I will use this specific node. Once I manage to controll the lights in the shed, I will be able to controll some more things around.


Log in to reply
 

Suggested Topics

  • 4
  • 15
  • 20
  • 2
  • 9
  • 9

64
Online

11.4k
Users

11.1k
Topics

112.7k
Posts