Das Projekt ist die Portierung meiner RGB Steuerung vom ChromoflexRCIII auf den RGBW868 von IPS.
changelog:
v1.0 initial release
v1.1 Mehrere Controller möglich (6 vorkonfiguriert)
v.2.0
- AJAX Image Picker
- Beliebig viele Controller möglich.
Vorbereitung:
Das Paket imagepickerRGBWv2.x.zip herunterladen und nach
Ihr_IPS_Ordner/webfront/user/imagepickerRGBW entpacken.
Also muss dann im Ordner User ein Ordner imagepickerRGBW sein.
Upgrade siehe weiter unten…
Installation:
- Dummy Modul erstellen.
- RGBW868 Instanz erstellen und auf Funktion prüfen. Hilfe in der Modulreferenz.
- Installations script erstellen.
<?
// Installationsscript für eine RGBW868 Steuerung v2.0 26.02.2012 Autor: NickBlue
// für IPS v2.5
/************ Konfiguration *************///
$RGBW868InstanzID = 39899 /*[Sripte und Doku\RGBW868Steuerung\RGBW868\RGBW-868 (Stripe)]*/ ; // Hier muss die ID Ihrer RGBW868 Instanz eingetragen werden.
// Installationsscript kann nach Installation gelöscht werden.
/*********** Ab hier nichts mehr verändern *************///
//sucht die ID des übergeordneten Objekts sollte das Dummy Modul sein
$ParentID = IPS_GetObject($IPS_SELF);
$ParentID = $ParentID['ParentID'];
// Variablen Profile anlegen
$IDRGBW868profilname = @IPS_GetVariableIDByName("RGBW868profilname", $ParentID);
if ($IDRGBW868profilname === false)
{
$Profiles = IPS_GetVariableProfileList();
$ProfileVars = array_filter($Profiles, "RGBW868Prog"); // Filterfunktion
$ProfileCounter = count($ProfileVars); // Zählt die Treffer mit dem Filter
while(IPS_VariableProfileExists(".RGBW868Programm" . $ProfileCounter)) {
$ProfileCounter++;
}
$RGBW868profilname = ".RGBW868Programm" . $ProfileCounter;
}
else
{
$RGBW868profilname = GetValue($IDRGBW868profilname);
}
function RGBW868Prog ($var)
{
if(preg_match("/.RGBW868Programm/",$var)) return true;
return false;
}
if (IPS_VariableProfileExists($RGBW868profilname)==False)
{
IPS_CreateVariableProfile($RGBW868profilname, 1);
IPS_SetVariableProfileAssociation($RGBW868profilname, 0, "Aus","",0xFF0000);
IPS_SetVariableProfileAssociation($RGBW868profilname, 1, "Letzte Farbe","",0x00FF00);
IPS_SetVariableProfileAssociation($RGBW868profilname, 2, "Blinken","",-1);
IPS_SetVariableProfileAssociation($RGBW868profilname, 3, "Blinken Schnell","",-1);
IPS_SetVariableProfileAssociation($RGBW868profilname, 4, "Flash","",-1);
IPS_SetVariableProfileAssociation($RGBW868profilname, 5, "Flash Schnell","",-1);
IPS_SetVariableProfileAssociation($RGBW868profilname, 6, "Fade","",-1);
IPS_SetVariableProfileAssociation($RGBW868profilname, 99, "Manuell","",0x00FF00);
IPS_SetVariableProfileAssociation($RGBW868profilname, 100, "Auto","",0x00E5FF);
}
else
{
IPS_DeleteVariableProfile($RGBW868profilname);
IPS_CreateVariableProfile($RGBW868profilname, 1);
IPS_SetVariableProfileAssociation($RGBW868profilname, 0, "Aus","",0xFF0000);
IPS_SetVariableProfileAssociation($RGBW868profilname, 1, "Letzte Farbe","",0x00FF00);
IPS_SetVariableProfileAssociation($RGBW868profilname, 2, "Blinken","",-1);
IPS_SetVariableProfileAssociation($RGBW868profilname, 3, "Blinken Schnell","",-1);
IPS_SetVariableProfileAssociation($RGBW868profilname, 4, "Flash","",-1);
IPS_SetVariableProfileAssociation($RGBW868profilname, 5, "Flash Schnell","",-1);
IPS_SetVariableProfileAssociation($RGBW868profilname, 6, "Fade","",-1);
IPS_SetVariableProfileAssociation($RGBW868profilname, 99, "Manuell","",0x00FF00);
IPS_SetVariableProfileAssociation($RGBW868profilname, 100, "Auto","",0x00E5FF);
}
if (IPS_VariableProfileExists(".FesteFarben")==False)
{
IPS_CreateVariableProfile(".FesteFarben", 1);
IPS_SetVariableProfileAssociation(".FesteFarben", 0, "Rot ", "",0xFF0000);
IPS_SetVariableProfileAssociation(".FesteFarben", 1, "Hellrot", "",0xFF1400);
IPS_SetVariableProfileAssociation(".FesteFarben", 2, "Hellrot1", "",0xFF2800);
IPS_SetVariableProfileAssociation(".FesteFarben", 3, "Rotorange", "",0xFF5000);
IPS_SetVariableProfileAssociation(".FesteFarben", 4, "Orange", "",0xFF7800);
IPS_SetVariableProfileAssociation(".FesteFarben", 5, "Gelb", "",0xFFFF00);
IPS_SetVariableProfileAssociation(".FesteFarben", 6, "Grüngelb", "",0xC8FF00);
IPS_SetVariableProfileAssociation(".FesteFarben", 7, "Hellgrün", "",0x64FF00);
IPS_SetVariableProfileAssociation(".FesteFarben", 8, "Grün", "",0x00FF00);
IPS_SetVariableProfileAssociation(".FesteFarben", 9, "Grünblau", "",0x00FF50);
IPS_SetVariableProfileAssociation(".FesteFarben", 10, "Türkis", "",0x00FF90);
IPS_SetVariableProfileAssociation(".FesteFarben", 11, "Hellblau", "",0x00FFFF);
IPS_SetVariableProfileAssociation(".FesteFarben", 12, "Royal", "",0x0064FF);
IPS_SetVariableProfileAssociation(".FesteFarben", 13, "Blau", "",0x0032FF);
IPS_SetVariableProfileAssociation(".FesteFarben", 14, "Dunkelblau", "",0x0000FF);
IPS_SetVariableProfileAssociation(".FesteFarben", 15, "Dunkellila", "",0x3E007A);
IPS_SetVariableProfileAssociation(".FesteFarben", 16, "Lila", "",0x8907ED);
IPS_SetVariableProfileAssociation(".FesteFarben", 17, "Magenta", "",0xFF00FF);
IPS_SetVariableProfileAssociation(".FesteFarben", 18, "Hellrose", "",0xC647ED);
IPS_SetVariableProfileAssociation(".FesteFarben", 19, "Rosa", "",0xED0581);
IPS_SetVariableProfileAssociation(".FesteFarben", 20, "Weiß", "",0xFFFFFF);
IPS_SetVariableProfileAssociation(".FesteFarben", 21, "Warmweiß", "",0xFFE478);
IPS_SetVariableProfileAssociation(".FesteFarben", 22, "Eisweiß", "",0xABFFFC);
IPS_SetVariableProfileAssociation(".FesteFarben", 23, "Weiß1", "",0xC9FFEB);
IPS_SetVariableProfileAssociation(".FesteFarben", 24, "Weiß2", "",0xCAD9EB);
IPS_SetVariableProfileAssociation(".FesteFarben", 99, "","transparent",-1);
}
else
{
IPS_DeleteVariableProfile(".FesteFarben");
IPS_CreateVariableProfile(".FesteFarben", 1);
IPS_SetVariableProfileAssociation(".FesteFarben", 0, "Rot ", "",0xFF0000);
IPS_SetVariableProfileAssociation(".FesteFarben", 1, "Hellrot", "",0xFF1400);
IPS_SetVariableProfileAssociation(".FesteFarben", 2, "Hellrot1", "",0xFF2800);
IPS_SetVariableProfileAssociation(".FesteFarben", 3, "Rotorange", "",0xFF5000);
IPS_SetVariableProfileAssociation(".FesteFarben", 4, "Orange", "",0xFF7800);
IPS_SetVariableProfileAssociation(".FesteFarben", 5, "Gelb", "",0xFFFF00);
IPS_SetVariableProfileAssociation(".FesteFarben", 6, "Grüngelb", "",0xC8FF00);
IPS_SetVariableProfileAssociation(".FesteFarben", 7, "Hellgrün", "",0x64FF00);
IPS_SetVariableProfileAssociation(".FesteFarben", 8, "Grün", "",0x00FF00);
IPS_SetVariableProfileAssociation(".FesteFarben", 9, "Grünblau", "",0x00FF50);
IPS_SetVariableProfileAssociation(".FesteFarben", 10, "Türkis", "",0x00FF90);
IPS_SetVariableProfileAssociation(".FesteFarben", 11, "Hellblau", "",0x00FFFF);
IPS_SetVariableProfileAssociation(".FesteFarben", 12, "Royal", "",0x0064FF);
IPS_SetVariableProfileAssociation(".FesteFarben", 13, "Blau", "",0x0032FF);
IPS_SetVariableProfileAssociation(".FesteFarben", 14, "Dunkelblau", "",0x0000FF);
IPS_SetVariableProfileAssociation(".FesteFarben", 15, "Dunkellila", "",0x3E007A);
IPS_SetVariableProfileAssociation(".FesteFarben", 16, "Lila", "",0x8907ED);
IPS_SetVariableProfileAssociation(".FesteFarben", 17, "Magenta", "",0xFF00FF);
IPS_SetVariableProfileAssociation(".FesteFarben", 18, "Hellrose", "",0xC647ED);
IPS_SetVariableProfileAssociation(".FesteFarben", 19, "Rosa", "",0xED0581);
IPS_SetVariableProfileAssociation(".FesteFarben", 20, "Weiß", "",0xFFFFFF);
IPS_SetVariableProfileAssociation(".FesteFarben", 21, "Warmweiß", "",0xFFE478);
IPS_SetVariableProfileAssociation(".FesteFarben", 22, "Eisweiß", "",0xABFFFC);
IPS_SetVariableProfileAssociation(".FesteFarben", 23, "Weiß1", "",0xC9FFEB);
IPS_SetVariableProfileAssociation(".FesteFarben", 24, "Weiß2", "",0xCAD9EB);
IPS_SetVariableProfileAssociation(".FesteFarben", 99, "","transparent",-1);
}
if (IPS_VariableProfileExists(".RGBW868FadeTimer")==False)
{
IPS_CreateVariableProfile(".RGBW868FadeTimer", 1);
IPS_SetVariableProfileValues(".RGBW868FadeTimer", 0, 10, 1);
}
else
{
IPS_DeleteVariableProfile(".RGBW868FadeTimer");
IPS_CreateVariableProfile(".RGBW868FadeTimer", 1);
IPS_SetVariableProfileValues(".RGBW868FadeTimer", 0, 10, 1);
}
// Varianblen anlegen:
# Feste Farben
$VarID_FesteFarben = IPS_CreateVariable(1); // Variable erstellen
IPS_SetParent($VarID_FesteFarben, $ParentID); // Einordnen in Objektbaum
IPS_SetVariableCustomProfile($VarID_FesteFarben, ".FesteFarben"); // Profil setzen
IPS_SetName($VarID_FesteFarben, "Feste Farben"); // Name setzen
SetValueInteger($VarID_FesteFarben, 255);
#RGB Fader
$VarID_RGBFader = IPS_CreateVariable(1); // Variable erstellen
IPS_SetParent($VarID_RGBFader, $ParentID); // Einordnen in Objektbaum
IPS_SetVariableCustomProfile($VarID_RGBFader, "~HexColor"); // Profil setzen
IPS_SetName($VarID_RGBFader, "RGB Steuerung"); // Name setzen
# Weiss
$VarID_Weiss = IPS_CreateVariable(1); // Variable erstellen
IPS_SetParent($VarID_Weiss, $ParentID); // Einordnen in Objektbaum
IPS_SetVariableCustomProfile($VarID_Weiss, "~Intensity.255"); // Profil setzen
IPS_SetName($VarID_Weiss, "Weiss"); // Name setzen
SetValueInteger($VarID_Weiss, 255);
#Programm
$VarID_Programm = IPS_CreateVariable(1); // Variable erstellen
IPS_SetParent($VarID_Programm, $ParentID); // Einordnen in Objektbaum
IPS_SetVariableCustomProfile($VarID_Programm, $RGBW868profilname); // Profil setzen
IPS_SetName($VarID_Programm, "Programm"); // Name setzen
#FadeTimer
$VarID_FadeTimer = IPS_CreateVariable(1); // Variable erstellen
IPS_SetParent($VarID_FadeTimer, $ParentID); // Einordnen in Objektbaum
IPS_SetVariableCustomProfile($VarID_FadeTimer, ".RGBW868FadeTimer"); // Profil setzen
IPS_SetName($VarID_FadeTimer, "FadeTimer"); // Name setzen
# RGBAutomatikFarbWertRGB
$VarID_RGBWAutomatikFarbWert = IPS_CreateVariable(3); // Variable erstellen
IPS_SetParent($VarID_RGBWAutomatikFarbWert, $ParentID); // Einordnen in Objektbaum
IPS_SetName($VarID_RGBWAutomatikFarbWert, "RGBWAutomatikFarbWert"); // Name setzen
IPS_SetHidden($VarID_RGBWAutomatikFarbWert ,true); //Objekt verstecken
# RGBAutomatikFarbWertWeiss
$VarID_RGBWAutomatikFarbWertWeiss = IPS_CreateVariable(1); // Variable erstellen
IPS_SetParent($VarID_RGBWAutomatikFarbWertWeiss, $ParentID); // Einordnen in Objektbaum
IPS_SetName($VarID_RGBWAutomatikFarbWertWeiss, "RGBWAutomatikFarbWertWeiss"); // Name setzen
SetValueInteger($VarID_RGBWAutomatikFarbWertWeiss, 255);
IPS_SetHidden($VarID_RGBWAutomatikFarbWertWeiss ,true); //Objekt verstecken
# RGBManuellFarbWert
$VarID_RGBWManuellFarbWert = IPS_CreateVariable(3); // Variable erstellen
IPS_SetParent($VarID_RGBWManuellFarbWert, $ParentID); // Einordnen in Objektbaum
IPS_SetName($VarID_RGBWManuellFarbWert, "RGBWManuellFarbWert"); // Name setzen
IPS_SetHidden($VarID_RGBWManuellFarbWert ,true); //Objekt verstecken
# RGBManuellFarbWertWeiss
$VarID_RGBWManuellFarbWertWeiss = IPS_CreateVariable(1); // Variable erstellen
IPS_SetParent($VarID_RGBWManuellFarbWertWeiss, $ParentID); // Einordnen in Objektbaum
IPS_SetName($VarID_RGBWManuellFarbWertWeiss, "RGBWManuellFarbWertWeiss"); // Name setzen
SetValueInteger($VarID_RGBWManuellFarbWertWeiss, 255);
IPS_SetHidden($VarID_RGBWManuellFarbWertWeiss ,true); //Objekt verstecken
# RGBW868profilname
$VarID_RGBW868profilname = IPS_CreateVariable(3); // Variable erstellen
IPS_SetParent($VarID_RGBW868profilname, $ParentID); // Einordnen in Objektbaum
IPS_SetName($VarID_RGBW868profilname, "RGBW868profilname"); // Name setzen
IPS_SetHidden($VarID_RGBW868profilname ,true); //Objekt verstecken
SetvalueString($VarID_RGBW868profilname, $RGBW868profilname);
# Image Picker HTML Box
$VarID_ImagePicker = IPS_CreateVariable(3); // Variable erstellen
IPS_SetParent($VarID_ImagePicker, $ParentID); // Einordnen in Objektbaum
IPS_SetVariableCustomProfile($VarID_ImagePicker, "~HTMLBox"); // Profil setzen
IPS_SetName($VarID_ImagePicker, "Image Picker"); // Name setzen
SetvalueString($VarID_ImagePicker, '<iframe src="user/imagepickerRGBW/imageColorPicker.php?InstanzID='.$RGBW868InstanzID.'&RGBFaderID='.$VarID_RGBFader.'&ProgrammID='.$VarID_Programm.'&idFesteFarben='.$VarID_FesteFarben.'&FadeTimerID='.$VarID_FadeTimer.'&RGBWAutomatikFarbWertID='.$VarID_RGBWAutomatikFarbWert.'&RGBWManuellFarbWertID='.$VarID_RGBWManuellFarbWert.'&RGBWManuellFarbWertWeissID='.$VarID_RGBWManuellFarbWertWeiss.'&VariablenprofilID='.$VarID_RGBW868profilname.'" border="0" frameborder="0" style="top: 0pt; bottom: 0pt; left: 0pt; right: 0pt; width: 100%; height: 170px;"></iframe>');
// Anordnen
IPS_SetPosition($VarID_ImagePicker, 1);
IPS_SetPosition($VarID_FesteFarben, 2);
IPS_SetPosition($VarID_RGBFader, 3);
IPS_SetPosition($VarID_Weiss, 4);
IPS_SetPosition($VarID_Programm, 5);
IPS_SetPosition($VarID_FadeTimer, 6);
IPS_SetPosition($VarID_RGBWAutomatikFarbWert, 7);
IPS_SetPosition($VarID_RGBWAutomatikFarbWertWeiss, 8);
IPS_SetPosition($VarID_RGBWManuellFarbWert, 9);
IPS_SetPosition($VarID_RGBWManuellFarbWertWeiss, 10);
IPS_SetPosition($VarID_RGBW868profilname, 11);
// Funktion zur Script Erstellung
function CreateScriptByName($ScriptNAME, $ParentID, $ScriptTEXT)
{
global $IPS_SELF;
$ScriptID = @IPS_GetScriptIDByName($ScriptNAME, $ParentID);
if ($ScriptID == 0){
$ScriptID = IPS_CreateScript(0);
IPS_SetName($ScriptID, $ScriptNAME);
IPS_SetParent($ScriptID, $ParentID);
IPS_SetInfo($ScriptID, "This script was created by: #$IPS_SELF#");
$fh = fopen(IPS_GetKernelDir()."scripts\\".$ScriptID.".ips.php", 'w') or die("can't open file");
fwrite($fh, $ScriptTEXT);
fclose($fh);
$ScriptPath = $ScriptID.".ips.php"; //Skriptdatei
IPS_SetScriptFile($ScriptID, $ScriptPath);
IPS_SetHidden($ScriptID, true);
// echo "Die Skript-ID lautet: ". $ScriptID;
return $ScriptID;
}
}
// ############ Hauptscript anlegen: ######################## /////
$ScriptNAME = 'HauptscriptRGBW868Steuerung';
$ScriptIDHauptscriptRGBSteuerung = CreateScriptByName($ScriptNAME,$ParentID, // Funktionsaufruf und Scrip Erstellung
'<?
// v2.0 RGBW868 Steuerung 26.02.2012 Autor: NickBlue für IPS 2.5
/*********** Ab hier nichts mehr verändern *************///
// Konstanten definieren.
define("RGBW868", '.$RGBW868InstanzID.' /**/, true); // ID der RGBW868 Instanz
define("rgbfader", '.$VarID_RGBFader.' /**/, true); // ID der Variable RGB Steuerung mit dem HEXCOLOR Profil
define("weiss", '.$VarID_Weiss.' /**/, true); // ID der Variable weiss
define("programm", '.$VarID_Programm.' /**/, true); // ID der Variable PROGRAMM
define("FadeTimer", '.$VarID_FadeTimer.' /**/, true); // ID der Variable FadeTimer
define("FesteFarben",'.$VarID_FesteFarben.' /**/, true); // ID der Variable Festen Farb Buttons
define("RGBWAutomatikFarbWert",'.$VarID_RGBWAutomatikFarbWert.' /**/, true); // ID der Variable RGBWAutomatikFarbWert speichert den Auto Wert
define("RGBWAutomatikFarbWertWeiss",'.$VarID_RGBWAutomatikFarbWertWeiss.' /**/, true); // ID der Variable RGBWAutomatikFarbWertWeiss speichert den Auto Wert
define("RGBWManuellFarbWert",'.$VarID_RGBWManuellFarbWert.' /**/, true); // ID der Variable RGBWManuellFarbWert speichert den Manueel Wert
define("RGBWManuellFarbWertWeiss",'.$VarID_RGBWManuellFarbWertWeiss.' /**/, true); // ID der Variable RGBWManuellFarbWertWeiss speichert den Manueel Wert
define("RGBW868profilname",'.$VarID_RGBW868profilname.' /**/, true); // ID der Variable RGBWManuellFarbWertWeiss speichert den Manueel Wert
//*** Werte bei Betätigung aus dem Webfront einlesen und einer Variablen zuordnen ***//
if($IPS_SENDER == "WebFront")
{
SetValue($IPS_VARIABLE, $IPS_VALUE);
}
// Funktionsaufruf mit den Werten aus dem RGB Fader
$farb_rgb = hex2rgb(GetValueFormatted(rgbfader));
$farbmanuell_rgb = hex2rgb(GetValue(RGBWManuellFarbWert));
// Variablenwerte einlesen
$RGBW868 = RGBW868;
$HexRGB = GetValueFormatted(rgbfader);
$weiss = GetValue(weiss);
$programm = GetValue(programm);
$FesteFarben = GetValue(FesteFarben);
$FadeTimer = GetValue(FadeTimer);
$RGBW868profilname = GetValue(RGBW868profilname);
$RGBWAutomatikFarbWert = GetValue(RGBWAutomatikFarbWert);
$RGBWAutomatikFarbWertWeiss = GetValue(RGBWAutomatikFarbWertWeiss);
$RGBWManuellFarbWert = GetValue(RGBWManuellFarbWert);
$RGBWManuellFarbWertWeiss = GetValue(RGBWManuellFarbWertWeiss);
$rot = $farb_rgb[0];
$gruen = $farb_rgb[1];
$blau = $farb_rgb[2];
$rotmanuell = $farbmanuell_rgb[0];
$gruenmanuell = $farbmanuell_rgb[1];
$blaumanuell = $farbmanuell_rgb[2];
//Farbpalette (wie die im Herstellertool)
$cf_color_table=array
(
array(255, 0, 0, "FF0000", "Rot"), /*/0: Rot */
array(255, 20, 0,"FF1400", "Hellrot"), /*/1: Hell3rot */
array(255, 40, 0,"FF2800", "Hellrot1"), /*/2: Hell2rot*/
array(255, 80, 0,"FF5000", "Rotorange"), /*/3: Hellrot*/
array(255, 120, 0,"FF7800", "Orange"), /*/4: Orange*/
array(255, 255, 0,"FFFF00", "Gelb"), /*/5: Gelb*/
array(200, 255, 0,"C8FF00", "Grüngelb"), /*/6: Gruengelb*/
array(100, 255, 0,"64FF00", "Hellgrün"), /*/7: Hellgruen*/
array(0, 255, 0,"00FF00", "Grün"), /*/8: Reingruen*/
array(0, 255, 80,"00FF50", "Grünblau"), /*/9: Leicht Indigo*/
array(0, 255, 144,"00FF90", "Türkis"), /*/10: Indigo*/
array(0, 255, 255,"00FFFF", "Hellblau"), /*/11: Hellblau*/
array(0, 100, 255,"0064FF2", "Royal"), /*/12: Hellblau*/
array(0, 50, 255,"0032FF", "Blau"), /*/13: Dunkelblau*/
array(0, 0, 255,"0000FF", "Dunkelblau"), /*/14: Royal*/
array(50, 0, 255,"2300FF2", "Dunkellila"), /*/15:*/
array(100, 0, 255,"6400FF", "Lila"), /*/16:*/
array(255, 0, 255,"FF00FF", "Magenta"), /*/17: Magenta*/
array(255, 0, 100,"FF0064", "Hellrose"), /*/18 */
array(255, 0, 50,"FF0023", "Rosa"), /*/19 */
array(255, 255, 255,"FFFFFF", "Weiß"), /*/ 20 *Weiss */
array(255, 255, 80,"FFFF50", "Warmweiß"), /*/ 21 Ungefaehr Weiss*/
array(120, 255, 120,"78FF78", "Eisweiß"), /*/ 22 Ungefaehr Weiss*/
array(190, 255, 180,"BEFFB4", "Weiß1"), /*/ 23 Ungefaehr Weiss*/
array(160, 255, 255,"A0FFFF", "Weiß2") /*/ 24 Ungefaehr Weiss */
);
// Passende Funktion für Palette
function RGBW868_SetPalColor($objectId, $palColor, $weiss, $FadeTimer)
{
global $cf_color_table;
PJ_DimRGBW($objectId,$cf_color_table[$palColor][0],$FadeTimer,$cf_color_table[$palColor][1],$FadeTimer,$cf_color_table[$palColor][2],$FadeTimer,$weiss,$FadeTimer);
}
// Funktion wandelt den RGB wert aus der RGB Fader Variable von Hex nach Dec und teilt sie in die Werte R G B
function hex2rgb ( $hex )
{
$rgb = array();
$rgb[0] = hexdec ( $hex[0] . $hex[1] );
$rgb[1] = hexdec ( $hex[2] . $hex[3] );
$rgb[2] = hexdec ( $hex[4] . $hex[5] );
return $rgb;
}
//**** Programmsteuerung ****////
if ($programm == 100) // Wen Automatik an
{
switch ($IPS_VARIABLE)
{ // *** RGB Colorfader ****///
case (rgbfader):
SetValue (RGBWAutomatikFarbWert, GetValueFormatted(rgbfader)); // Farbe für Autmatik speichern
$Profilcolor = GetValueFormatted(rgbfader);
IPS_SetVariableProfileAssociation($RGBW868profilname, 100, "Auto","",hexdec($Profilcolor)); // Profil Color setzten
break;
// *** Weiss *** ///
case (weiss):
SetValue (RGBWAutomatikFarbWertWeiss, $weiss); // Farbe für Auto Weiss speichern
break;
// *** Feste Farben Buttens *** ///
case (FesteFarben):
SetValue (RGBWAutomatikFarbWert, $cf_color_table[$FesteFarben][3]); // Farbe für Autmatik speichern
SetValue(rgbfader, hexdec ($cf_color_table[$FesteFarben][3]));
IPS_SetVariableProfileAssociation($RGBW868profilname, 100, "Auto","",hexdec($cf_color_table[$FesteFarben][3])); // Profil Color setzten
break;
// *** Programmwahl *** ///
case (programm):
SetValue(FesteFarben, 99);
SetValue(rgbfader, hexdec($RGBWAutomatikFarbWert));
SetValue(weiss, $RGBWAutomatikFarbWertWeiss);
break;
}
}
else // Wen Automatik aus
{
switch ($IPS_VARIABLE)
{
// *** RGB Colorfader ****///
case (rgbfader):
$farb_rgb = hex2rgb(GetValueFormatted(rgbfader));
PJ_DimRGBW($RGBW868,$rot,$FadeTimer,$gruen,$FadeTimer,$blau,$FadeTimer,$RGBWManuellFarbWertWeiss,$FadeTimer);
SetValue(FesteFarben, 99); // FesteFarben auf Manuell umschalten
SetValue(weiss, $RGBWManuellFarbWertWeiss);
SetValue (RGBWManuellFarbWert, $HexRGB); // Farbe für Manuell speichern
$Profilcolor = GetValueFormatted(rgbfader);
IPS_SetVariableProfileAssociation($RGBW868profilname, 99, "Manuell","",hexdec($Profilcolor)); // Profilfarbe setzen
IPS_SetVariableProfileAssociation($RGBW868profilname, 1, "Letzte Farbe","",hexdec($Profilcolor)); // Profilfarbe setzen
if ($programm == 0)
{
SetValue(programm, 99);
}
break;
case (weiss):
SetValue (RGBWManuellFarbWertWeiss, $weiss); // Farbe für Manuell Weiss speichern
$farb_rgb = hex2rgb(RGBWManuellFarbWert);
PJ_DimRGBW($RGBW868,$rot,$FadeTimer,$gruen,$FadeTimer,$blau,$FadeTimer,$weiss,$FadeTimer);
SetValue(rgbfader, hexdec($RGBWManuellFarbWert));
SetValue(FesteFarben, 99); // FesteFarben auf Manuell umschalten
if ($programm == 0)
{
SetValue(programm, 99);
}
break;
// *** Programmwahl *** ///
case (programm):
if ($IPS_VALUE < 50 and $IPS_VALUE != 0) // Hersteller Programm
{
PJ_RunProgram($RGBW868, $programm);
SetValue(FesteFarben, 99);
SetValue(rgbfader, hexdec($RGBWManuellFarbWert));
SetValue(weiss, $RGBWManuellFarbWertWeiss);
}
else
{
PJ_RunProgram($RGBW868, 0);
SetValue(FesteFarben, 99);
SetValue(rgbfader, 0);
SetValue(weiss, 0);
}
if ($IPS_VALUE == 99) // Manuell ausgewählt
{
SetValue(rgbfader, hexdec($RGBWManuellFarbWert));
$farbmanuell_rgb = hex2rgb($RGBWManuellFarbWert);
SetValue(weiss, $RGBWManuellFarbWertWeiss);
PJ_DimRGBW($RGBW868,$rotmanuell,$FadeTimer,$gruenmanuell,$FadeTimer,$blaumanuell,$FadeTimer,$RGBWManuellFarbWertWeiss,$FadeTimer);
}
break;
// *** Feste Farben Buttens *** ///
case (FesteFarben):
if ($FesteFarben < 99)
{
$funktionsreturn = RGBW868_SetPalColor($RGBW868, $FesteFarben,$RGBWManuellFarbWertWeiss,$FadeTimer);// Funktionsaufruf anhand des gedrückten Buttens FesteFarben im WebFront.
SetValue(rgbfader, hexdec ($cf_color_table[$FesteFarben][3]));
SetValue(weiss, $RGBWManuellFarbWertWeiss);
$Profilcolor = $cf_color_table[$FesteFarben][3];
IPS_SetVariableProfileAssociation($RGBW868profilname, 99, "Manuell","",hexdec($Profilcolor)); // Profilfarbe setzen
IPS_SetVariableProfileAssociation($RGBW868profilname, 1, "Letzte Farbe","",hexdec($Profilcolor)); // Profilfarbe setzen
SetValue (RGBWManuellFarbWert, $cf_color_table[$FesteFarben][3]); // Farbe für Manuell speichern
if ($programm == 0)
{
SetValue(programm, 99);
}
}
break;
}
}
?>'
);
// Script den Variablen zuweisen
IPS_SetVariableCustomAction($VarID_RGBFader, $ScriptIDHauptscriptRGBSteuerung); // Script zuweisen
IPS_SetVariableCustomAction($VarID_Weiss, $ScriptIDHauptscriptRGBSteuerung); // Script zuweisen
IPS_SetVariableCustomAction($VarID_Programm, $ScriptIDHauptscriptRGBSteuerung); // Script zuweisen
IPS_SetVariableCustomAction($VarID_FadeTimer, $ScriptIDHauptscriptRGBSteuerung); // Script zuweisen
IPS_SetVariableCustomAction($VarID_FesteFarben, $ScriptIDHauptscriptRGBSteuerung); // Script zuweisen
echo " <p>Installation Abgeschlossen.</p>
<p>
<br /> Es sollten jetzt alle Scripte und Variablen angelegt sein.
<br />
</p>
<p><br />Dieses Script kann gelöscht werden</p>";
?>
- Installationsscript konfigurieren und ausführen.
- Installation testen und das Installationsscript löschen.
Gruß
NickBlue
imagepickerRGBWv2.0.zip (670 KB)