ACKs... Scarce information

  • I've read through the api, several forum topics and it is still unclear to me.

    By default acks are disabled.
    Is it a good practice to enable them on sensors with switches and dimmers?
    If yes.
    In the api it says - * if you want destination node *
    Destination node in this case is the gateway which must send the ack upon the receipt of data?

  • Admin

    Inter node acks is always enabled. The result is returned when calling send().

    But if you want destination node to send a ack back to the origin you must enable this manually when calling send. The end-to-end ack message appears in the incomingMessage function.

  • Strangly i have a sketch with the following

      float mq_reading = analogRead(MQ_Pin);
      if (isnan(mq_reading)) 
      { Serial.println("Failed mq_reading"); }
      else if (mq_reading != last_mq_reading) 
      { last_mq_reading = mq_reading;
        gw.send(msgMQ.set(mq_reading, 1));

    And on the controller (MQTT client gateway on NODEMcu) i never see ACK enabled

    mygateway1-out/71/6/1/0/37 309.0

  • Admin

    I don't understand, could you rephrase?

  • On one of my nodes i have ack message set for the MQ sensor as can be seen in the code

    gw.send(msgMQ.set(mq_reading, 1));

    On the controller (Openhab) i see the message like

    mygateway1-out/71/6/1/0/37 309.0

    This sensor conencts to the MQTT client gateway and the structure of MQTT is supposed to be


    So shouldn't the message have 1 before 37 at the end like below?

    mygateway1-out/71/6/1/1/37 309.0

  • Admin

    To enable ack you must call:

    gw.send(msgMQ.set(mq_reading, 1), true);

  • Thank you didn't notice that it was a decimal point one.

    So is it reasonable to enable ack for switches? And leave it disabled for sensors reporting data?

  • Admin

    You only need to enable if if you actually use the resulting ack message for something.

    If you look at the RelayWithButton example you can see an example of how the local relay only get updated when the ack is received (after pressing the local button).


Suggested Topics