How to assign static node ID?
-
Gday,
I have the MQTT Client gateway running and the existing nodes are ok however a new motion sensor node I just built does not seem to be working.
Could someone let me know how you set a static node ID.
Regards,
George
-
gw.begin(NULL, 5) sets the node id to 5
-
Ok thanks for that.
Where should I put that code in the sketch?
Cheers,
-
Replace your current gw.begin
-
I am looking at the development version of the MotionSensor sketch and can not seem to find a gw.begin
Regards,
George
-
Use #define MY_NODE_ID 10 (where 10 is your ID).
Example: https://github.com/mysensors/Arduino/blob/7ee39509ebaf05900db0f4cf6af8eaad2b970d30/libraries/MySensors/examples/OregonSensorDecode/OregonSensorDecode.ino
-
@sundberg84 Fantastic thanks for that it worked perfectly.
Cheers,
George
-
Here are the defines I put in my sketches for the development library:
//#define MY_NODE_ID 1 //#define MY_PARENT_ID 0 // Possible values for Arduino IDE: 9600, 19200, 38400, 57600, 74880, 115200, 230400, 250000 // The last three values are only possible if the mcu works at 16Mhz or more, not possible for 8MHz operation. //#define MY_BAUD_RATE 57600 //#define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // Enable serial gateway //#define MY_GATEWAY_SERIAL // Enabled repeater feature for this node //#define MY_REPEATER_FEATURE // Flash leds on rx/tx/err //#define MY_LEDS_BLINKING_FEATURE // Set blinking period //#define MY_DEFAULT_LED_BLINK_PERIOD 300 // Enable inclusion mode //#define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway //#define MY_INCLUSION_BUTTON_FEATURE // Set inclusion mode duration (in seconds) //#define MY_INCLUSION_MODE_DURATION 60 // Digital pin used for inclusion mode button //#define MY_INCLUSION_MODE_BUTTON_PIN 3 //#define MY_DEFAULT_ERR_LED_PIN 5 // Error led pin //#define MY_DEFAULT_RX_LED_PIN 6 // Receive led pin //#define MY_DEFAULT_TX_LED_PIN 7 // the PCB, on board LED // possible values: RF24_PA_LOW (is default on gateway), RF24_PA_MED, RF24_PA_HIGH, RF24_PA_MAX (is default on nodes) //#define MY_RF24_PA_LEVEL RF24_PA_HIGH // RF channel for the sensor net, 0-127. Channel 76 is the default in all library examples //#define MY_RF24_CHANNEL 76 //RF24_250KBPS for 250kbs (default), RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps //#define MY_RF24_DATARATE RF24_250KBPS