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. Troubleshooting
  3. Message acknowledgements hoot

Message acknowledgements hoot

Scheduled Pinned Locked Moved Troubleshooting
12 Posts 3 Posters 4.4k 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.
  • L Offline
    L Offline
    lodewyk
    wrote on last edited by
    #1

    Hi guys.

    I’m trying to get acknowledgements to work and need some guidance.

    First of all, are there any code examples or information on this that I’ve missed? I can’t seem to find any real information apart from what’s in the API doc.

    Secondly to my specific problem, I’ve enabled message ack as the in code fragments below but still getting messages at the gateway end with ack flag set to 0.

    Code:
    gw.send(msg.set(value==HIGH ? 1 : 0),true);
    or
    gw.sendBatteryLevel(batteryPcnt,true);

    but still only getting the following messages without ack enabled (4;3;1;0;16;1
    and 4;255;3;0;6;0)

    Below is the documented serial protocol
    node-id;child-sensor-id;message-type;ack;sub-type;payload

    Am I missing something?

    It will be great if someone can point me in the right direction

    Thanks

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dzairo
      wrote on last edited by dzairo
      #2

      Hi.. I also try this and have same result .. I don't know why ..
      I'm waiting for answer ..

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

        Not sure I understand .. But the ack:ing of the message is handled by the gateway and is never visible the serial monitor (unless debugging is enabled).

        Scenario:

        1. A sensor enables ack for a Battery Lever message and sends it.
        2. Message reaches gateway. The MySensors library sends an ack message back to sensor and outputs the Battery Level message to serial.
        L 1 Reply Last reply
        0
        • D Offline
          D Offline
          dzairo
          wrote on last edited by
          #4

          hi hek.
          pls make any sketch example or write where we can download it ..
          and what we must see in debugging if we use it ..
          you write that not possible to see only if debugging is enable ...
          I enable debugging but still see 4 argument is 0 in gateway .. and don't see received packet in node .. I try it ..

          regards..

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

            With debugging you can see that gateway is replying back to sensor. Don't mix up serial protocol with debug messages, they are not the same.

            You can pick up the ack message in the normal callback. See for example RelayActuator on how to handle incoming messages.

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

              @lodewyk said:

              4;3;1;0;16;1

              When you receive a message through serial protocol the zero above means that this not is an ack message.

              You will only get 1 here if you have sent a message through serial protocol out to an sensor and it has REPLIED with an ack message back to controller.'

              All this is described in the first section here:
              http://www.mysensors.org/build/serial_api

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dzairo
                wrote on last edited by
                #7

                hek .. hi ..
                right now I testing this :
                to node load relay actuator and try controll relay (digitla output ) on node by serial gateway ..

                I see debugging message in gateway and in node ..
                if send packet from serial gateway : 40;1;1;1;2;0
                node = 40 , sensor = 1 , message type = set , ACK = true , sub-command =V_LIGHT , payload = 0
                then in node see that received packet and send ACK to gateway ..
                and in serial gateway I see that received it ..

                OK this working .. huraaaa... ACK request serial gateway from node

                But now qestion is how to do it : ACK request node from srial gateway ...
                if push buton then I want to know that packet delivery to serial gateway ..
                or not .. if yes .. OK .. if not then want inform user .. some problem..

                regards.

                1 Reply Last reply
                0
                • hekH hek

                  Not sure I understand .. But the ack:ing of the message is handled by the gateway and is never visible the serial monitor (unless debugging is enabled).

                  Scenario:

                  1. A sensor enables ack for a Battery Lever message and sends it.
                  2. Message reaches gateway. The MySensors library sends an ack message back to sensor and outputs the Battery Level message to serial.
                  L Offline
                  L Offline
                  lodewyk
                  wrote on last edited by
                  #8

                  @hek Thank you, this is useful. This was my first assumption but I don't receive any ack callback at the sensor end and thought I had to handle ack explicitly at the gateway side. I’ve implemented my own node.js gateway using the serial gateway sketch .

                  After more debugging I can actually see the ack arriving at the sensor but my callback still don’t get fired. I am calling gw.process() in the program loop and my callback look as follow.

                  void incomingMessage(const MyMessage &message) {
                  Serial.println("Got message");
                  if (message.isAck()) {
                  Serial.println("This is an ack from gateway");
                  }
                  }

                  mysensor gateway begin code:

                  gw.begin(incomingMessage, 4, false, 0, RF24_PA_LEVEL, RF24_CHANNEL, RF24_DATARATE);

                  Debug after firing a battery update:
                  send: 4-4-0-0 s=255,c=3,t=0,pt=1,l=1,st=ok:102
                  read: 0-0-4 s=255,c=3,t=0,pt=1,l=1:102 <----- I assume this is the ack

                  Any suggestions?

                  Thanks

                  hekH 1 Reply Last reply
                  0
                  • L lodewyk

                    @hek Thank you, this is useful. This was my first assumption but I don't receive any ack callback at the sensor end and thought I had to handle ack explicitly at the gateway side. I’ve implemented my own node.js gateway using the serial gateway sketch .

                    After more debugging I can actually see the ack arriving at the sensor but my callback still don’t get fired. I am calling gw.process() in the program loop and my callback look as follow.

                    void incomingMessage(const MyMessage &message) {
                    Serial.println("Got message");
                    if (message.isAck()) {
                    Serial.println("This is an ack from gateway");
                    }
                    }

                    mysensor gateway begin code:

                    gw.begin(incomingMessage, 4, false, 0, RF24_PA_LEVEL, RF24_CHANNEL, RF24_DATARATE);

                    Debug after firing a battery update:
                    send: 4-4-0-0 s=255,c=3,t=0,pt=1,l=1,st=ok:102
                    read: 0-0-4 s=255,c=3,t=0,pt=1,l=1:102 <----- I assume this is the ack

                    Any suggestions?

                    Thanks

                    hekH Offline
                    hekH Offline
                    hek
                    Admin
                    wrote on last edited by
                    #9

                    @lodewyk

                    Strange..
                    Can you post the part where you send the message to controller also?

                    L 1 Reply Last reply
                    0
                    • hekH hek

                      @lodewyk

                      Strange..
                      Can you post the part where you send the message to controller also?

                      L Offline
                      L Offline
                      lodewyk
                      wrote on last edited by
                      #10

                      @hek gw.sendBatteryLevel(batteryPcnt,true);

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

                        Ok, I see now that there is a bug for callback on receiving acks for internal commands.

                        You might try removing this line:
                        https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/MySensor.cpp#L370

                        L 1 Reply Last reply
                        0
                        • hekH hek

                          Ok, I see now that there is a bug for callback on receiving acks for internal commands.

                          You might try removing this line:
                          https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/MySensor.cpp#L370

                          L Offline
                          L Offline
                          lodewyk
                          wrote on last edited by
                          #12

                          @hek It unfortunately did not work :-(

                          Thanks for the help so far. I'll have to leave this for another day.

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


                          15

                          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
                          • MySensors
                          • OpenHardware.io
                          • Categories
                          • Recent
                          • Tags
                          • Popular