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. Troubleshooting
  3. Node stops working and does not recover if communication fails

Node stops working and does not recover if communication fails

Scheduled Pinned Locked Moved Troubleshooting
9 Posts 3 Posters 2.1k 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.
  • abmantisA Offline
    abmantisA Offline
    abmantis
    wrote on last edited by
    #1

    I've noticed a problem recently, which I haven't seen before (not sure if it was a recent update or is a problem with 2.0).
    If a node sends data to the gateway while the gateway is powered off, the node seems to stop communicating with the gw (after the gw is turned on, of course) until the node is restarted. I have 2 nodes, both with 2.0 and MYSBootloader 1.3, and they both exhibit this behavior.
    Since one of them is inside the wall switch, and the other in a small box, I have not yet had the chance to debug it further.

    Any tips?

    ben999B 1 Reply Last reply
    0
    • abmantisA abmantis

      I've noticed a problem recently, which I haven't seen before (not sure if it was a recent update or is a problem with 2.0).
      If a node sends data to the gateway while the gateway is powered off, the node seems to stop communicating with the gw (after the gw is turned on, of course) until the node is restarted. I have 2 nodes, both with 2.0 and MYSBootloader 1.3, and they both exhibit this behavior.
      Since one of them is inside the wall switch, and the other in a small box, I have not yet had the chance to debug it further.

      Any tips?

      ben999B Offline
      ben999B Offline
      ben999
      wrote on last edited by
      #2

      @abmantis
      I confirm.
      I have no background as my setup is brand new (RPi gateway and openhab2)
      But nodes have to be reset after a restart of gateway

      1 Reply Last reply
      0
      • Boots33B Offline
        Boots33B Offline
        Boots33
        Hero Member
        wrote on last edited by
        #3

        Hard to say without seeing any debug info or sketch details but if you are using sleep in your sketch this thread may be of help.

        abmantisA 1 Reply Last reply
        1
        • Boots33B Boots33

          Hard to say without seeing any debug info or sketch details but if you are using sleep in your sketch this thread may be of help.

          abmantisA Offline
          abmantisA Offline
          abmantis
          wrote on last edited by abmantis
          #4

          @Boots33 Yeah, my node sleeps! It may be that. I see that the development branch has a fix for that already. Is it ok to use that branch?

          Boots33B 1 Reply Last reply
          0
          • abmantisA abmantis

            @Boots33 Yeah, my node sleeps! It may be that. I see that the development branch has a fix for that already. Is it ok to use that branch?

            Boots33B Offline
            Boots33B Offline
            Boots33
            Hero Member
            wrote on last edited by Boots33
            #5

            @abmantis Yes that is correct the node will try and re connect to the gateway when it wakes. In a perfect world this would work every time without issue.
            But of course perfect is a very rare thing to find. So there can be problems with the re-connection. This could be caused by many things such as your node being on the fringe of reception range or interference on the 2.4ghz frequency caused by other devices(microwave ovens for example) or perhaps even other nodes that happen to be transmitting at the same time.

            If your node cannot connect on the first try it will make several more attempts and then if it still cant connect it will then try to find another way to the gateway through a repeater etc. In that other thread they found that If you are using sleep your node may shutdown before the connection is made and it would not get a chance to connect and send your data.

            The workaround stops the node from sleeping if a connection is not present and makes it wait instead. wait will pause the execution of the code but the node will still try and connect in the background.

            the downside is that if the node cannot connect it will never sleep which will be hard on battery powered devices. Depending on your sketch if it is a battery powered node you could perhaps add a counter to the loop which could send the node to sleep after several tries.

            
            if(isTransportOK()){
                sleep(30000);  // transport is OK, node can sleep
              } 
              else {
                wait(5000); // transport is not operational, allow the transport layer to fix this
              }
            
            
            1 Reply Last reply
            1
            • abmantisA Offline
              abmantisA Offline
              abmantis
              wrote on last edited by
              #6

              Thanks for the help and explanation.

              I suggest the following:

              if(!isTransportOK()){
                  wait(5000); // transport is not operational, allow the transport layer to fix this
               }
               sleep(30000);  // transport is OK, node can sleep
              

              That way, if it still can't connect during those 5 seconds it will sleep, and try again the next time.

              Boots33B 1 Reply Last reply
              1
              • abmantisA abmantis

                Thanks for the help and explanation.

                I suggest the following:

                if(!isTransportOK()){
                    wait(5000); // transport is not operational, allow the transport layer to fix this
                 }
                 sleep(30000);  // transport is OK, node can sleep
                

                That way, if it still can't connect during those 5 seconds it will sleep, and try again the next time.

                Boots33B Offline
                Boots33B Offline
                Boots33
                Hero Member
                wrote on last edited by
                #7

                @abmantis with that the node will go into a sleep as soon as it comes out of the wait so the original way is probably best.

                abmantisA 1 Reply Last reply
                0
                • Boots33B Boots33

                  @abmantis with that the node will go into a sleep as soon as it comes out of the wait so the original way is probably best.

                  abmantisA Offline
                  abmantisA Offline
                  abmantis
                  wrote on last edited by abmantis
                  #8

                  @Boots33 But for my node it should be connected in 5 seconds. Range is not a problem. The problem happened because I had to reboot my raspberry, and someone pressed the switch :P

                  Lets say it looses connection for some reason. The next time I press the switch (and the gateway is on), it will have 5 seconds to reconnect, which should be enough. If the gateway is still of, I can just press the switch again when it is turned on.

                  1 Reply Last reply
                  0
                  • Boots33B Offline
                    Boots33B Offline
                    Boots33
                    Hero Member
                    wrote on last edited by
                    #9

                    @abmantis Always more than one way to fix a problem :smiley:

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


                    21

                    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