Page 2 of 2
Re: Odd behaviour when power is lost for Z-Wave devices
Posted: Monday 11 January 2016 22:13
by raym
Admittedly, this only seems to be a problem with devices that don't periodically report their status to the controller. But to me, that's where polling, if enabled, should allow Domoticz to overcome the issue. I've used Vera and Fibaro and a bunch of other Z-Wave controllers with my same devices and I can confirm that polling solved this issue in all cases. But for some reason, when a node is marked as dead in Domoticz, even polling has no effect and I don't think this is right....
Do we know at least if this behaviour has everything to do with OZW or is Domoticz partly managing it?
Maybe gizmocuz has some thoughts on the matter and better still, maybe it's a quick fix

Re: Odd behaviour when power is lost for Z-Wave devices
Posted: Wednesday 13 January 2016 21:54
by tomson
I have a similar thing happening. After a few days my Greenwave 6 stops responding (whilst my Fibaro Motion sensor still works). Disabling and enabling my Aeon Labs ZW USB in the hardware screen does fix it.
I have enabled polling for the Greenwave 6. Without enabling it I am loosing my power measurement rather quick.
Re: Odd behaviour when power is lost for Z-Wave devices
Posted: Saturday 06 February 2016 8:43
by Egregius
Found something
Apparently, when a node is marked as dead you can bring it back online with the 'Has node failed' command from OZWCP.
This PHP code asks domoticz for devices. If device is marked as dead it'll send the 'Has node failed' command to bring it back. 10 seconds later the action is cancelled so the controller is free for other include/exclude/... commands.
Code: Select all
<?php
$domoticzurl='http://127.0.0.1:8080/';
$zwaveidx=7;
$devices=json_decode(file_get_contents($domoticzurl.'json.htm?type=openzwavenodes&idx='.$zwaveidx),true);
foreach($devices as $node=>$data) {
if ($node == "result") {
foreach($data as $index=>$eltsNode) {
if ($eltsNode["State"] == "Dead") {
telegram('Node '.$eltsNode['NodeID'].' '.$eltsNode['Description'].' ('.$eltsNode['Name'].') marked as dead, reviving.');
ZwaveHasnodefailed($eltsNode['NodeID']);
sleep(10);
Zwavecancelaction();
}
}
}
}
function ZwaveHasnodefailed ($node) {
global $domoticzurl;
$zwaveurl=$domoticzurl.'ozwcp/refreshpost.html';
$zwavedata=array('fun'=>'hnf','node'=>$node);
$zwaveoptions = array('http'=>array('header'=>'Content-Type: application/x-www-form-urlencoded\r\n','method'=>'POST','content'=>http_build_query($zwavedata),),);
$zwavecontext=stream_context_create($zwaveoptions);
for ($k=1;$k<=5;$k++){
sleep(1);
$result=file_get_contents($zwaveurl,false,$zwavecontext);
if($result=='OK') break;
sleep(1);
}
}
function Zwavecancelaction() {
global $domoticzurl;
$zwaveurl=$domoticzurl.'ozwcp/refreshpost.html';
$zwavedata=array('fun'=>'cancel');
$zwaveoptions = array('http'=>array('header'=>'Content-Type: application/x-www-form-urlencoded\r\n','method'=>'POST','content'=>http_build_query($zwavedata),),);
$zwavecontext=stream_context_create($zwaveoptions);
for ($k=1;$k<=5;$k++){
sleep(1);
$result=file_get_contents($zwaveurl,false,$zwavecontext);
if($result=='OK') break;
sleep(1);
}
}
Full code at
https://github.com/Egregius/PHP-Custom- ... hzwave.php
Re: Odd behaviour when power is lost for Z-Wave devices
Posted: Thursday 11 February 2016 21:53
by raym
@Egregius - thank you for taking the time to address this issue.
I've not tried the script yet. Is your recommendation to run this on a timer, to check for dead nodes on a regular basis? How have you implemented it?
Re: Odd behaviour when power is lost for Z-Wave devices
Posted: Thursday 11 February 2016 22:15
by Egregius
It's part of my "refresh zwave" script wich I run for the Qubino Flush 2 relays, instantly after a switch has happened.
I have it there because there the $devices are already queried.
To avoid massive commands I built-in a 10 minute delay.So, dead nodes are revivid every 10 minutes until their back online. Sometimes takes up to 2 or 3 runs but better that than restarting the whole zwave network, takes 20 minutes here...