Best Way to check Status of MySensors Sleeping Node



  • 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


  • ADMIN

    @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



  • @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 :)


  • ADMIN

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



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


  • ADMIN

    @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



  • @jkandasa Ohhh wonderfull !
    You are incredible !!

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


Log in to reply
 

5
Online

309
Users

206
Topics

1216
Posts

Looks like your connection to MYCONTROLLER.ORG was lost, please wait while we try to reconnect.