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. [SOLVED] Go to loop(); when parent/gateway can't be found.

[SOLVED] Go to loop(); when parent/gateway can't be found.

Scheduled Pinned Locked Moved Development
12 Posts 6 Posters 111 Views 5 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.
  • S Offline
    S Offline
    Sasquatch
    wrote on last edited by Sasquatch
    #1

    I have all light switches in my flat running a relay node with local switch.
    Recent gateway PSU failure rendered all my lights nonoperational.
    PSU tripped RCB and killed gateway, after power was resumed no light switch worked.
    All nodes were stuck in endless loop trying to find gateway and never reached loop(), where local switch interactions are programmed.
    Is there a way to prevent this? I had no working lights for 3 days before new gateway parts arrived!!!

    mfalkviddM 1 Reply Last reply
    0
    • S Sasquatch

      I have all light switches in my flat running a relay node with local switch.
      Recent gateway PSU failure rendered all my lights nonoperational.
      PSU tripped RCB and killed gateway, after power was resumed no light switch worked.
      All nodes were stuck in endless loop trying to find gateway and never reached loop(), where local switch interactions are programmed.
      Is there a way to prevent this? I had no working lights for 3 days before new gateway parts arrived!!!

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

      @Sasquatch yes. The keyword to search the forum for is MY_TRANSPORT_WAIT_READY_MS

      skywatchS S 2 Replies Last reply
      2
      • mfalkviddM mfalkvidd

        @Sasquatch yes. The keyword to search the forum for is MY_TRANSPORT_WAIT_READY_MS

        skywatchS Offline
        skywatchS Offline
        skywatch
        wrote on last edited by
        #3

        @mfalkvidd If you have time, could you give an example of how @Sasquatch and others (including me!) could use this please?

        mfalkviddM 1 Reply Last reply
        0
        • mfalkviddM mfalkvidd

          @Sasquatch yes. The keyword to search the forum for is MY_TRANSPORT_WAIT_READY_MS

          S Offline
          S Offline
          Sasquatch
          wrote on last edited by
          #4

          @mfalkvidd Thank You!!!
          @skywatch just search forums, plenty of use examples, knowing what to search for was a key problem ;).

          1 Reply Last reply
          1
          • skywatchS skywatch

            @mfalkvidd If you have time, could you give an example of how @Sasquatch and others (including me!) could use this please?

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

            @skywatch I have never used this feature so I can’t help that much. Based on what I have read in the forums, exactly how you want to use this feature is heavily dependent on the details of each use case so it is impossible to give generic recommendations.

            1 Reply Last reply
            1
            • S Offline
              S Offline
              sindrome73
              wrote on last edited by
              #6

              @skywatch said in Go to loop(); when parent/gateway can't be found.:

              ai tempo, potresti dare un

              Just insert this line:

              #define MY_TRANSPORT_WAIT_READY_MS 1000

              before : #include <MySensors.h>

              this is all, so if the Gateway is not available after 1000 Milli seconds, the scketch is performed anyway

              skywatchS 1 Reply Last reply
              1
              • S sindrome73

                @skywatch said in Go to loop(); when parent/gateway can't be found.:

                ai tempo, potresti dare un

                Just insert this line:

                #define MY_TRANSPORT_WAIT_READY_MS 1000

                before : #include <MySensors.h>

                this is all, so if the Gateway is not available after 1000 Milli seconds, the scketch is performed anyway

                skywatchS Offline
                skywatchS Offline
                skywatch
                wrote on last edited by
                #7

                @sindrome73 Thanks for that - is there a value returned that could be used to indicate if a connection was successful or not? If so it could display on a screen or led to show if connection is running or not.

                BearWithBeardB 1 Reply Last reply
                0
                • skywatchS skywatch

                  @sindrome73 Thanks for that - is there a value returned that could be used to indicate if a connection was successful or not? If so it could display on a screen or led to show if connection is running or not.

                  BearWithBeardB Offline
                  BearWithBeardB Offline
                  BearWithBeard
                  wrote on last edited by BearWithBeard
                  #8

                  @skywatch I think you should be able to use isTransportReady() for this. It returns true if transport is ready and working, false if not.

                  #define MY_TRANSPORT_WAIT_READY_MS 1000 // Any value > 0
                  void loop()
                  {
                      if (!isTransportReady())
                      {
                          // No uplink
                      }
                  }
                  
                  S 1 Reply Last reply
                  2
                  • BearWithBeardB BearWithBeard

                    @skywatch I think you should be able to use isTransportReady() for this. It returns true if transport is ready and working, false if not.

                    #define MY_TRANSPORT_WAIT_READY_MS 1000 // Any value > 0
                    void loop()
                    {
                        if (!isTransportReady())
                        {
                            // No uplink
                        }
                    }
                    
                    S Offline
                    S Offline
                    Sasquatch
                    wrote on last edited by
                    #9

                    @BearWithBeard
                    If you omit

                     #define MY_TRANSPORT_WAIT_READY_MS 1000
                    

                    or define it as 0 and transport is not ready on boot then sketch will never reach loop();

                     if (!isTransportReady())
                        {
                            // No uplink
                        }
                    

                    Is handy for skipping sending data to gateway in fault condition, saves battery/power.

                    BearWithBeardB 1 Reply Last reply
                    0
                    • S Sasquatch

                      @BearWithBeard
                      If you omit

                       #define MY_TRANSPORT_WAIT_READY_MS 1000
                      

                      or define it as 0 and transport is not ready on boot then sketch will never reach loop();

                       if (!isTransportReady())
                          {
                              // No uplink
                          }
                      

                      Is handy for skipping sending data to gateway in fault condition, saves battery/power.

                      BearWithBeardB Offline
                      BearWithBeardB Offline
                      BearWithBeard
                      wrote on last edited by BearWithBeard
                      #10

                      @Sasquatch I'm sorry if I've been too implicit in my answer to @skywatch. I assumed that he intended to use it with MY_TRANSPORT_WAIT_READY_MS > 0, so he can react to it inside the loop(), like going to sleep for a while or turning on a LED as he mentioned.

                      S 1 Reply Last reply
                      0
                      • BearWithBeardB BearWithBeard

                        @Sasquatch I'm sorry if I've been too implicit in my answer to @skywatch. I assumed that he intended to use it with MY_TRANSPORT_WAIT_READY_MS > 0, so he can react to it inside the loop(), like going to sleep for a while or turning on a LED as he mentioned.

                        S Offline
                        S Offline
                        Sasquatch
                        wrote on last edited by
                        #11

                        @BearWithBeard my bad, looked at wrong post and understood your answer wrong, bloody small text on phones ;~)

                        1 Reply Last reply
                        1
                        • alowhumA Offline
                          alowhumA Offline
                          alowhum
                          Plugin Developer
                          wrote on last edited by
                          #12

                          I usualy have it set at 10000. Give the network some time to connect.

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


                          19

                          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