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. General Discussion
  3. ACKs... Scarce information
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

ACKs... Scarce information

Scheduled Pinned Locked Moved General Discussion
8 Posts 2 Posters 2.0k Views 2 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.
  • M Offline
    M Offline
    moskovskiy82
    wrote on last edited by
    #1

    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?

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

      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.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        moskovskiy82
        wrote on last edited by
        #3

        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

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

          I don't understand, could you rephrase?

          1 Reply Last reply
          0
          • M Offline
            M Offline
            moskovskiy82
            wrote on last edited by
            #5

            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

            MY_MQTT_PUBLISH_TOPIC_PREFIX/FROM-NODE-ID/SENSOR-ID/CMD-TYPE/ACK-FLAG/SUB-TYPE
            

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

            mygateway1-out/71/6/1/1/37 309.0
            
            1 Reply Last reply
            0
            • hekH Offline
              hekH Offline
              hek
              Admin
              wrote on last edited by
              #6

              To enable ack you must call:

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

              1 Reply Last reply
              0
              • M Offline
                M Offline
                moskovskiy82
                wrote on last edited by
                #7

                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?

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

                  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).

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


                  2

                  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