• Categories
    • Recent
    • Tags
    • Popular
    • Register
    • Login

    Send Payload but NACK

    Scheduled Pinned Locked Moved General Discussion
    scriptcustom widgetjavascriptsmartsleepqueue
    7 Posts 2 Posters 3.3k Views 1 Watching
    Loading More Posts
    • 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.
    • T Offline
      Tetnobic
      last edited by jkandasa

      Hi,
      I have a battery node with Option "Smart sleep" enabled. (I use NRF24L01+ with auto ack)
      So my sensor wake up, does his job, send heartbeat wait for smart sleep wait duration (in mysensors/myconfig.h : MY_SMART_SLEEP_WAIT_DURATION_MS (500ul)) then sleep

      During this sleep wait, mycontroller try to send payload (for change status : Message Type:V_STATUS to 1) and sometimes is not fast enought
      I see this log in mysensors :

      mysgw: !TSF:MSG:SEND,0-0-1-1,s=1,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=NACK:1
      
      

      We see that send status is : st=NACK:1, so my node not receive this payload
      But mycontroller keep the new value of this var (1) instead of keep 0 (because NACK)
      Is there a solution for this case ?

      Thanks

      jkandasaJ 1 Reply Last reply Reply Quote 0
      • jkandasaJ Offline
        jkandasa @Tetnobic
        last edited by

        @Tetnobic For now MyController will not support for ACK/NACK. Kindly have look at https://github.com/mycontroller-org/mycontroller/issues/290

        So my sensor wake up, does his job, send heartbeat wait for smart sleep wait duration (in mysensors/myconfig.h : MY_SMART_SLEEP_WAIT_DURATION_MS (500ul)) then sleep

        When you increase MY_SMART_SLEEP_WAIT_DURATION_MS duration(example: 2000 ms) this issue may be fixed.

        T 1 Reply Last reply Reply Quote 0
        • T Offline
          Tetnobic @jkandasa
          last edited by

          @jkandasa
          Yes it's practically fixed with 2000ms
          99% of payload are send and ACK, sometimes payload are NACK , I think it's my gateway (Raspberry Pi with NRF24L01+ on serial with mycontroller on it too)
          So I still have a way of knowing if payload is ACK (other than show in Mysensors LOG ?)

          1 Reply Last reply Reply Quote 1
          • T Offline
            Tetnobic
            last edited by

            Hi,
            I have only Nodes with Smart sleep enabled. So when I send payloads, they are queued until nodes heartbeat back.
            Is there a way to see this queue ?
            Thanks in advance

            jkandasaJ 1 Reply Last reply Reply Quote 0
            • jkandasaJ Offline
              jkandasa @Tetnobic
              last edited by

              @Tetnobic for now, there is no option to see the queue. But it is good idea to list it.

              jkandasaJ 1 Reply Last reply Reply Quote 0
              • jkandasaJ Offline
                jkandasa @jkandasa
                last edited by

                @tetnobic I have added this support via the custom widget. You can also perform delete message via script.

                Changes available on SNAPSHOT version.

                Script:
                var myImports = new JavaImporter(java.io, java.lang, java.util, java.text);
                
                with(myImports) {
                 var messages = mcApi.messageQueue().smartSleep().getQueue(gatewayId, nodeEui);
                
                //Perform delete message via index
                //mcApi.messageQueue().smartSleep().removeMessages(gatewayId, nodeEui, 0);//Note: index will be in integer
                
                //Perform delete messages for a perticular sensor id
                //mcApi.messageQueue().smartSleep().removeMessages(gatewayId, nodeEui, "1"); //Note: sensorId will be in string
                
                //Perform delete messages for a node
                //mcApi.messageQueue().smartSleep().removeQueue(gatewayId, nodeEui);
                }
                

                image

                Template:
                <table class="table table-hover table-bordered table-striped mc-table">
                  <thead>
                    <th>Gateway Id</th>
                    <th>{{ 'NODE_EUI' | translate }}</th>
                    <th>{{ 'SENSOR_ID' | translate }}</th>
                    <th>{{ 'TYPE' | translate }}</th>
                    <th>{{ 'SUB_TYPE' | translate }}</th>
                    <th>{{ 'ACK' | translate }}</th>
                    <th>{{ 'PAYLOAD' | translate }}</th>
                    <th>{{ 'TIME' | translate }}</th>
                  </thead>
                  <tbody>
                    <#list messages as item>
                        <td>${(item.gatewayId)!}</td>
                        <td>${(item.nodeEui)!}</td>
                        <td>${(item.sensorId)!}</td>
                        <td>${(item.type)!}</td>
                        <td>${(item.subType)!}</td>
                        <td>${(item.ack)!}</td>
                        <td>${(item.payload)!}</td>
                        <td><span uib-tooltip="{{ ${(item.timestamp?c)!"Never"} | date:mchelper.cfg.dateFormat:mchelper.cfg.timezone}}" tooltip-placement="left" am-time-ago="${(item.timestamp?c)!"Never"}"></span></td>
                      </tr>
                    </#list>
                  </tbody>
                </table>
                

                image

                Custom wedgit:

                image

                Note: gatewayId should be integer and nodeEui should be string. ({"gatewayId":1, "nodeEui":"1" })

                Final result:

                image

                T 1 Reply Last reply Reply Quote 0
                • T Offline
                  Tetnobic @jkandasa
                  last edited by

                  @jkandasa
                  OHHHH wonderfull !!! I will try this !
                  Many thanks !

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post

                  0

                  Online

                  587

                  Users

                  529

                  Topics

                  3.4k

                  Posts
                  Copyright © 2015-2025 MyController.org | Contributors | Localization