No controller, no gateway | passive node
-
1
bool state = true; #define MY_DEBUG #define MY_RADIO_NRF24 #define MY_NODE_ID 101 #define MY_PASSIVE_NODE #include <MySensors.h> #define BUTTON 1 MyMessage msg(BUTTON,V_STATUS); void presentation() { present(BUTTON, S_BINARY); sendSketchInfo("TEST BUTTON", "1.1"); } void setup() { Serial.begin(115200); } void loop() { Serial.println(" SEND HELLO "); send(msg.setDestination(100).setSensor(1).set(state)); delay(5000); } void receive(const MyMessage &message) { if (message.type == V_STATUS) { Serial.println("Hello is delivered"); } }
2
bool state = true; #define MY_DEBUG #define MY_RADIO_NRF24 #define MY_NODE_ID 100 #define MY_PASSIVE_NODE #include <MySensors.h> #define RELAY 1 MyMessage msg(RELAY,V_STATUS); void presentation() { present(RELAY, S_BINARY); sendSketchInfo("TEST RELAY", "1.1"); } void setup() { Serial.begin(115200); } void loop() { Serial.println(" SEND HELLO "); send(msg.setDestination(101).setSensor(1).set(state)); delay(5000); } void receive(const MyMessage &message) { if (message.type == V_STATUS) { Serial.println("Hello is delivered"); } }
-
So are you basically sending a message from one node to the other without gateway, right?
-
Yes, You are right. This is a simple example of sending and receiving messages between two nodes without the participation of the gateway.
-
It is one way communication only? Like a garage door/gate 433mhz remote
-
@gohan You can send and receive messages in both directions. It all depends on how it will be implemented in the sketch. You can use more than two nodes. I would use it in case of a gateway failure. This will preserve the basic functionality of the device. For example, a light switch that is physically divided into two nodes. On one node, the touch panel on the other relay node controls the light. There can be a lot of use cases.
-
Could you please post the code for everyone?
-
@gohan Of course, everything is simple there, uses one public function.
-
I know it is just to keep a reference here on the forum and for others less expert in programming that would like to see the actual code
-
@gohan said in no controller, no gateway:
I know it is just to keep a reference here on the forum and for others less expert in programming that would like to see the actual code
ready, in the first post
-
you didn't put the "MY_PARENT_NO_ID 100" that I saw in the video: is it ok?
-
@gohan said in no controller, no gateway:
you didn't put the "MY_PARENT_NO_ID 100" that I saw in the video: is it ok?
yes this is normal, this def is not needed. just forgot to delete when recording a video
two-way sending is done in the above application, this is also not in the video. you just asked about it earlier.