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
-
@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 asDOWN
Note: This check will happen for all the nodes.
And you can setup a rule for your node to send notifications/actions.
-
@jkandasa
Thanks for your response
I see thisNodes 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 -
@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 worksThanks for your response
-
@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 globalaliveCheckInterval
"aliveCheckInterval": 5
Note: Should be an integer. Values are in the minute.
-
@jkandasa Ohhh wonderfull !
You are incredible !!Many Thanks ! I will test this when I have time
Tanks !!! -
@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?
-
@daniele for another properties,
{"hbTx":1511115957097, "aliveCheckInterval": 5}
-
Thanks!!!