Can a Node subscribe to messages from another node?



  • Hello,

    i want to make a MySensors Network which handles simple tasks without an controller (but with an gateway).

    I have a node with a button-sensor and a node with an lightactuator.
    If i want to switch on the light with the button i can send a MyMessage direct to the node with the lightsenor.

    But is it also possible for the node with the lightactuator to "subscribe" to the buttonnode?
    The buttonnode sends (if not specified else) its message to the gatewaynode.
    Technically also the lightnode see´s this message and should be able to react.
    (I know if there are repeaternodes involved it´s not that simple - but we can ignore this)

    Is it possible to implement this idea with MySensors?
    Kind regards
    pcs



  • @pcs In general, using MySensors without controller isn't recommended. Achieving your goal may be possible (you will at least make sure the nodes have the relevant routing and their ID's already set by your sketches).

    Sending data directly to other nodes is also possible, please look for node to node communication, then you will find some few examples to follow.



  • i know that a controller is necessary and i have one running. So ID assignment und routing is working.
    As i wrote I know that one node can send a message to another node and that is working so far.
    I´m just interessted if it is possible for a node to listen for changes on another node.
    Like the subscription-principle MQTT uses.



  • @pcs

    @rejoe2 said in Can a Node subscribe to messages from another node?:

    Sending data directly to other nodes is also possible, please look for node to node communication, then you will find some few examples to follow.

    It's not subscribing but active sending from node to node:

    send(msgXXX.setDestination(target node)...)
    

 

384
Online

7.6k
Users

8.5k
Topics

91.3k
Posts