Ähnliche Probleme hatte ich auch.
Ich fange die über die ModelID LWB004 ab.
Hier mal das bekannte Script, was ausm Forum kommt und meine Anpassungen.
Leider hab ich grad nicht mehr Zeit, aber vllt hiflts…
<?
include(IPS_GetScriptFile(27818 /*[Hue\hue_include]*/)/*[Hue\hue_include]*/);
include(IPS_GetScriptFile(53455 /*[Program\IPSLibrary\install\IPSInstaller\IPSInstaller.inc.php]*/ ));
IPSUtils_Include ("IPSLogger.inc.php", "IPSLibrary::app::core::IPSLogger");
//IPSLogger_SetOutEcho(true, c_LogLevel_All);
// Color convertion library
require_once(IPS_GetScriptFile(55141 /*[Hue\hue_colors]*/ ));
$json_url = 'http://'.$config['hue_bridge_ip'].'/api/'.$config['hue_key'];
$ch = curl_init( $json_url );
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET', // -X
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
);
curl_setopt_array( $ch, $options );
$bulbGroups = array("Esszimmer");
// Getting results
$json_result = curl_exec($ch);
$result = json_decode($json_result);
$idCatLights = CreateCategory("Lampen",IPS_GetParent($_IPS['SELF']),0);
$idCatGroups = CreateCategory("Lampengruppen",IPS_GetParent($_IPS['SELF']),0);
$idCatScenes = CreateCategory("Szenen",IPS_GetParent($_IPS['SELF']),0);
$id = 0;
foreach ($result->lights as $light) {
$id=$id+1;
$myLight = hue_createLight($id, $idCatLights, utf8_decode ($light->name));
SetValue(IPS_GetVariableIDByName ("Status", $myLight),$light->state->on);
SetValue(IPS_GetVariableIDByName ("ModelID", $myLight),$light->modelid);
if($light->modelid != "LWB004")
{
SetValue(IPS_GetVariableIDByName ("Hue", $myLight),$light->state->hue);
SetValue(IPS_GetVariableIDByName ("X", $myLight),$light->state->xy[0]);
SetValue(IPS_GetVariableIDByName ("Y", $myLight),$light->state->xy[1]);
//$colors = colorFromXY(new cgpoint($light->state->xy[0],$light->state->xy[1]), $light->modelid);
$colors = colorFromXYsimple(new cgpoint($light->state->xy[0],$light->state->xy[1]), $light->state->bri, $light->modelid);
$colhex = dechex($colors[0]).dechex($colors[1]).dechex($colors[2]);
SetValue(IPS_GetVariableIDByName ("Farbe", $myLight),hexdec($colhex));
SetValue(IPS_GetVariableIDByName ("Sättigung", $myLight),$light->state->sat);
}
SetValue(IPS_GetVariableIDByName ("Helligkeit", $myLight),$light->state->bri);
if(isset($light->state->ct))
{
SetValue(IPS_GetVariableIDByName ("Temperatur", $myLight),$light->state->ct);
}
}
$id = 0;
foreach ($result->groups as $group) {
$id=$id+1;
//print_r($group);
$myGroup = hue_createGroup($id, $idCatGroups, utf8_decode ($group->name));
SetValue(IPS_GetVariableIDByName ("Status", $myGroup),$group->action->on);
SetValue(IPS_GetVariableIDByName ("Helligkeit", $myGroup),$group->action->bri);
if(!in_array($group->name, $bulbGroups))
{
SetValue(IPS_GetVariableIDByName ("Hue", $myGroup),$group->action->hue);
if(isset($group->action->ct)) SetValue(IPS_GetVariableIDByName ("Temperatur", $myGroup),$group->action->ct);
SetValue(IPS_GetVariableIDByName ("Sättigung", $myGroup),$group->action->sat);
//echo $group->action->xy[0]."xx";
SetValue(IPS_GetVariableIDByName ("X", $myGroup),$group->action->xy[0]);
SetValue(IPS_GetVariableIDByName ("Y", $myGroup),$group->action->xy[1]);
SetValue(IPS_GetVariableIDByName ("Effekt", $myGroup),$group->action->effect);
SetValue(IPS_GetVariableIDByName ("Modus", $myGroup),$group->action->colormode);
// Attention: Used LLC011 as default for groups
$colors= colorFromXYsimple(new cgpoint($group->action->xy[0],$group->action->xy[1]), $group->action->bri,"LLC011");
$colhex = dechex($colors[0]).dechex($colors[1]).dechex($colors[2]);
$hexDecColor = hexdec($colhex);
SetValue(IPS_GetVariableIDByName ("Farbe", $myGroup), $hexDecColor);
//SetValue(IPS_GetVariableIDByName ("Übergangszeit", $myGroup),$group->action->transitiontime);
}
}
function hue_createLight($id, $parentID, $name){
$action_script = IPS_GetScriptFile(12218 /*[Hue\hue_Action.ips.php]*/ );
$item = @CreateInstance($name, $parentID, "{485D0419-BE97-4548-AA9C-C083EB82E61E}", $Position=0);
$id_info = IPS_GetObject($item);
@IPS_SetIdent ($item, $id);
// CreateVariable ($Name, $Type, $Parent, $Position, $Profile, $Action=0, $ValueDefault='', $Icon="")
@CreateVariable("Status", 0, $item, 0, "~Switch", $action_script, false);
@CreateVariable("Farbe", 1, $item, 1, "~HexColor", $action_script, false);
@CreateVariable("Helligkeit", 1, $item, 2, "~Intensity.255", $action_script,254);
@IPS_SetHidden(CreateVariable("Hue", 1, $item, 0, "hue_Hue", $action_script,254), True);
@IPS_SetHidden(CreateVariable("ID", 1, $item, 0, "", null,$id), True);
@IPS_SetHidden(CreateVariable("ModelID",3, $item, 0, "", null,""), True);
@IPS_SetHidden(CreateVariable("X", 2, $item, 0, "hue_xy", $action_script,0.1), True);
@IPS_SetHidden(CreateVariable("Y", 2, $item, 0, "hue_xy", $action_script,0.1), True);
@IPS_SetHidden(CreateVariable("Temperatur", 1, $item, 0, "hue_Temperature", $action_script,500), True);
@CreateVariable("Sättigung", 1, $item, 5, "~Intensity.255", $action_script,254);
return $item;
}
function hue_createGroup($id, $parentID, $name){
$action_script = IPS_GetScriptFile(39206 /*[Hue\hue_ActionGroup.ips.php]*/ );
$item = @CreateInstance($name, $parentID, "{485D0419-BE97-4548-AA9C-C083EB82E61E}", $Position=0);
$id_info = IPS_GetObject($item);
@IPS_SetIdent ($item, $id);
@CreateVariable("Status", 0, $item, 0, "~Switch", $action_script, false);
@CreateVariable("Farbe", 1, $item, 1, "~HexColor", $action_script, false);
@CreateVariable("Helligkeit", 1, $item, 2, "~Intensity.255", $action_script,254);
@IPS_SetHidden(CreateVariable("Hue", 1, $item, 3, "hue_Hue", $action_script,254), True);
@IPS_SetHidden(CreateVariable("ID", 1, $item, 0, "", null,$id), True);
@IPS_SetHidden(CreateVariable("Temperatur", 1, $item, 4, "hue_Temperature", $action_script,500), True);
@CreateVariable("Sättigung", 1, $item, 5, "~Intensity.255", $action_script,254);
@IPS_SetHidden(CreateVariable("X", 2, $item, 0, "hue_xy", $action_script,0.1), True);
@IPS_SetHidden(CreateVariable("Y", 2, $item, 0, "hue_xy", $action_script,0.1), True);
@IPS_SetHidden(CreateVariable("Effekt", 3, $item, 0, "hue_effect", $action_script,"none"), True);
@IPS_SetHidden(CreateVariable("Modus", 3, $item, 0, "hue_colormode", $action_script,"xy"), True);
@IPS_SetHidden(CreateVariable("Übergangszeit", 1, $item, 0, "hue_transition", $action_script,4), True);
return $item;
}
?>