Skip to content
  • 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. How to disable default node registration to the GW?
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

How to disable default node registration to the GW?

Scheduled Pinned Locked Moved Troubleshooting
19 Posts 6 Posters 7.1k Views 9 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I want to create a node where the logic works independently (even if the GW is disabled). once GW begin to work I can have additional functionality for that node (communicate between both of them). How to disable default node registration to GW feature?

    TheoLT 1 Reply Last reply
    0
    • ? A Former User

      I want to create a node where the logic works independently (even if the GW is disabled). once GW begin to work I can have additional functionality for that node (communicate between both of them). How to disable default node registration to GW feature?

      TheoLT Offline
      TheoLT Offline
      TheoL
      Contest Winner
      wrote on last edited by
      #2

      @Guest as far as I know, that's not possible. The question is what's the use case for that. In other words what do you want to accomplish? Since your gateway is always and up and running, I don't see the need for that.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kskud
        wrote on last edited by
        #3

        For example, there is a wall switch which connected to a device which actually switch the light. Using MySensor library we can add additional functionality (some kind of wrapper around the device) which allows us remotely control the light. If something went wrong with my GW my device will not work.

        TheoLT 1 Reply Last reply
        0
        • K kskud

          For example, there is a wall switch which connected to a device which actually switch the light. Using MySensor library we can add additional functionality (some kind of wrapper around the device) which allows us remotely control the light. If something went wrong with my GW my device will not work.

          TheoLT Offline
          TheoLT Offline
          TheoL
          Contest Winner
          wrote on last edited by
          #4

          @kskud My rule of thumb for designing devices like that, is to always add some kind of switch. So that you're always able to operate the device manually when MySensors isn't working.

          I just don't think you can start your sketch and then at a certain moment just initialize MySensors. There should be no need for that. MySensors handles all the communication and communication failures.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kskud
            wrote on last edited by
            #5

            As for me it can be achieved by these parameters:
            #define MY_NODE_ID 7
            #define MY_PARENT_NODE_ID 0
            #define MY_PARENT_NODE_IS_STATIC

            In this case we have all what we need to initialize any node. But it doesn't work for me.

            1 Reply Last reply
            1
            • martinhjelmareM Offline
              martinhjelmareM Offline
              martinhjelmare
              Plugin Developer
              wrote on last edited by
              #6

              Don't define MY_REGISTRATION_FEATURE, then the node doesn't have to be registered.

              K 1 Reply Last reply
              1
              • martinhjelmareM martinhjelmare

                Don't define MY_REGISTRATION_FEATURE, then the node doesn't have to be registered.

                K Offline
                K Offline
                kskud
                wrote on last edited by
                #7

                @martinhjelmare
                So I added to my node sketch:
                #define MY_NODE_ID 7
                #define MY_PARENT_NODE_ID 0
                #define MY_PARENT_NODE_IS_STATIC

                and commented out line in MyConfig.h file:
                //#define MY_REGISTRATION_FEATURE

                but it still tries to connect to the parent node (

                Starting sensor (RNNNA-, 2.0.1-beta)
                TSM:INIT
                TSM:INIT:TSP OK
                TSM:INIT:STATID,ID=10
                TSF:ASID:OK,ID=10
                TSM:FPAR
                TSM:FPAR:STATP=0
                TSM:ID
                TSM:ID:OK,ID=10
                TSM:UPL
                TSF:PING:SEND,TO=0
                !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
                TSF:CHKUPL:FAIL
                !TSM:UPL:FAIL

                martinhjelmareM 1 Reply Last reply
                0
                • K kskud

                  @martinhjelmare
                  So I added to my node sketch:
                  #define MY_NODE_ID 7
                  #define MY_PARENT_NODE_ID 0
                  #define MY_PARENT_NODE_IS_STATIC

                  and commented out line in MyConfig.h file:
                  //#define MY_REGISTRATION_FEATURE

                  but it still tries to connect to the parent node (

                  Starting sensor (RNNNA-, 2.0.1-beta)
                  TSM:INIT
                  TSM:INIT:TSP OK
                  TSM:INIT:STATID,ID=10
                  TSF:ASID:OK,ID=10
                  TSM:FPAR
                  TSM:FPAR:STATP=0
                  TSM:ID
                  TSM:ID:OK,ID=10
                  TSM:UPL
                  TSF:PING:SEND,TO=0
                  !TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
                  TSF:CHKUPL:FAIL
                  !TSM:UPL:FAIL

                  martinhjelmareM Offline
                  martinhjelmareM Offline
                  martinhjelmare
                  Plugin Developer
                  wrote on last edited by martinhjelmare
                  #8

                  @kskud

                  Sorry I thought the question was how to disable node registration to gateway.

                  It might be possible to have comms working without a gateway if you define the whole network with node ids and parents and make sure that all nodes can talk to their parents. But I'm more or less guessing here, since I don't know all of the transport machinery. @tekka would know best.

                  For the uplink (UPL) check to return ok, the parent has to reply the PING from the node with a PONG. You have defined the node's parent to be 0, which is reserved for the gateway. So without a gateway, the UPL will fail. You could try assigning the neighbour node id, that you want your node to talk to, to the parent id of the node.

                  Looking again, it seems the PING is hardcoded to the gateway address. So I don't think it's possible.

                  K 1 Reply Last reply
                  1
                  • martinhjelmareM martinhjelmare

                    @kskud

                    Sorry I thought the question was how to disable node registration to gateway.

                    It might be possible to have comms working without a gateway if you define the whole network with node ids and parents and make sure that all nodes can talk to their parents. But I'm more or less guessing here, since I don't know all of the transport machinery. @tekka would know best.

                    For the uplink (UPL) check to return ok, the parent has to reply the PING from the node with a PONG. You have defined the node's parent to be 0, which is reserved for the gateway. So without a gateway, the UPL will fail. You could try assigning the neighbour node id, that you want your node to talk to, to the parent id of the node.

                    Looking again, it seems the PING is hardcoded to the gateway address. So I don't think it's possible.

                    K Offline
                    K Offline
                    kskud
                    wrote on last edited by
                    #9

                    @martinhjelmare

                    Yes. You are right.
                    0_1470064751331_upload-d1a03bcb-9b27-4594-a1fb-e3374784d0f4

                    And it's strange that disabling registration (MY_REGISTRATION_FEATURE) still process another kind of "registration"

                    TheoLT 1 Reply Last reply
                    1
                    • K kskud

                      @martinhjelmare

                      Yes. You are right.
                      0_1470064751331_upload-d1a03bcb-9b27-4594-a1fb-e3374784d0f4

                      And it's strange that disabling registration (MY_REGISTRATION_FEATURE) still process another kind of "registration"

                      TheoLT Offline
                      TheoLT Offline
                      TheoL
                      Contest Winner
                      wrote on last edited by
                      #10

                      @kskud I've given a lot of thoughts about your question. And my conclusion is as posted fist. A MySensor node should let MySensors handle all the transport of message, doing retransmits an reconnects. Therefore it needs to connect to the gateway during initialization.

                      If communication fails MySensors should handle it. If for some case you are making an actuator, then it's you responsibility to add a mechanism for manually controlling the actuator. That way it can still be controlled, whenever MySensors is not available. It is just as how I designed my gesture controlled lamp. I can control it through a Gesture sensor. Being be able to control it through MySensors is just a bonus. So just add a cheap tactile switch for doing the manual control. It almost takes no programming skills nor does it take a lot of knowledge about electronics.

                      My 50 cents is, that it's way easier to do as I suggest than to stay on the road you're traveling. You're trying to change the MySensors core functionality. Will you be able to achieve your goal? Perhaps, but the road might be very long and most likely only the core members are able to answer the questions you will come across. Since they spend their free time on MySensors I doubt if they have to time to answer them.

                      But as stated that's my 50 cents. Good luck with your journey.

                      Nca78N 1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        kskud
                        wrote on last edited by kskud
                        #11

                        Probably it will help someone. I found how to do what I want without big changes. So you have to:

                        1. commented out in MyConfig.h this line:
                          #define MY_REGISTRATION_FEATURE

                        2. add changes to MyTransport.cpp (add marked lines of code)
                          bool transportCheckUplink(bool force) {
                          #if !defined(MY_PARENT_NODE_IS_STATIC) and !defined(MY_REGISTRATION_FEATURE)
                          if (!force && (hwMillis() - _transportSM.lastUplinkCheck) < CHKUPL_INTERVAL) {
                          TRANSPORT_DEBUG(PSTR("TSF:CHKUPL:OK,FCTRL\n")); // flood control
                          return true;
                          }
                          // ping GW
                          uint8_t hopsCount = transportPingNode(GATEWAY_ADDRESS);
                          // verify hops
                          if (hopsCount != INVALID_HOPS) {
                          // update
                          _transportSM.lastUplinkCheck = hwMillis();
                          TRANSPORT_DEBUG(PSTR("TSF:CHKUPL:OK\n"));
                          // did distance to GW change upstream, eg. re-routing of uplink nodes
                          if (hopsCount != _nc.distance) {
                          TRANSPORT_DEBUG(PSTR("TSF:CHKUPL:DGWC,O=%d,N=%d\n"), _nc.distance, hopsCount); // distance to GW changed
                          _nc.distance = hopsCount;
                          }
                          return true;
                          }
                          else {
                          TRANSPORT_DEBUG(PSTR("TSF:CHKUPL:FAIL\n"));
                          return false;
                          }
                          #else
                          return true;
                          #endif
                          }

                        3. add to your node's sketch:
                          #define MY_NODE_ID 7
                          #define MY_PARENT_NODE_ID 0
                          #define MY_PARENT_NODE_IS_STATIC

                        After that you will be able to start your device, send data even if the parent node is disabled (the request just fail). Once you enable GW you will be able to get presentation, heartbeat status, do standard requests to the node.

                        TheoLT 1 Reply Last reply
                        1
                        • K kskud

                          Probably it will help someone. I found how to do what I want without big changes. So you have to:

                          1. commented out in MyConfig.h this line:
                            #define MY_REGISTRATION_FEATURE

                          2. add changes to MyTransport.cpp (add marked lines of code)
                            bool transportCheckUplink(bool force) {
                            #if !defined(MY_PARENT_NODE_IS_STATIC) and !defined(MY_REGISTRATION_FEATURE)
                            if (!force && (hwMillis() - _transportSM.lastUplinkCheck) < CHKUPL_INTERVAL) {
                            TRANSPORT_DEBUG(PSTR("TSF:CHKUPL:OK,FCTRL\n")); // flood control
                            return true;
                            }
                            // ping GW
                            uint8_t hopsCount = transportPingNode(GATEWAY_ADDRESS);
                            // verify hops
                            if (hopsCount != INVALID_HOPS) {
                            // update
                            _transportSM.lastUplinkCheck = hwMillis();
                            TRANSPORT_DEBUG(PSTR("TSF:CHKUPL:OK\n"));
                            // did distance to GW change upstream, eg. re-routing of uplink nodes
                            if (hopsCount != _nc.distance) {
                            TRANSPORT_DEBUG(PSTR("TSF:CHKUPL:DGWC,O=%d,N=%d\n"), _nc.distance, hopsCount); // distance to GW changed
                            _nc.distance = hopsCount;
                            }
                            return true;
                            }
                            else {
                            TRANSPORT_DEBUG(PSTR("TSF:CHKUPL:FAIL\n"));
                            return false;
                            }
                            #else
                            return true;
                            #endif
                            }

                          3. add to your node's sketch:
                            #define MY_NODE_ID 7
                            #define MY_PARENT_NODE_ID 0
                            #define MY_PARENT_NODE_IS_STATIC

                          After that you will be able to start your device, send data even if the parent node is disabled (the request just fail). Once you enable GW you will be able to get presentation, heartbeat status, do standard requests to the node.

                          TheoLT Offline
                          TheoLT Offline
                          TheoL
                          Contest Winner
                          wrote on last edited by
                          #12

                          @kskud You know that if a new MySensors release comes available you have to make this adjustments again, right?

                          1 Reply Last reply
                          1
                          • A Offline
                            A Offline
                            Alexander Ivanov
                            wrote on last edited by
                            #13

                            I implemented all what kskud recommended but it didn't help, the node excutes only "before" procudure and nothign else (no setup, presentation, loop, receive). Any ideas?

                            1 Reply Last reply
                            0
                            • TheoLT TheoL

                              @kskud I've given a lot of thoughts about your question. And my conclusion is as posted fist. A MySensor node should let MySensors handle all the transport of message, doing retransmits an reconnects. Therefore it needs to connect to the gateway during initialization.

                              If communication fails MySensors should handle it. If for some case you are making an actuator, then it's you responsibility to add a mechanism for manually controlling the actuator. That way it can still be controlled, whenever MySensors is not available. It is just as how I designed my gesture controlled lamp. I can control it through a Gesture sensor. Being be able to control it through MySensors is just a bonus. So just add a cheap tactile switch for doing the manual control. It almost takes no programming skills nor does it take a lot of knowledge about electronics.

                              My 50 cents is, that it's way easier to do as I suggest than to stay on the road you're traveling. You're trying to change the MySensors core functionality. Will you be able to achieve your goal? Perhaps, but the road might be very long and most likely only the core members are able to answer the questions you will come across. Since they spend their free time on MySensors I doubt if they have to time to answer them.

                              But as stated that's my 50 cents. Good luck with your journey.

                              Nca78N Offline
                              Nca78N Offline
                              Nca78
                              Hardware Contributor
                              wrote on last edited by
                              #14

                              @TheoL said:

                              If communication fails MySensors should handle it. If for some case you are making an actuator, then it's you responsibility to add a mechanism for manually controlling the actuator. That way it can still be controlled, whenever MySensors is not available. It is just as how I designed my gesture controlled lamp. I can control it through a Gesture sensor. Being be able to control it through MySensors is just a bonus. So just add a cheap tactile switch for doing the manual control. It almost takes no programming skills nor does it take a lot of knowledge about electronics.

                              But what will happen if you have a power outage (happens a lot where I live) and after that the gateway doesn't restart ? Node will not be able to start, and loop forever inside the initialization of MySensors library, the behavior related to the manual control will never be called ?

                              TheoLT 1 Reply Last reply
                              1
                              • Nca78N Nca78

                                @TheoL said:

                                If communication fails MySensors should handle it. If for some case you are making an actuator, then it's you responsibility to add a mechanism for manually controlling the actuator. That way it can still be controlled, whenever MySensors is not available. It is just as how I designed my gesture controlled lamp. I can control it through a Gesture sensor. Being be able to control it through MySensors is just a bonus. So just add a cheap tactile switch for doing the manual control. It almost takes no programming skills nor does it take a lot of knowledge about electronics.

                                But what will happen if you have a power outage (happens a lot where I live) and after that the gateway doesn't restart ? Node will not be able to start, and loop forever inside the initialization of MySensors library, the behavior related to the manual control will never be called ?

                                TheoLT Offline
                                TheoLT Offline
                                TheoL
                                Contest Winner
                                wrote on last edited by
                                #15

                                @Nca78 If there's a power outage MySensors handles restoring communication. What you could do is install a watch dog during initialization. And give at the longest time as possible, or some kind of random. That helps overloading the gateway when everything is turned back on again.

                                If a device should operate even without gateway communication, then you've got several options. Just add an extra arduino to your project. Make the MySensors node an i2c slave and handle everything else in the other Arduino. This is just one solution, which I'd only use for delicate devices,

                                But none of them will keep the node operating without an UPS kind of solution. There are nowadays powerful capacitors than can store a lot ow power, this is something that can help you keep the node up and running during power outage for at least a couple of minutes.

                                Nca78N 1 Reply Last reply
                                2
                                • TheoLT TheoL

                                  @Nca78 If there's a power outage MySensors handles restoring communication. What you could do is install a watch dog during initialization. And give at the longest time as possible, or some kind of random. That helps overloading the gateway when everything is turned back on again.

                                  If a device should operate even without gateway communication, then you've got several options. Just add an extra arduino to your project. Make the MySensors node an i2c slave and handle everything else in the other Arduino. This is just one solution, which I'd only use for delicate devices,

                                  But none of them will keep the node operating without an UPS kind of solution. There are nowadays powerful capacitors than can store a lot ow power, this is something that can help you keep the node up and running during power outage for at least a couple of minutes.

                                  Nca78N Offline
                                  Nca78N Offline
                                  Nca78
                                  Hardware Contributor
                                  wrote on last edited by
                                  #16

                                  @TheoL what I meant is in case the gateway dies, but that's very unlikely, not worth duplicating the arduino. I didn't have any wired devices until today to test the result of power outage, but a random delay in the before() sounds like an interesting solution to test in case I have problems after I install 10-20 wired modules.

                                  Power outages here last hours, they are doing selective power cuts as they can't keep up with the growth of the city. I would need really big capacitors :D I think a better option for me would be a big and good quality power bank.

                                  TheoLT 1 Reply Last reply
                                  0
                                  • A Offline
                                    A Offline
                                    Alexander Ivanov
                                    wrote on last edited by
                                    #17

                                    @TheoL said:

                                    @kskud My rule of thumb for designing devices like that, is to always add some kind of switch. So that you're always able to operate the device manually when MySensors isn't working.

                                    At the moments my node halts after before() procedure.
                                    @kskud, how to achieve that, how to make void loop() working even if MySensensors doesn't work?

                                    1 Reply Last reply
                                    0
                                    • Nca78N Nca78

                                      @TheoL what I meant is in case the gateway dies, but that's very unlikely, not worth duplicating the arduino. I didn't have any wired devices until today to test the result of power outage, but a random delay in the before() sounds like an interesting solution to test in case I have problems after I install 10-20 wired modules.

                                      Power outages here last hours, they are doing selective power cuts as they can't keep up with the growth of the city. I would need really big capacitors :D I think a better option for me would be a big and good quality power bank.

                                      TheoLT Offline
                                      TheoLT Offline
                                      TheoL
                                      Contest Winner
                                      wrote on last edited by
                                      #18

                                      @Nca78 A powerbank would also be a good solution. The problem with electronic devices is that they are all designed to have a continuous flow of power ;-)

                                      You could also investigate solar power and storing that in batteries. But for me that's too far fetched. Lucky I haven't experienced a power outage in more then 15 years.

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

                                        So since no one has accomplished the goal of bypassing MySensors bootup function. I suggest I'll leave this topic open for a little while. But will be closing it. You can contact each other through the chat function. And if you succeed in your quest, you can start a new topic.

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


                                        7

                                        Online

                                        11.7k

                                        Users

                                        11.2k

                                        Topics

                                        113.0k

                                        Posts


                                        Copyright 2019 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
                                        • OpenHardware.io
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular