Request ACK from node to gateway possible?



  • Hey,

    is it possible to tell the gateway that it needs an ACK for switching a relay? Only about 75% of my commands reach the node. I already added decoupling caps at gateway and node, no change. If this is completely related to bad wireless connection maybe it will change when my nodemcu arrives as new gateway.


  • Admin

    Yes it is possible,

    Look at the api for the send-method. The ack message will pop up in your incoming-callback-metchod.



  • @hek I know how to use the send with ACK for sensor data

    gw.send(msg.set(value), true);
    

    but how to make the gw request an ACK from the node when switching a relay? I had a look at the serial gateway sketch and didn't found an option.
    There is an ACK option when presenting the child-ID to the controller, but I suggest it's only for receiving the presentation, not for all future communication with this child. Is that correct?


  • Admin

    Have you looked at the documentation for the serial protocol? It's described there.



  • thanks @hek, I didn't read the serial protocol doc yet. Up to now I only read the API doc.
    Now I know what to change to request ACK, next question is how...
    I use pimatic with mysensors plugin, I suggest thats where to start looking, right? I have had a look at the MySensors.coffee, which seems to define the serial communication standard. At line 500 is the following:

        changeStateTo: (state) ->
          assert state is on or state is off
          if state is true then _state = 1  else _state = 0
          datas = {}
          datas =
          {
            "destination": @config.nodeid,
            "sensor": @config.sensorid,
            "type"  : V_STATUS,
            "value" : _state,
            "ack"   : 1
          }
          @board._rfWrite(datas).then ( () =>
             @_setState(state)
          )
    

    Does that mean for a V_STATUS change message there is always an ACK request from gw? I know you can't be familiar with every controller and MySensors plugin, but maybe someone else knows.


  • Admin

    Yes, it looks like it requests an ack.



  • ok, what is the behavior if there is no ACK coming back? Trying again for several times before discarding the message? How long is the timeout?


  • Admin

    I don't know if pimatic re-sends message after some timeout or not.



  • @Anduril said:

    ok, what is the behavior if there is no ACK coming back? Trying again for several times before discarding the message? How long is the timeout?

    We are discussing this topic in http://forum.mysensors.org/topic/2189/serial-api-noack-when-sending-with-ack-failed as well.

    Currently MySensors never resends any messages. You have to program it into your serial application by yourself. It would have to wait for an ACK message and send again, if it didn't come back within time.

    In the linked thread we are hoping to find a way for implementing this on the hardware of the gateway.


Log in to reply
 

Suggested Topics

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts