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. General Discussion
  3. Relay and Repeater - Just learning stuff

Relay and Repeater - Just learning stuff

Scheduled Pinned Locked Moved General Discussion
4 Posts 4 Posters 4.4k Views 2 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.
  • P Offline
    P Offline
    punter9
    wrote on last edited by
    #1

    So I have several nodes going in the house. I love mysensors and really appreciate all who have made this possible.

    Today I am looking into repeaters and learning how to make my custom multi sensor nodes into repeaters. Specifically any with a relay since they process incoming messages. From what I can tell they already are. Could someone fact check me to make sure I am thinking about this correctly?

    1.) To make a repeater node you first off cannot have any sort of sleep function

    2.) You need this code to enable repeater mode, specifically I think you only need the true part.

    gw.begin(NULL, AUTO, true);
    

    this would also work i am thinking

    gw.begin(incomingMessage, AUTO, true);
    

    3.) This is what makes a repeater do repeater things.

    gw.process();
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      sundberg84
      Hardware Contributor
      wrote on last edited by
      #2

      Hi!

      Not the expert, but I think you are on the right track.
      The gw.begin(incomingMessage, AUTO, true); is only needed if you have a senser expecting incoming messages.
      If its only a repeater you can use the first one.

      Br

      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

      1 Reply Last reply
      0
      • T Offline
        T Offline
        TheoL
        Contest Winner
        wrote on last edited by TheoL
        #3

        I have never worked with the repeater but I just hacked an example for you. I'm not able to test it and I don't know if this will effect the performance of the repeater. But at least it compiles.

        For test purposes it might be better to hook an led with a 220 ohm resistor to the relay_pin.

        /**
         * The MySensors Arduino library handles the wireless radio link and protocol
         * between your home built sensors/actuators and HA controller of choice.
         * The sensors forms a self healing radio network with optional repeaters. Each
         * repeater and gateway builds a routing tables in EEPROM which keeps track of the
         * network topology allowing messages to be routed to nodes.
         *
         * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
         * Copyright (C) 2013-2015 Sensnology AB
         * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
         *
         * Documentation: http://www.mysensors.org
         * Support Forum: http://forum.mysensors.org
         *
         * This program is free software; you can redistribute it and/or
         * modify it under the terms of the GNU General Public License
         * version 2 as published by the Free Software Foundation.
         *
         *******************************
         *
         * REVISION HISTORY
         * Version 1.0 - Henrik Ekblad
         * 
         * DESCRIPTION
         * Example sketch showing how to create a node thay repeates messages
         * from nodes far from gateway back to gateway. 
         * It is important that nodes that has enabled repeater mode calls  
         * gw.process() frequently. Repeaters should never sleep. 
         */
        
        #include <MySensor.h>
        #include <SPI.h>
        
        #define CHILD_ID_RELAY 1   // Id of the sensor child
        #define RELAY_PIN 3 // The pin for controling the relay
        
        
        MySensor gw;
        
        void setup()  
        {  
          // The third argument enables repeater mode.
          gw.begin( incomingMessage, AUTO, true);
        
          //Send the sensor node sketch version information to the gateway
          gw.sendSketchInfo("Repeater Node", "1.0");
          pinMode (RELAY_PIN, OUTPUT );
          gw.present(CHILD_ID_RELAY, S_LIGHT);
        
        }
        
        void loop() 
        {
          // By calling process() you route messages in the background
          gw.process();
        }
        
        void incomingMessage(const MyMessage &message) {
          if (message.type==V_LIGHT) {
             if ( message.sensor == CHILD_ID_RELAY ) {
                digitalWrite( RELAY_PIN, message.getBool()? HIGH :LOW );
             }
           }
        }
        

        Let me know if it works. Might be somthing I'll be needing myself ;-)

        1 Reply Last reply
        0
        • jl277013J Offline
          jl277013J Offline
          jl277013
          wrote on last edited by
          #4

          Do I need to link/pair the repeater node to the gateway or does it just work when I power it up?

          1 Reply Last reply
          0

          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
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          19

          Online

          12.0k

          Users

          11.2k

          Topics

          113.4k

          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