sincze wrote:If I remember correctly there were some zwave functions in the original pass2php.
I have these functions specifically for zwave (these are all commands from OZWCP):
RefreshZwave: refreshes the status of a device, used for the wrong status of Qubino double relays.
Within the refreshZwave a check is made for dead nodes and tried to wake them up again.
ZwaveCommand:Sends a command to the controller
ControllerBusy:checks if the controller is busy with a previous command
Zwavecancelaction: cancels the current actions. Some action seems to never stop.
Smappee is a energy monitor that gets installed with a ampere meter on the fases of the counter and on those of the solar inverter. They claim to 'read the dna' of every device and can assign that so you know with one meter all appliances in the house.
About influxdb: can't you do anything with the MySQL examples? If a http poller can do it, it must be possible.
For your multiple kodi's:
You could try it simply by this:
Code: Select all
function notify_kodi($msg){
if(strlen($msg)>28){
$chunks=explode('\n',wordwrap($msg,28,'\n',true));
$length=strlen($chunks[0]);
$subject=trim(substr($msg,0,$length));
$message=trim(substr($msg,$length));
}else{
$subject=$msg;
}
$ctx=stream_context_create(array('http'=>array('timeout'=>1)));
file_get_contents('http://192.168.2.7:1597/jsonrpc?request='.urlencode(json_encode(array('jsonrpc'=>"2.0",'method'=>'GUI.ShowNotification','params'=>array('title'=>$subject,'message'=>$message,'displaytime'=>60000),'id'=>"1"))),false,$ctx);
file_get_contents('http://192.168.2.8:1597/jsonrpc?request='.urlencode(json_encode(array('jsonrpc'=>"2.0",'method'=>'GUI.ShowNotification','params'=>array('title'=>$subject,'message'=>$message,'displaytime'=>60000),'id'=>"1"))),false,$ctx);
file_get_contents('http://192.168.2.9:1597/jsonrpc?request='.urlencode(json_encode(array('jsonrpc'=>"2.0",'method'=>'GUI.ShowNotification','params'=>array('title'=>$subject,'message'=>$message,'displaytime'=>60000),'id'=>"1"))),false,$ctx);
file_get_contents('http://192.168.2.10:1597/jsonrpc?request='.urlencode(json_encode(array('jsonrpc'=>"2.0",'method'=>'GUI.ShowNotification','params'=>array('title'=>$subject,'message'=>$message,'displaytime'=>60000),'id'=>"1"))),false,$ctx);
}
the $ctx will give a 1 second timeout so shouldn't be a big delay.
Or with a array:
Code: Select all
function notify_kodi($msg){
if(strlen($msg)>28){
$chunks=explode('\n',wordwrap($msg,28,'\n',true));
$length=strlen($chunks[0]);
$subject=trim(substr($msg,0,$length));
$message=trim(substr($msg,$length));
}else{
$subject=$msg;
}
$ctx=stream_context_create(array('http'=>array('timeout'=>3)));
$kodis=array('kodi1'=>'192.168.2.7','kodi2'=>'192.168.2.8');
foreach($kodis as $name=>$ip){
if(apcu_fetch('s'.$name)=='On')file_get_contents('http://'.$ip.':1597/jsonrpc?request='.urlencode(json_encode(array('jsonrpc'=>"2.0",'method'=>'GUI.ShowNotification','params'=>array('title'=>$subject,'message'=>$message,'displaytime'=>60000),'id'=>"1"))),false,$ctx);
}
}