• header.categories
    • header.recent
    • header.tags
    • header.popular
    • register
    • login

    Best Way to check Status of MySensors Sleeping Node

    scheduled pinned locked moved General Discussion
    10 posts 3 posters 5.3k views 2 watching
    loading-more-posts
    • oldest-to-newest
    • newest-to-oldest
    • most-votes
    reply
    • reply-as-topic
    guest-login-reply
    deleted-message
    • T offline
      Tetnobic
      global:last-edited-by,

      Hi,
      I have a MySensors Temperature/Humidity Sleeping Node.
      When start, it send Temerature/Humidity values, then sleep for XXX seconds, wake up , send values and sleep....
      The XXX seconds is a config var in my node and sended to controller at start.

      Sometimes for many reasons (interference, xxxx...), my node send data but mycontroller don't receive....
      I would like to check this...when after XXX seconds, no data from my node is receive....

      How can I do this ?
      Actually I use this condition script : (with Script bindings : {"sbNodeEUI":1} )

      var myImports = new JavaImporter(java.util, java.util.Calendar, java.lang, java.text);
      
      with(myImports) {
      
      nodesFilters = new HashMap();  
      nodesFilters.put("eui", sbNodeEUI);
      node = mcApi.node().getAll(nodesFilters).data[0];
      
      sensorsFilters = new HashMap(); 
      sensorsFilters.put("nodeId", node.id);
      sensorsFilters.put("sensorId", "1");
      refreshTime = Long.parseLong(mcApi.sensor().getAll(sensorsFilters).data[0].getVariables()[1].value);
      // LastSeen + SleepDuration + Gap
      var estimedTime = Long.parseLong(node.lastSeen) + (refreshTime*1000) + 20000;
      var currentTime = Calendar.getInstance().getTime().getTime();
      
      mcResult = currentTime > estimedTime;
      }
      

      Is there a best way ?
      With "status" of node ? But what's the mycontroller condition that set this status to down?

      Thanks

      jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
      • jkandasaJ offline
        jkandasa @Tetnobic
        global:last-edited-by,

        @Tetnobic I hope you are with SNAPSHOT version.

        You can change Nodes alive check interval on Settings >> System. By default, it is 30 minutes. We can change it. If there was no data for last 30 minutes, that node will be marked as DOWN
        Note: This check will happen for all the nodes.
        0_1484825482750_node-alive0check.png

        And you can setup a rule for your node to send notifications/actions.
        0_1484825523477_rule.png

        one-reply-to-this-post last-reply-time reply quote 0
        • T offline
          Tetnobic
          global:last-edited-by,

          @jkandasa
          Thanks for your response 😉
          I see this Nodes alive check interval settings but it's for "all the nodes", is there a way to configure this by node ? because I have several nodes that do not sleep the same duration, some 5 minutes, some 1 hour,....
          And even more, the duration of sleep can be dynamic (for exemple every 5 minutes during daylight, 1 hour during nights...)
          I know it is a bit complicated 🙂

          jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
          • jkandasaJ offline
            jkandasa @Tetnobic
            global:last-edited-by,

            @Tetnobic I will how complicated to check each node. If possible I will implement. But I cannot guarantee!

            T one-reply-to-this-post last-reply-time reply quote 0
            • T offline
              Tetnobic @jkandasa
              global:last-edited-by,

              @jkandasa
              No problem, I understand that this is really a specific request
              I will continue to use my script, it works

              Thanks for your response

              jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
              • jkandasaJ offline
                jkandasa @Tetnobic
                global:last-edited-by, jkandasa

                @Tetnobic Good news 🙂

                I have updated this request on https://github.com/mycontroller-org/mycontroller/commit/c6cfe4e56bafb7f1bc59e745f13672191ad2e8a6

                You can test this on SNAPSHOT version.

                Currently, Minimum time should be 5 minutes. As check will happens only 5 minutes once.

                You have to include the following property on Node properties to override global aliveCheckInterval

                "aliveCheckInterval": 5
                

                Note: Should be an integer. Values are in the minute.

                0_1484907436094_upload-acee65a9-564f-4398-a46a-03f8a591b381

                T one-reply-to-this-post last-reply-time reply quote 1
                • T offline
                  Tetnobic @jkandasa
                  global:last-edited-by,

                  @jkandasa Ohhh wonderfull !
                  You are incredible !!

                  Many Thanks ! I will test this when I have time
                  Tanks !!!

                  one-reply-to-this-post last-reply-time reply quote 1
                  • D offline
                    Daniele
                    global:last-edited-by,

                    @jkandasa I'd like to implement this check on one of my nodes, but in its properties I automatically found:

                    {"hbTx":1511115957097}

                    What's the syntax to add another property to the node?

                    jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
                    • jkandasaJ offline
                      jkandasa @Daniele
                      global:last-edited-by,

                      @daniele for another properties,

                      {"hbTx":1511115957097, "aliveCheckInterval": 5}
                      
                      one-reply-to-this-post last-reply-time reply quote 0
                      • D offline
                        Daniele
                        global:last-edited-by,

                        Thanks!!!

                        one-reply-to-this-post last-reply-time reply quote 0
                        • first-post
                          last-post

                        0

                        online

                        644

                        users

                        532

                        topics

                        3.4k

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