I have a refreshzwave in my script that runs after every switch update (thru domoticz_main)
If one of those switches is changed in the last 5 seconds I call the refreshzwave function for it.
Code: Select all
//Refresh Zwave node
if($STTV>$time-5) RefreshZwave(10);
if($STLichtTerrasGarage>$time-5) RefreshZwave(16);
if($STLichtHallZolder>$time-5) RefreshZwave(20);
if($STLichtInkomVoordeur>$time-5) RefreshZwave(23);
if($STBureel_Tobi>$time-5) RefreshZwave(24);
if($STSubwoofer>$time-5) RefreshZwave(51);
if($STLamp_Bureel>$time-5) RefreshZwave(52);
if($STPluto>$time-5) RefreshZwave(53);
if($STKeukenZolder>$time-5) RefreshZwave(56);
I also have another that just runs by cron every 30 minutes. I like to call it custom polling
Code: Select all
<?php
file_get_contents('http://127.0.0.1:8080/json.htm?type=openzwavenodes&idx=5'); //Change IDX to IDX of your zwave controller
function RefreshZwave($node) {
$zwaveurl='http://127.0.0.1:8080/ozwcp/refreshpost.html';
$zwavedata=array('fun'=>'racp','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(2);$result=file_get_contents($zwaveurl,false,$zwavecontext);if($result=='OK') break;}
}
RefreshZwave(10);
RefreshZwave(16);
RefreshZwave(20);
RefreshZwave(23);
RefreshZwave(24);
RefreshZwave(51);
RefreshZwave(52);
RefreshZwave(53);
RefreshZwave(56);
RefreshZwave(60);
RefreshZwave(61);
RefreshZwave(62);
RefreshZwave(63);