Gateway Ack Message


  • Hardware Contributor

    Hello all, who does the Node handles missed messages, messages without a returned ack? Does it try again? Is there a time out? Can I catch a missed ack? I'm using this code in my switch actuators. What happens is that sometimes I click the button and nothing happens, because the GW never replayed back. Questions:

    • Can I make it retry if failed by timeout?
    • Can I catch that time out in any method like the response?

    Thank you all



  • @soloam https://www.mysensors.org/download/sensor_api_20#sending-data

    bool send(MyMessage &msg, bool ack);
    

    Set second argument to true and function send will return true if ack was received and false in contrary. Then you need to write your own procedure to resend message (or do anything else) if function returns false. But mention that ack is send by the first node who receives your message. It means that if you have a repeater node between your node and GW you will only know if repeater gets the message, but you cant be sure if GW received it afterwards.


  • Mod

    @monte that's actually incorrect. But I don't blame you, many people have made the same conclusion as you did. That includes me. It took me about 40 hours of reading forum posts and source code hunting for an answer before I learned how it actually works.

    The return value of the send function is not affected by the ack parameter at all. But the ack parameter is related to delivery to final node, not just the next node (repeater).

    Some information is available here: https://forum.mysensors.org/post/34267
    I have unfortunately not found a way to describe how the different acks work in a way that is easy to understand.


  • Hardware Contributor

    And do we have a way to get a feedback if act was successful? So that We can make something like... if it fails... do it again



  • @mfalkvidd funny thing is that I read that thread, but somehow after some time and some reading it all messed up in my mind again. I hope this time I'll remember this for longer.
    @Soloam you need to write a code in receive function, which will check if ack message is returned. This will ensure your message is received by the GW. Read the thread mentioned by @mfalkvidd.


  • Mod

    @monte yeah, I will have to go back to that thread again and read it thoroughly if I ever need to implement something that requires reliable messages.


 

268
Online

7.8k
Users

8.7k
Topics

93.0k
Posts