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 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
    // Enable inclusion mode
    // Enable Inclusion mode button on gateway
    // Inverses behavior of inclusion button (if using external pullup)
    // Set inclusion mode duration (in seconds)
    // Digital pin used for inclusion mode button
    // Set blinking period
    // Inverses the behavior of leds
    // 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=1

    Another question that I couldn't find in docs is how can I set hardcode the node ID?

  • Mod

    @alfredocdmiranda the id of a gateway is always 0, it can not be changed.

  • About the Gateway ID it is fine. My main problem is that it seems presentation function is not being run.

  • Admin

    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)?

  • Mod

  • @mfalkvidd
    Oh, okay! Thanks. I haven't seen this code!

    Really thanks for your help, guys 🙂

  • Mod

    @alfredocdmiranda you're wlecome. We're happy to be of assistance.

Log in to reply





Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.