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. Discussion: Reliable delivery

Discussion: Reliable delivery

Scheduled Pinned Locked Moved Development
protocol
54 Posts 10 Posters 16.6k Views 17 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.
  • YveauxY Yveaux

    @mfalkvidd @return is doxygen formatting info, while the link points to documentation manually written. For 2.0 doxygen is on the agenda, and maybe the manual docs will be replaced by doxygen generated docs. Probably @hek has better insight on the subject.

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

    @Yveaux yes he has. As mentioned above hek said he would manually update the documentation after I had created a PR but it seems like a PR is not needed.

    1 Reply Last reply
    0
    • hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by
      #32

      It's already building, but only @Anticimex has been a good boy adding the correct doxygen comments to his code .
      http://ci.mysensors.org/job/MySensorsArduino/branch/development/Doxygen_HTML/

      1 Reply Last reply
      0
      • Mark SwiftM Offline
        Mark SwiftM Offline
        Mark Swift
        wrote on last edited by
        #33

        Has there been any progress on this guys?

        mfalkviddM 1 Reply Last reply
        0
        • Mark SwiftM Mark Swift

          Has there been any progress on this guys?

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

          @Mark-Swift thanks for asking. Number 3 and 4 in this post were actually already in place in the code and documentation before this thread was started, but it seems like updating the site to reflect that is quite hard. I don't know how updating the site works unfortunately. The only advice I can give is "Don't look at the online documentation, dig through the source code instead".

          number 1 is blocked by me getting enough motivation to do the work required to get the development channel working without screwing up my existing projects. There are so many changes to folder locations and similar that I am unable to compile anything if I switch to the development version and I'm not looking forward to figuring out how to handle that.

          BartEB 1 Reply Last reply
          0
          • mfalkviddM mfalkvidd

            @Mark-Swift thanks for asking. Number 3 and 4 in this post were actually already in place in the code and documentation before this thread was started, but it seems like updating the site to reflect that is quite hard. I don't know how updating the site works unfortunately. The only advice I can give is "Don't look at the online documentation, dig through the source code instead".

            number 1 is blocked by me getting enough motivation to do the work required to get the development channel working without screwing up my existing projects. There are so many changes to folder locations and similar that I am unable to compile anything if I switch to the development version and I'm not looking forward to figuring out how to handle that.

            BartEB Offline
            BartEB Offline
            BartE
            Contest Winner
            wrote on last edited by
            #35

            @mfalkvidd said:

            Add an example that has a complete implementation of end-to-end ack usage. This includes
            setting up timer(s) for re-sending
            storing sent messages so they can be re-sent
            determining which message was acked when an ack message is received (there might be several messages that haven't been acked yet)
            removing acked message from the sent message store and clearing the timer(s)
            re-sending when the timers expire

            Are you referring to this number 1 post?

            Does this functionality need to be part of the bool send(MyMessage &msg, bool ack); function or become a layer over the send() function?

            Maybe i can have a look one of these days...

            mfalkviddM 1 Reply Last reply
            0
            • BartEB BartE

              @mfalkvidd said:

              Add an example that has a complete implementation of end-to-end ack usage. This includes
              setting up timer(s) for re-sending
              storing sent messages so they can be re-sent
              determining which message was acked when an ack message is received (there might be several messages that haven't been acked yet)
              removing acked message from the sent message store and clearing the timer(s)
              re-sending when the timers expire

              Are you referring to this number 1 post?

              Does this functionality need to be part of the bool send(MyMessage &msg, bool ack); function or become a layer over the send() function?

              Maybe i can have a look one of these days...

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

              @BartE I'm referring to the post that starts with "Very cool! Thanks a lot @hek!"

              1 Reply Last reply
              0
              • Mark SwiftM Offline
                Mark SwiftM Offline
                Mark Swift
                wrote on last edited by
                #37

                I'd love to see some examples of how we can implement a reliable delivery method into critical nodes, especially now 2.0.0 is out in the wild.

                1 Reply Last reply
                0
                • Mark SwiftM Offline
                  Mark SwiftM Offline
                  Mark Swift
                  wrote on last edited by
                  #38

                  Any news on this, guys? Do we have some good examples?

                  1 Reply Last reply
                  0
                  • mfalkviddM mfalkvidd

                    @hek said:

                    No, only the findal destination node will answer with a soft ack message.

                    Note, the (soft) ack message has to be picked up by yourself in your incomingMessage function.

                    Thanks for explaining. Just checking if my understanding is correct:

                    bool send(MyMessage &msg, bool ack);
                    

                    will return the result of the hardware ack, regardless if the second parameter is true or false?

                    So my post above should have been like this:

                    Hardware ack is always on

                    • Hardware ack is hop-to-hop acknowledgment
                    • Sending is a blocking function which returns true if an hardware ack was received, and false if ~70ms passed without receiving an hardware ack.
                    • Sending hardware ack (when the message has reached the next-hop node) is handled automatically by the library(/radio)
                    • Receiving an hardware ack is handled automatically by the library, by setting the return value from the send call mentioned above
                    • Up to 15 tries are made automatically by the library. Further re-send needs to be handled manually in each sketch (a while-loop with a counter counting up to maxRetries and using wait() between each resend seems to be the most common solution)

                    Software ack is what I get when using send(msg, true) (and is also supported by some other functions like present(), sendSketchInfo() and sendBatteryLevel()

                    • Software ack is end-to-end acknowledgment
                    • Sending is a non-blocking function
                    • Sending ack (when the message has reached its final destination) is handled automatically by the library
                    • Re-send needs to be handled manually in each sketch (setting up a timer when sending the original message might be a good solution)
                    • Receiving an ack needs to be handled manually in each sketch (by checking msg.isAck() in incomingMessage and clearing the timer mentioned above)
                    rozpruwaczR Offline
                    rozpruwaczR Offline
                    rozpruwacz
                    wrote on last edited by
                    #39

                    @mfalkvidd I just came across this post and I am very supprised by the fact that this information is not written anywhere in the documentation ... I believe this is one of the most important stuff everyone should know to actually use MySensors in a real world application - not just diy/hobby project :/ till now I was sure that return value of send funtion (which is NOT explained in the documentation !) is the end-to-end confirmation ...

                    mfalkviddM 1 Reply Last reply
                    1
                    • rozpruwaczR rozpruwacz

                      @mfalkvidd I just came across this post and I am very supprised by the fact that this information is not written anywhere in the documentation ... I believe this is one of the most important stuff everyone should know to actually use MySensors in a real world application - not just diy/hobby project :/ till now I was sure that return value of send funtion (which is NOT explained in the documentation !) is the end-to-end confirmation ...

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

                      @rozpruwacz Yes. Unfortunately I can't do much more than agree with you :(

                      1 Reply Last reply
                      0
                      • Mark SwiftM Offline
                        Mark SwiftM Offline
                        Mark Swift
                        wrote on last edited by Mark Swift
                        #41

                        I have to chime in and share my agreement. This seems like a fundamental piece of information, I mean, we all want reliable delivery right? For now I've copied a resend function I found on the forums (with some tweaks), but in my opinion, such code should at least me in the core - with the appropriate explanation.

                        1 Reply Last reply
                        1
                        • mfalkviddM Offline
                          mfalkviddM Offline
                          mfalkvidd
                          Mod
                          wrote on last edited by mfalkvidd
                          #42

                          The new and still experimental, but quite extensive Doxygen documentation contains the documentation stuff that's available in the source code. For the return value of the send function, see https://ci.mysensors.org/job/Verifiers/job/MySensors/branch/development/Doxygen_HTML/group__MySensorsCoregrp.html#gadbea3e429757e7fbc66a54776590a2e8

                          1 Reply Last reply
                          1
                          • rozpruwaczR Offline
                            rozpruwaczR Offline
                            rozpruwacz
                            wrote on last edited by
                            #43

                            @mfalkvidd said in Discussion: Reliable delivery:

                            the return value of

                            that is cool :)

                            1 Reply Last reply
                            0
                            • gohanG Offline
                              gohanG Offline
                              gohan
                              Mod
                              wrote on last edited by
                              #44

                              Keep us posted with your progress

                              1 Reply Last reply
                              0
                              • R Offline
                                R Offline
                                robosensor
                                wrote on last edited by
                                #45

                                Returns true if message reached the first stop on its way to destination

                                What will be returned in the case of NRF24L01 as gateway's receiver at destination and internal nrf24 buffer is already contains 3 unread messages?

                                mfalkviddM 1 Reply Last reply
                                0
                                • R robosensor

                                  Returns true if message reached the first stop on its way to destination

                                  What will be returned in the case of NRF24L01 as gateway's receiver at destination and internal nrf24 buffer is already contains 3 unread messages?

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

                                  @robosensor if the gateway is the first stop and the gateway does not acknowledge the message, false is returned.

                                  1 Reply Last reply
                                  0
                                  • gahlawathomeG Offline
                                    gahlawathomeG Offline
                                    gahlawathome
                                    wrote on last edited by
                                    #47

                                    Hi Guyz,

                                    I have been watching this wonderful forum for a while silently now and just started looking at few implementations myself. I am really surprised to know that so much work has been put in MySensors and this area is not given more attention and I second few opinions here that reliable delivery is one of the most important thing especially for actuators. I will try to do an example of end to end (node to gateway) reliable delivery as gateway to controller is pretty much reliable anyways. Meanwhile if anyone has any example already created, please do share over here.

                                    1 Reply Last reply
                                    0
                                    • gahlawathomeG Offline
                                      gahlawathomeG Offline
                                      gahlawathome
                                      wrote on last edited by
                                      #48

                                      Hi Guyz,
                                      Not sure if anyone is interested in this but I would like to share my thinking here.

                                      1. For reliable delivery, Only source and destination should be taking part, transport can do its best but as its can change we cannot expect it to behave precisely.
                                      2. For the sake of simplicity I am assuming all message to be Idempotent. (i.e if this is executed multiple times result will be same. say turn on a switch). I know about OFF ON OFF scenario but for most of our requirements and times involved, I would say that we can assume that when we are delivering one message other will not come. However if any actuator changes so frequently we should think about it.
                                      3. For Controller to to Actuator delivery, I am implementing a solution where actuator send its state back to controller on every change. When controller sends a command out to actuator it will wait for a second or two to see if the state is updated. If not it retries and it retries for a max number of times everyday which is getting logged to keep track of reliability in transport. This way if my max retry is not reached I can be sure that every message has reached actuator.
                                      4. For actuator to controller delivery I am planning to do similar where it sends until it returns true with a acknowledge requested and keep sending it until either ack has come or max retry has been reached. Also keeping track of attempts it had to make and send those as well reliably to controller for analysis. I know this will not ensure gateway to controller delivery but I will see how this one works and if needed will add that later. But not doing it now to avoid dependency of controller on my individual node.
                                      1 Reply Last reply
                                      0
                                      • rozpruwaczR Offline
                                        rozpruwaczR Offline
                                        rozpruwacz
                                        wrote on last edited by
                                        #49

                                        @gahlawathome said in Discussion: Reliable delivery:

                                        When controller sends a

                                        Hi,

                                        ad. 1. Do You reffer to source and destination as a piece of code that uses MySensors lib ? If yes then I agree.
                                        ad. 2. I think that OFF ON OFF scenario is more related to user interfece that to actual message passing. I think that Your assumption is the basics of reliable delivery.
                                        ad. 3. I would divide this to: Controller -> GW than GW -> Acturator. Basically because communication GW -> Controller is much much more reliable and it simplifies a lot the implementation of the Controller. I would like to know how current implementation of mysesnors mqtt gateway handles this. For now I'm assuming that it does not request ack or if it does then it is not something very fancy (like try couple of times). So in my setyp (OH2) I do not update switches or slider automaticaly but i'm waiting for update from Actuator, if update arrives it changes state of the button, if not the button will not change and i know that (probably) the light didn't turned on. But this is no good for automatic rules, so I would like to be sure that this will be handled by the GW.
                                        ad. 4. Again I would divide this to Acturator -> GW and GW -> Controller.

                                        gahlawathomeG 1 Reply Last reply
                                        0
                                        • rozpruwaczR rozpruwacz

                                          @gahlawathome said in Discussion: Reliable delivery:

                                          When controller sends a

                                          Hi,

                                          ad. 1. Do You reffer to source and destination as a piece of code that uses MySensors lib ? If yes then I agree.
                                          ad. 2. I think that OFF ON OFF scenario is more related to user interfece that to actual message passing. I think that Your assumption is the basics of reliable delivery.
                                          ad. 3. I would divide this to: Controller -> GW than GW -> Acturator. Basically because communication GW -> Controller is much much more reliable and it simplifies a lot the implementation of the Controller. I would like to know how current implementation of mysesnors mqtt gateway handles this. For now I'm assuming that it does not request ack or if it does then it is not something very fancy (like try couple of times). So in my setyp (OH2) I do not update switches or slider automaticaly but i'm waiting for update from Actuator, if update arrives it changes state of the button, if not the button will not change and i know that (probably) the light didn't turned on. But this is no good for automatic rules, so I would like to be sure that this will be handled by the GW.
                                          ad. 4. Again I would divide this to Acturator -> GW and GW -> Controller.

                                          gahlawathomeG Offline
                                          gahlawathomeG Offline
                                          gahlawathome
                                          wrote on last edited by
                                          #50

                                          @rozpruwacz Thanks for your response.

                                          1. No I meant source as system trying to send message (i.e. Controller for point 3) and destination (Actuator for point3). Transport means mqtt, ethernet gateway, repeater, radio, wires, cloud, ir or anything else in between to reach my destination.
                                          2. Thanks agreed.
                                          3. I get your point but home automation system being a small size (finite and few hundred meters) system we do not need to intelligent hops.The moment we introduce GW in picture, a. Gateway becomes intelligent and needs to store information, b. It will not know what to do if it cannot pass the information ultimately. For example lets say that my controller wants to turn actuator ON. It makes sure message reaches GW but the actuator is down at that time. After some time when GW has done everything to reach it needs to take corrective action (even more intelligent GW) and send a message back to controller telling about this but by this time controller might have already initiated some logic (still not fulfilled the purpose ) based on actuator turning on. Hence if we follow just Controller -> Actuator, GW can be dumb as a brick, our controller will only trigger further logic once it is sure that actuator is turned on. I completely agree with you if its a huge network (like internet) or turnaround time is very high.
                                            Now to answer your question Yes Controller to Gateway is very reliable and although I do not think it has any acknowledgement, I have never seen a failed message here in my setup.
                                            For Manual action as you mentioned I would know by switch but for automatic I am implementing a retry in rules which will try a finite number of times and keep a track of numbers as well for analysis. Once the tries are exhaused I can take corrective action right there.. e.g if it couldn't turn the boiler ON announce and alert people accordingly.
                                          4. I think lets first just discuss 3 and then we can come to 4.
                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          13

                                          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