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:
- set message type ex. V_LIGHT is 2. Look at API for more
- Set sensor child ID of the sensor you want to change status of
- This is the destination node ID which has the sensor you are trying to reach
- Send the message just like you would usually.
Hope this helps someone
2 out of 2
Suggested Topics
-
Day 1 - Status report
Announcements • 23 Mar 2014, 22:45 • hek 24 Mar 2014, 20:12 -
Getting system time from the controller
Troubleshooting • 27 Feb 2025, 01:39 • dpcons 3 Mar 2025, 01:00 -
Can not compile MySensors on esp8266
Troubleshooting • 24 Aug 2024, 15:35 • TheoL 29 Aug 2024, 20:47 -
NODs stop responding, but ping works.
Troubleshooting • 8 Mar 2025, 19:47 • Marcin 8 Mar 2025, 19:47 -
Compiling Sensor code using BME280 and ESP8266
Troubleshooting • 26 Feb 2025, 00:32 • dpcons 26 Feb 2025, 06:22 -
JSN-SR04T-V3.0 Coax cable extended
Troubleshooting • 26 days ago • bocalexandru 24 days ago