Ja, das geht. Bevor ich den Thread hier im Forum suche aus dem das hier her habe poste ich es ganz einfach:
<?
if ($_IPS['SENDER'] == "WebFront") return;
include IPS_GetKernelDir()."scripts\\xmlrpc.inc";
$CCUIP = GetValue(11459 /*[Haustechnik\IP-Adressen\CCU]*/);
$client = new xmlrpc_client($CCUIP.":2001"); // Adresse anpassen
//Ab hier nichts mehr ändern
$object = IPS_GetObject($_IPS['SELF']);
$parentID = $object['ParentID'];
$alarm = "";
$zaehlerID = 18746 /*[Haustechnik\Homematic Devices\Zentralen\Statuszaehler]*/;
//Installer
if ($_IPS['SENDER'] == "Execute")
{
IPS_SetHidden($_IPS['SELF'], true);
IPS_SetName($_IPS['SELF'], "Auswertung");
$parentObject = IPS_GetObject($parentID);
if ($parentObject['ObjectType'] !== 1)
{
$instanceID = IPS_CreateInstance("{485D0419-BE97-4548-AA9C-C083EB82E61E}");
IPS_SetParent($instanceID, $parentID);
$parentID = $instanceID;
IPS_SetParent($_IPS['SELF'], $parentID);
IPS_SetName($instanceID, "Homematic Interfaces");
}
IPS_SetScriptTimer($_IPS['SELF'], 120);
}
$abfrage = new xmlrpcmsg("listBidcosInterfaces");
$send = $client->send($abfrage);
$result = php_xmlrpc_decode($send->value());
for($i=0; $i <count($result); $i++)
{
$adresse = CreateVariableByName($parentID, $result[$i]['DESCRIPTION'].": Adresse", 3);
IPS_SetIcon($adresse, "Info-48");
IPS_SetVariableCustomProfile($adresse, "~String");
if (GetValue($adresse) <> $result[$i]['ADDRESS']) SetValue($adresse, $result[$i]['ADDRESS']);
$connect = CreateVariableByName($parentID, $result[$i]['DESCRIPTION'].": Status", 0);
if(!IPS_VariableProfileExists("Status"))
{
IPS_CreateVariableProfile("Status", 0);
IPS_SetVariableProfileAssociation("Status", 1, "Online", "");
IPS_SetVariableProfileAssociation("Status", 0, "Offline", "");
}
$action = IPS_GetVariable($connect);
if($action['VariableCustomAction'] == 0)
{
IPS_SetVariableCustomAction($connect, $_IPS['SELF']);
IPS_SetIcon($connect, "ampel_gelb");
IPS_SetVariableCustomProfile($connect, "Status");
}
if (GetValue($connect) <> $result[$i]['CONNECTED']) SetValue($connect, $result[$i]['CONNECTED']);
if ($result[$i]['CONNECTED'] == 1)
{
$alarm = $alarm.$result[$i]['DESCRIPTION']." - ONLINE
";
SetValue($zaehlerID, 0);
}
else
{
$alarm = $alarm.$result[$i]['DESCRIPTION']." - OFFLINE
";
SetValue($zaehlerID, GetValue($zaehlerID) + 1);
}
$default = CreateVariableByName($parentID, $result[$i]['DESCRIPTION'].": Default", 0);
if(!IPS_VariableProfileExists("Default"))
{
IPS_CreateVariableProfile("Default", 0);
IPS_SetVariableProfileAssociation("Default", 1, "Aktiv", "");
IPS_SetVariableProfileAssociation("Default", 0, "Inaktiv", "");
}
$action = IPS_GetVariable($default);
if($action['VariableCustomAction'] == 0)
{
IPS_SetVariableCustomAction($default, $_IPS['SELF']);
IPS_SetIcon($default, "Ok-32");
IPS_SetVariableCustomProfile($default, "Default");
}
if (GetValue($default) <> $result[$i]['DEFAULT']) SetValue($default, $result[$i]['DEFAULT']);
}
if (GetValue($zaehlerID) <> 0)
{
include('ProwlPHP.php');
$Betreff = "LAN-Adapter Status kritisch!";
$Nachricht = $alarm."
";
$array = array(
"Betreff" => $Betreff,
"Nachrichtentext" => $Nachricht.date("d.m.Y",time())." / ".date("H:i",time())." Uhr.",
"NachrichtentextUTF8" => utf8_encode($Nachricht.date("d.m.Y",time())." / ".date("H:i",time())." Uhr."),
"application" => "IP-Symcon",
"priority" => 1,
);
IPS_RunScriptEx(18090 /*[Email und Termine\Email Versand IP-Symcon]*/, $array); // Email versenden
IPS_RunScriptEx(56778 /*[Skripte allgemein\Prowl Pushdienst\Prowl Ausgangsmodul]*/, $array); // Prowl versenden
}
function CreateVariableByName($id, $name, $type)
{
//global $_IPS['SELF'];
$vid = @IPS_GetVariableIDByName($name, $id);
if($vid === false)
{
$vid = IPS_CreateVariable($type);
IPS_SetParent($vid, $id);
IPS_SetName($vid, $name);
IPS_SetInfo($vid, "this variable was created by script #".$_IPS['SELF']);
}
return $vid;
}
?>
Nachtrag: Funktioniert nicht mit dem RF-GateWay im CCU2-Design sondern nur mit den runden LAN-Adaptern.