Serial Gateway with Sensors
-
Hi guys,
Sorry if there is already a topic with this, however I couldn't find any helpful information.
There is a long time since last time I have "played" with MySensors.
Then, I am trying to run a Serial Gateway with a relay attached. However, it seems that it is not calling the presentation() function.
My code:
// Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached //#define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // Set LOW transmit power level as default, if you have an amplified NRF-module and // power your radio separately with a good regulator you can turn up PA level. //#define MY_RF24_PA_LEVEL RF24_PA_LOW // Enable serial gateway #define MY_GATEWAY_SERIAL // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender) #if F_CPU == 8000000L #define MY_BAUD_RATE 38400 #endif // Enable inclusion mode #define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway //#define MY_INCLUSION_BUTTON_FEATURE // Inverses behavior of inclusion button (if using external pullup) //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP // 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 // Set blinking period #define MY_DEFAULT_LED_BLINK_PERIOD 300 // Inverses the behavior of leds //#define MY_WITH_LEDS_BLINKING_INVERSE // Flash leds on rx/tx/err // Uncomment to override default HW configurations //#define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin //#define MY_DEFAULT_RX_LED_PIN 6 // Receive led pin //#define MY_DEFAULT_TX_LED_PIN 5 // the PCB, on board LED #include <MySensors.h> #define CHILD_ID 1 void setup() { // Setup locally attached sensors } void presentation() { sendSketchInfo("Relay", "1.0"); present(CHILD_ID, S_LIGHT); } void loop() { // Send locally attached sensor data here }My output:
0;255;3;0;9;Starting gateway (R-NGA-, 2.0.0) 0;255;3;0;14;Gateway startup complete. 0;255;3;0;9;No registration required 0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1Another question that I couldn't find in docs is how can I set hardcode the node ID?
-
Hi guys,
Sorry if there is already a topic with this, however I couldn't find any helpful information.
There is a long time since last time I have "played" with MySensors.
Then, I am trying to run a Serial Gateway with a relay attached. However, it seems that it is not calling the presentation() function.
My code:
// Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached //#define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // Set LOW transmit power level as default, if you have an amplified NRF-module and // power your radio separately with a good regulator you can turn up PA level. //#define MY_RF24_PA_LEVEL RF24_PA_LOW // Enable serial gateway #define MY_GATEWAY_SERIAL // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender) #if F_CPU == 8000000L #define MY_BAUD_RATE 38400 #endif // Enable inclusion mode #define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway //#define MY_INCLUSION_BUTTON_FEATURE // Inverses behavior of inclusion button (if using external pullup) //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP // 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 // Set blinking period #define MY_DEFAULT_LED_BLINK_PERIOD 300 // Inverses the behavior of leds //#define MY_WITH_LEDS_BLINKING_INVERSE // Flash leds on rx/tx/err // Uncomment to override default HW configurations //#define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin //#define MY_DEFAULT_RX_LED_PIN 6 // Receive led pin //#define MY_DEFAULT_TX_LED_PIN 5 // the PCB, on board LED #include <MySensors.h> #define CHILD_ID 1 void setup() { // Setup locally attached sensors } void presentation() { sendSketchInfo("Relay", "1.0"); present(CHILD_ID, S_LIGHT); } void loop() { // Send locally attached sensor data here }My output:
0;255;3;0;9;Starting gateway (R-NGA-, 2.0.0) 0;255;3;0;14;Gateway startup complete. 0;255;3;0;9;No registration required 0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1Another question that I couldn't find in docs is how can I set hardcode the node ID?
-
About the Gateway ID it is fine. My main problem is that it seems presentation function is not being run.
-
Please use the development branch. There was a bug fixed related to presentations of gateway attached sensors.
@hek Thanks! Now it worked :)
Hey, and can you answer me about how to set hardcode ID in some other node(not gateway)?
-
@hek Thanks! Now it worked :)
Hey, and can you answer me about how to set hardcode ID in some other node(not gateway)?
@alfredocdmiranda #define MY_NODE_ID
See https://www.mysensors.org/download/sensor_api_20 for details -
@alfredocdmiranda #define MY_NODE_ID
See https://www.mysensors.org/download/sensor_api_20 for details@mfalkvidd
Oh, okay! Thanks. I haven't seen this code!Really thanks for your help, guys :)
-
@mfalkvidd
Oh, okay! Thanks. I haven't seen this code!Really thanks for your help, guys :)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login