Odd behaviour when power is lost for Z-Wave devices

For Z-Wave related questions in Domoticz

Moderator: leecollings

raym
Posts: 81
Joined: Tuesday 03 November 2015 5:07
Target OS: Linux
Domoticz version: beta
Contact:

Re: Odd behaviour when power is lost for Z-Wave devices

Post 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 :)
tomson
Posts: 14
Joined: Friday 14 February 2014 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Groningen
Contact:

Re: Odd behaviour when power is lost for Z-Wave devices

Post 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.
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Odd behaviour when power is lost for Z-Wave devices

Post 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
raym
Posts: 81
Joined: Tuesday 03 November 2015 5:07
Target OS: Linux
Domoticz version: beta
Contact:

Re: Odd behaviour when power is lost for Z-Wave devices

Post 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?
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Odd behaviour when power is lost for Z-Wave devices

Post 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...
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest