Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. question about repeater node

question about repeater node

Scheduled Pinned Locked Moved Development
10 Posts 4 Posters 4.2k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Reza
    wrote on last edited by Reza
    #1

    hi guys
    i have one question
    if i want all of my nodes be also a repeater node , so i just add this line to all of sensors?
    #define MY_REPEATER_FEATURE

    or also add this : ( for example motion sensor)
    sendSketchInfo("Motion Sensor", "1.0");
    sendSketchInfo("Repeater Node", "1.0");
    ???

    mfalkviddM 1 Reply Last reply
    0
    • R Reza

      hi guys
      i have one question
      if i want all of my nodes be also a repeater node , so i just add this line to all of sensors?
      #define MY_REPEATER_FEATURE

      or also add this : ( for example motion sensor)
      sendSketchInfo("Motion Sensor", "1.0");
      sendSketchInfo("Repeater Node", "1.0");
      ???

      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by mfalkvidd
      #2

      @Reza the sketch info is just a human-friendly name. It does not affect the functionality. So you can put anything you like there.

      R 1 Reply Last reply
      1
      • mfalkviddM mfalkvidd

        @Reza the sketch info is just a human-friendly name. It does not affect the functionality. So you can put anything you like there.

        R Offline
        R Offline
        Reza
        wrote on last edited by
        #3

        @Reza said:

        #define MY_REPEATER_FEATURE

        hi my friend you speak about this line ?
        sendSketchInfo("Repeater Node", "1.0");
        can I delete it from sketch ?
        so for convert each sensors and each relay actor to repeater +sensor just enough add this line ?
        #define MY_REPEATER_FEATURE
        ???

        mfalkviddM 1 Reply Last reply
        0
        • R Reza

          @Reza said:

          #define MY_REPEATER_FEATURE

          hi my friend you speak about this line ?
          sendSketchInfo("Repeater Node", "1.0");
          can I delete it from sketch ?
          so for convert each sensors and each relay actor to repeater +sensor just enough add this line ?
          #define MY_REPEATER_FEATURE
          ???

          mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by
          #4

          I don't know.

          1 Reply Last reply
          0
          • tlpeterT Offline
            tlpeterT Offline
            tlpeter
            wrote on last edited by
            #5

            yes add the line but only on non battery powered nodes.
            If battery powered this will kill battery life.
            I have a couple repeater nodes at home to extend the range.

            R 1 Reply Last reply
            1
            • tlpeterT tlpeter

              yes add the line but only on non battery powered nodes.
              If battery powered this will kill battery life.
              I have a couple repeater nodes at home to extend the range.

              R Offline
              R Offline
              Reza
              wrote on last edited by
              #6

              @tlpeter
              hi my friend .thank you
              all of my node are non battery powered and no problem. but just my question about codes.
              just i add this line ? (#define MY_REPEATER_FEATURE) and dont need any change in sketch?for example delete this line :
              sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); ???

              sundberg84S 1 Reply Last reply
              0
              • R Reza

                @tlpeter
                hi my friend .thank you
                all of my node are non battery powered and no problem. but just my question about codes.
                just i add this line ? (#define MY_REPEATER_FEATURE) and dont need any change in sketch?for example delete this line :
                sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); ???

                sundberg84S Offline
                sundberg84S Offline
                sundberg84
                Hardware Contributor
                wrote on last edited by
                #7

                @Reza - it depends on what you want to do, and in which sketch.
                Maybe you should post your sketch and explain what you are planning to do.

                Generally you just add #define MY_REPEATER_FEATURE to make it a repeater node and as you said, remove the sleep() function.

                Controller: Proxmox VM - Home Assistant
                MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
                MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
                RFLink GW - Arduino Mega + RFLink Shield, 433mhz

                R 1 Reply Last reply
                1
                • sundberg84S sundberg84

                  @Reza - it depends on what you want to do, and in which sketch.
                  Maybe you should post your sketch and explain what you are planning to do.

                  Generally you just add #define MY_REPEATER_FEATURE to make it a repeater node and as you said, remove the sleep() function.

                  R Offline
                  R Offline
                  Reza
                  wrote on last edited by sundberg84
                  #8

                  @sundberg84 said:

                  it depends on what you want to do, and in which sketch.
                  Maybe you should post your sketch and explain what you are planning to do.

                  Generally you just add #define MY_REPEATER_FEATURE to make it a repeater node and as you said, remove the sleep() function.

                  
                  for example:
                  #define MY_RADIO_NRF24
                  //#define MY_RADIO_RFM69
                  
                  #include <SPI.h>
                  #include <MySensors.h>
                  
                  unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
                  #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
                  #define CHILD_ID 1   // Id of the sensor child
                  
                  // Initialize motion message
                  MyMessage msg(CHILD_ID, V_TRIPPED);
                  
                  void setup()  
                  {  
                    pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
                  }
                  
                  void presentation()  {
                    // Send the sketch version information to the gateway and Controller
                    sendSketchInfo("Motion Sensor", "1.0");
                  
                    // Register all sensors to gw (they will be created as child devices)
                    present(CHILD_ID, S_MOTION);
                  }
                  
                  void loop()     
                  {     
                    // Read digital motion value
                    boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
                          
                    Serial.println(tripped);
                    send(msg.set(tripped?"1":"0"));  // Send tripped value to gw 
                  
                    // Sleep until interrupt comes in on motion sensor. Send update every two minute.
                   ** sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);**
                  }
                  
                  sundberg84S 1 Reply Last reply
                  0
                  • R Reza

                    @sundberg84 said:

                    it depends on what you want to do, and in which sketch.
                    Maybe you should post your sketch and explain what you are planning to do.

                    Generally you just add #define MY_REPEATER_FEATURE to make it a repeater node and as you said, remove the sleep() function.

                    
                    for example:
                    #define MY_RADIO_NRF24
                    //#define MY_RADIO_RFM69
                    
                    #include <SPI.h>
                    #include <MySensors.h>
                    
                    unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
                    #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
                    #define CHILD_ID 1   // Id of the sensor child
                    
                    // Initialize motion message
                    MyMessage msg(CHILD_ID, V_TRIPPED);
                    
                    void setup()  
                    {  
                      pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
                    }
                    
                    void presentation()  {
                      // Send the sketch version information to the gateway and Controller
                      sendSketchInfo("Motion Sensor", "1.0");
                    
                      // Register all sensors to gw (they will be created as child devices)
                      present(CHILD_ID, S_MOTION);
                    }
                    
                    void loop()     
                    {     
                      // Read digital motion value
                      boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
                            
                      Serial.println(tripped);
                      send(msg.set(tripped?"1":"0"));  // Send tripped value to gw 
                    
                      // Sleep until interrupt comes in on motion sensor. Send update every two minute.
                     ** sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);**
                    }
                    
                    sundberg84S Offline
                    sundberg84S Offline
                    sundberg84
                    Hardware Contributor
                    wrote on last edited by sundberg84
                    #9

                    @Reza - I added ``` so your code is easier to read.

                    Remove: unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
                    Remove: ** sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);**
                    Add: #define MY_REPEATER_FEATURE below #define MY_RADIO_NRF24

                    You also might want to add send() with a If statement so it doesnt sent all the time. The example code is build on a interupt.

                    For example:

                    void loop()     
                    {
                         
                    //Read digital motion value
                    tripped = digitalRead(DIGITAL_INPUT_SENSOR);
                    
                    if (tripped != oldTripped){
                      Serial.println("Motion");
                      send(msg.set(tripped?"1":"0"));  // Send tripped value to gw
                      oldTripped = tripped;
                    }}
                    

                    I have one example at github: https://github.com/sundberg84/MySensors-2.0/blob/master/MotionRep/MotionRepAS.ino

                    Controller: Proxmox VM - Home Assistant
                    MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
                    MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
                    RFLink GW - Arduino Mega + RFLink Shield, 433mhz

                    R 1 Reply Last reply
                    1
                    • sundberg84S sundberg84

                      @Reza - I added ``` so your code is easier to read.

                      Remove: unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
                      Remove: ** sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);**
                      Add: #define MY_REPEATER_FEATURE below #define MY_RADIO_NRF24

                      You also might want to add send() with a If statement so it doesnt sent all the time. The example code is build on a interupt.

                      For example:

                      void loop()     
                      {
                           
                      //Read digital motion value
                      tripped = digitalRead(DIGITAL_INPUT_SENSOR);
                      
                      if (tripped != oldTripped){
                        Serial.println("Motion");
                        send(msg.set(tripped?"1":"0"));  // Send tripped value to gw
                        oldTripped = tripped;
                      }}
                      

                      I have one example at github: https://github.com/sundberg84/MySensors-2.0/blob/master/MotionRep/MotionRepAS.ino

                      R Offline
                      R Offline
                      Reza
                      wrote on last edited by
                      #10

                      @sundberg84
                      thank you my friend <3

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      30

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular