How to send message from one sensor to other or send message with different node and sensor ID?



  • Hello all,

    I have pH sensor on node ID 1 and valve that controls pH on node ID 2. Now when the pH level falls below some value I want to open the valve. How can I send message from one node to other to open the valve

    OR

    How can I send message to domoticz from node ID 1 to open the valve on node ID 2?

    Thank You,
    Vaibhav



  • Got it after some trial and error with getters and setters.

    In case someone needs. I did following.

    MyMessage msg();  //Create a blank MyMessage instance. Do this before void setup()
    

    then when you want to send the message. Create a message on the fly like following.

    1. msg.setType(2);
    2. msg.setSensor(1);
    3. msg.setDestination(2);
    4. send(msg.set(1));
    

    This is what I am doing above:

    1. set message type ex. V_LIGHT is 2. Look at API for more
    2. Set sensor child ID of the sensor you want to change status of
    3. This is the destination node ID which has the sensor you are trying to reach
    4. Send the message just like you would usually.

    Hope this helps someone


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.