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

    Best Way to check Status of MySensors Sleeping Node

    Scheduled Pinned Locked Moved General Discussion
    10 Posts 3 Posters 4.8k Views 2 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

      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 1 Reply Last reply Reply Quote 0
      • jkandasaJ Offline
        jkandasa @Tetnobic
        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

        1 Reply Last reply Reply Quote 0
        • T Offline
          Tetnobic
          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 1 Reply Last reply Reply Quote 0
          • jkandasaJ Offline
            jkandasa @Tetnobic
            last edited by

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

            T 1 Reply Last reply Reply Quote 0
            • T Offline
              Tetnobic @jkandasa
              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 1 Reply Last reply Reply Quote 0
              • jkandasaJ Offline
                jkandasa @Tetnobic
                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 1 Reply Last reply Reply Quote 1
                • T Offline
                  Tetnobic @jkandasa
                  last edited by

                  @jkandasa Ohhh wonderfull !
                  You are incredible !!

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

                  1 Reply Last reply Reply Quote 1
                  • D Offline
                    Daniele
                    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 1 Reply Last reply Reply Quote 0
                    • jkandasaJ Offline
                      jkandasa @Daniele
                      last edited by

                      @daniele for another properties,

                      {"hbTx":1511115957097, "aliveCheckInterval": 5}
                      
                      1 Reply Last reply Reply Quote 0
                      • D Offline
                        Daniele
                        last edited by

                        Thanks!!!

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

                        0

                        Online

                        588

                        Users

                        529

                        Topics

                        3.4k

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