Repeater Node Question
-
Hi,
I would like to add a repeater Node to my Network and I would like to know a few things:
MY_PARENT_ID for the repeater node is the gateways ID, right? So which MY_PARENT_ID will the repeated Nodes have? The ID of the Repeater Node?
Does someone have an example sketch of a repeater node for me?
Thanks in advance!
-
@siod yes, your assumptions are correct.
There is no example sketch for a repeater node because it only needs to contain a single define. You can add this define to any sketch. If the node uses sleep you will need to change sleep to wait, so the node stays awake. See https://www.mysensors.org/download/sensor_api_20#create-repeating-nodes for details.
-
@mfalkvidd great, thanks for your quick and short answer!
-
one more question: that´s what I have so far, is this all? I think I´ve read somewehere that there must be a special command included and I also read this:
// Repeater Node1, Repeater Nodes starten bei ID 50 #define MY_RADIO_NRF24 //MySensor Library auf NRF24 Funkmodul einstellen, muss vor MySensor.h Initialisierung geschehen // Define Node ID #define MY_NODE_ID 50 #define MY_PARENT_NODE_ID 0 #define MY_PARENT_NODE_IS_STATIC #define MY_REPEATER_FEATURE #include <MySensors.h> #include <SPI.h> //Messages //Presentation; present sensors to gateway! void presentation(){ // Send the sketch version information to the gateway and Controller sendSketchInfo("Repeater Node 1", "1.0"); wait(500); } //Setup void setup() { } //Starte den Loop void loop() { }
*Handling incoming radio messages
Nodes that expects incoming data, such as an actuator or repeating nodes, must implement the receive()-function to handle the incoming messages. Do not sleep a node where you expect incoming data or you will lose messages.void receive(const MyMessage &message)
message - The incoming message data*where do I have to add this?
-
@siod What you have above is all you need for a repeater node. if you also have sensors/actuators on this node that are expecting to receive data then you will need to add the receive function. have a look at the RelayActuator example to see how it looks.
the lines below are not mandatory for a repeater either but of course you can use them if needed
#define MY_NODE_ID 50 #define MY_PARENT_NODE_ID 0 #define MY_PARENT_NODE_IS_STATIC
-
ok, thanks for clarifying this!