• Categories
  • Recent
  • Tags
  • Popular
  • Register
  • Login
  • 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.9k 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 19 Jan 2017, 10:19

    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

    J 1 Reply Last reply 19 Jan 2017, 11:32 Reply Quote 0
    • J Offline
      jkandasa @Tetnobic
      last edited by 19 Jan 2017, 11:32

      @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 19 Jan 2017, 13:20

        @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 🙂

        J 1 Reply Last reply 19 Jan 2017, 16:12 Reply Quote 0
        • J Offline
          jkandasa @Tetnobic
          last edited by 19 Jan 2017, 16:12

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

          T 1 Reply Last reply 20 Jan 2017, 08:52 Reply Quote 0
          • T Offline
            Tetnobic @jkandasa
            last edited by 20 Jan 2017, 08:52

            @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

            J 1 Reply Last reply 20 Jan 2017, 10:14 Reply Quote 0
            • J Offline
              jkandasa @Tetnobic
              last edited by jkandasa 20 Jan 2017, 10:14

              @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 20 Jan 2017, 14:32 Reply Quote 1
              • T Offline
                Tetnobic @jkandasa
                last edited by 20 Jan 2017, 14:32

                @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 19 Nov 2017, 18:58

                  @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?

                  J 1 Reply Last reply 20 Nov 2017, 02:51 Reply Quote 0
                  • J Offline
                    jkandasa @Daniele
                    last edited by 20 Nov 2017, 02:51

                    @daniele for another properties,

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

                      Thanks!!!

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

                      0

                      Online

                      619

                      Users

                      531

                      Topics

                      3.4k

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