Hallo IPS Community und Chromoflex Fans,
Thema: Chromoflex Steuerung v.2.0 mit RGB Fader und Image Picker.
Vorwort und Danksagung:
Ich möchte mich an diese Stelle bei allen bedanken die es ermöglicht haben die Steuerung zu bauen.
Und besonders einem sehr guten Freund für seine Hilfe.
Vorbereitung:
Das Chromoflex Script muss installiert sein Link.
das Paket imagepicker.zip herunterladen und nach Dein_IPS_Ordner/webfront/user/imagepicker entpacken.
Also muss dann im Ordner User ein Ordner imagepicker sein.
Upgrade siehe weiter unten…
Installation:
- DummyModul erstellen
- Install Skript erstellen (Name ist egal, habe es in diesem Beispiel „install rgb“ genannt. Es sollte sich aber direkt unter eurem DummyModul befinden.)
<?
// Installationsscript für eine ChromoflexRCIII Steuerung v2.0 25.02.2012 Autor: NickBlue
// für IPS v2.5
// Das Script zur Steuerung des ChromoflexRCIII finden sie unter dieser URL.
// http://www.ip-symcon.de/forum/f53/chromoflex-rc-iii-fuer-ip-symcon-2-5-a-16327/
$IDChromoflexIIIRCSteuerscript = 32839 /*[Haussteuerung\Flur\Ambientbeleuchtung\Ambiente Beleuchtung\Chromoflex RC III Steuersript]*/ ; // ID des ChromoflexIIIRCSteuerscripts
$IDDeviceIDHex = "108C20"; // Device ID des Chromoflex Controllers default 000000 Broadcast.
$IDNet = 8; // Netzadresse default ist 8.
$IDWebfrontConfigurator = 25147 /*[WebFront Configurator Intern]*/ ; // ID Des Webfronts
// 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
// Prüfen ob irgendein ChromoProgramm Profil Angelegt ist
$IDChromoflexprofilname = @IPS_GetVariableIDByName("Chromoflexprofilname", $ParentID);
if ($IDChromoflexprofilname === false)
{
$Profiles = IPS_GetVariableProfileList();
$ProfileVars = array_filter($Profiles, "ChromoProg"); // Filterfunktion
$ProfileCounter = count($ProfileVars); // Zählt die Treffer mit dem Filter
while(IPS_VariableProfileExists(".ChromoProgramm" . $ProfileCounter)) {
$ProfileCounter++;
}
$Chromoflexprofilname = ".ChromoProgramm" . $ProfileCounter;
}
else
{
$Chromoflexprofilname = GetValue($IDChromoflexprofilname);
}
function ChromoProg ($var)
{
if(preg_match("/.ChromoProgramm/",$var)) return true;
return false;
}
if (IPS_VariableProfileExists($Chromoflexprofilname)==False)
{
IPS_CreateVariableProfile($Chromoflexprofilname, 1);
IPS_SetVariableProfileText($Chromoflexprofilname, "", "");
IPS_SetVariableProfileValues($Chromoflexprofilname, 0, 0, 0);
IPS_SetVariableProfileDigits($Chromoflexprofilname, 0);
IPS_SetVariableProfileIcon($Chromoflexprofilname, "");
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 0, "Aus", "", 0xFF0000);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 1, "Speichern / Aus", "", 0xFF0000);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 3, "FW Normal", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 4, "FW Mittel", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 5, "FW Langsam", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 6, "Blob", "",-1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 7, "LSD", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 8, "Feuer", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 9, "Blitz", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 10, "Burst", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 11, "User1", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 12, "User2", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 13, "User3", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 14, "Strobo Slow", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 15, "Strobo", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 16, "Strobo Fast", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 17, "Mix", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 99, "Manuell", "", 0xFF0000);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 100, "Auto", "", 0xFF0000);
}
else
{
IPS_DeleteVariableProfile($Chromoflexprofilname);
IPS_CreateVariableProfile($Chromoflexprofilname, 1);
IPS_SetVariableProfileText($Chromoflexprofilname, "", "");
IPS_SetVariableProfileValues($Chromoflexprofilname, 0, 0, 0);
IPS_SetVariableProfileDigits($Chromoflexprofilname, 0);
IPS_SetVariableProfileIcon($Chromoflexprofilname, "");
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 0, "Aus", "", 0xFF0000);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 1, "Speichern / Aus", "", 0xFF0000);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 3, "FW Normal", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 4, "FW Mittel", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 5, "FW Langsam", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 6, "Blob", "",-1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 7, "LSD", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 8, "Feuer", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 9, "Blitz", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 10, "Burst", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 11, "User1", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 12, "User2", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 13, "User3", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 14, "Strobo Slow", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 15, "Strobo", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 16, "Strobo Fast", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 17, "Mix", "", -1);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 99, "Manuell", "", 0xFF0000);
IPS_SetVariableProfileAssociation($Chromoflexprofilname, 100, "Auto", "", 0xFF0000);
}
if (IPS_VariableProfileExists(".chromoherstellerfarben")==False)
{
IPS_CreateVariableProfile(".chromoherstellerfarben", 1);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 0, "Rot ", "",0xFF0000);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 1, "Hellrot", "",0xFF1400);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 2, "Hellrot1", "",0xFF2800);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 3, "Rotorange", "",0xFF5000);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 4, "Orange", "",0xFF7800);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 5, "Gelb", "",0xFFFF00);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 6, "Grüngelb", "",0xC8FF00);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 7, "Hellgrün", "",0x64FF00);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 8, "Grün", "",0x00FF00);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 9, "Grünblau", "",0x00FF50);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 10, "Türkis", "",0x00FF90);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 11, "Hellblau", "",0x00FFFF);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 12, "Royal", "",0x0064FF);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 13, "Blau", "",0x0032FF);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 14, "Dunkelblau", "",0x0000FF);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 15, "Dunkellila", "",0x3E007A);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 16, "Lila", "",0x8907ED);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 17, "Magenta", "",0xFF00FF);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 18, "Hellrose", "",0xC647ED);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 19, "Rosa", "",0xED0581);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 20, "Weiß", "",0xFFFFFF);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 21, "Warmweiß", "",0xFFE478);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 22, "Eisweiß", "",0xABFFFC);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 23, "Weiß1", "",0xC9FFEB);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 24, "Weiß2", "",0xCAD9EB);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 99, "","transparent",-1);
}
else
{
IPS_DeleteVariableProfile(".chromoherstellerfarben");
IPS_CreateVariableProfile(".chromoherstellerfarben", 1);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 0, "Rot ", "",0xFF0000);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 1, "Hellrot", "",0xFF1400);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 2, "Hellrot1", "",0xFF2800);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 3, "Rotorange", "",0xFF5000);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 4, "Orange", "",0xFF7800);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 5, "Gelb", "",0xFFFF00);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 6, "Grüngelb", "",0xC8FF00);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 7, "Hellgrün", "",0x64FF00);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 8, "Grün", "",0x00FF00);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 9, "Grünblau", "",0x00FF50);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 10, "Türkis", "",0x00FF90);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 11, "Hellblau", "",0x00FFFF);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 12, "Royal", "",0x0064FF);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 13, "Blau", "",0x0032FF);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 14, "Dunkelblau", "",0x0000FF);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 15, "Dunkellila", "",0x3E007A);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 16, "Lila", "",0x8907ED);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 17, "Magenta", "",0xFF00FF);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 18, "Hellrose", "",0xC647ED);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 19, "Rosa", "",0xED0581);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 20, "Weiß", "",0xFFFFFF);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 21, "Warmweiß", "",0xFFE478);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 22, "Eisweiß", "",0xABFFFC);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 23, "Weiß1", "",0xC9FFEB);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 24, "Weiß2", "",0xCAD9EB);
IPS_SetVariableProfileAssociation(".chromoherstellerfarben", 99, "","transparent",-1);
}
// Varianblen anlegen:
# Feste Farben
$VarID_FesteFarben = IPS_CreateVariable(1); // Variable erstellen
IPS_SetParent($VarID_FesteFarben, $ParentID); // Einordnen in Objektbaum
IPS_SetVariableCustomProfile($VarID_FesteFarben, ".chromoherstellerfarben"); // 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
# Dimmer
$VarID_Dimmer = IPS_CreateVariable(1); // Variable erstellen
IPS_SetParent($VarID_Dimmer, $ParentID); // Einordnen in Objektbaum
IPS_SetVariableCustomProfile($VarID_Dimmer, "~Intensity.255"); // Profil setzen
IPS_SetName($VarID_Dimmer, "Dimmer"); // Name setzen
SetValueInteger($VarID_Dimmer, 255);
#Programm
$VarID_Programm = IPS_CreateVariable(1); // Variable erstellen
IPS_SetParent($VarID_Programm, $ParentID); // Einordnen in Objektbaum
IPS_SetVariableCustomProfile($VarID_Programm, $Chromoflexprofilname); // Profil setzen
IPS_SetName($VarID_Programm, "Programm"); // Name setzen
# RGBAutomatikFarbWert
$VarID_RGBAutomatikFarbWert = IPS_CreateVariable(3); // Variable erstellen
IPS_SetParent($VarID_RGBAutomatikFarbWert, $ParentID); // Einordnen in Objektbaum
IPS_SetName($VarID_RGBAutomatikFarbWert, "RGBAutomatikFarbWert"); // Name setzen
IPS_SetHidden($VarID_RGBAutomatikFarbWert ,true); //Objekt verstecken
# RGBManuellFarbWert
$VarID_RGBManuellFarbWert = IPS_CreateVariable(3); // Variable erstellen
IPS_SetParent($VarID_RGBManuellFarbWert, $ParentID); // Einordnen in Objektbaum
IPS_SetName($VarID_RGBManuellFarbWert, "RGBManuellFarbWert"); // Name setzen
IPS_SetHidden($VarID_RGBManuellFarbWert ,true); //Objekt verstecken
SetvalueString($VarID_RGBManuellFarbWert, "FF0000");
# DeviceID Hex
$VarID_DeviceIDHex = IPS_CreateVariable(3); // Variable erstellen
IPS_SetParent($VarID_DeviceIDHex, $ParentID); // Einordnen in Objektbaum
IPS_SetName($VarID_DeviceIDHex, "DeviceID Hex"); // Name setzen
SetvalueString($VarID_DeviceIDHex, $IDDeviceIDHex);
IPS_SetHidden($VarID_DeviceIDHex ,true); //Objekt verstecken
# Device Net
$VarID_DeviceNET = IPS_CreateVariable(1); // Variable erstellen
IPS_SetParent($VarID_DeviceNET, $ParentID); // Einordnen in Objektbaum
IPS_SetName($VarID_DeviceNET, "Net"); // Name setzen
IPS_SetHidden($VarID_DeviceNET ,true); //Objekt verstecken
SetValueInteger($VarID_DeviceNET, $IDNet); // Netz Eintragen
# Chromoflexprofilname
$VarID_Chromoflexprofilname = IPS_CreateVariable(3); // Variable erstellen
IPS_SetParent($VarID_Chromoflexprofilname, $ParentID); // Einordnen in Objektbaum
IPS_SetName($VarID_Chromoflexprofilname, "Chromoflexprofilname"); // Name setzen
IPS_SetHidden($VarID_Chromoflexprofilname ,true); //Objekt verstecken
SetvalueString($VarID_Chromoflexprofilname, $Chromoflexprofilname);
# 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, "Color Picker"); // Name setzen
SetvalueString($VarID_ImagePicker, '<iframe src="user/imagepicker/imageColorPicker.php?idDeviceID='.$VarID_DeviceIDHex.'&idNet='.$VarID_DeviceNET.'&idchromoscript='.$IDChromoflexIIIRCSteuerscript.'&idrgbfader='.$VarID_RGBFader.'&iddimmer='.$VarID_Dimmer.'&idprogramm='.$VarID_Programm.'&idFesteFarben='.$VarID_FesteFarben.'&idRGBAutomatikFarbWert='.$VarID_RGBAutomatikFarbWert.'&idRGBManuellFarbWert='.$VarID_RGBManuellFarbWert.'&idProfilname='.$VarID_Chromoflexprofilname.'" 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_Dimmer, 4);
IPS_SetPosition($VarID_Programm, 5);
IPS_SetPosition($VarID_RGBAutomatikFarbWert, 6);
IPS_SetPosition($VarID_RGBManuellFarbWert, 7);
IPS_SetPosition($VarID_DeviceIDHex, 8);
IPS_SetPosition($VarID_DeviceNET, 9);
IPS_SetPosition($VarID_Chromoflexprofilname, 10);
// 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 = 'HauptscriptRGBSteuerung';
$ScriptIDHauptscriptRGBSteuerung = CreateScriptByName($ScriptNAME,$ParentID, // Funktionsaufruf und Scrip Erstellung
'<?
// v2.0 10.01.2012 Autor: NickBlue für IPS 2.5
//
/*********** Ab hier nichts mehr verändern *************///
// Konstanten definieren.
define("DeviceID", '.$VarID_DeviceIDHex.' /*in Hex*/, true); // ID der Variable des ChromoFlex Controllers
define("Net", '.$VarID_DeviceNET.' /**/, true); // ID der Variable des ChromoFlex Netz
define("idchromoscript", '.$IDChromoflexIIIRCSteuerscript.' /**/, true); // ID des ChromoFlex Steuerscripts
define("WebFrontCFID",'.$IDWebfrontConfigurator.' /**/, true); // ID des WebFrontconfigurators
define("dimmer", '.$VarID_Dimmer.' /**/, true); // ID der Variable DIMMER
define("programm", '.$VarID_Programm.' /**/, true); // ID der Variable PROGRAMM (Programme kommen von 1-18)
define("rgbfader", '.$VarID_RGBFader.' /**/, true); // ID der Variable RGB Steuerung mit dem HEXCOLOR Profil
define("HerstellerFarben",'.$VarID_FesteFarben.' /**/, true); // ID der Variable Festen Farb Buttons
define("RGBAutomatikFarbWert",'.$VarID_RGBAutomatikFarbWert.' /**/, true); // ID der Variable RGBAutomatikFarbWert speichert den Auto Wert
define("RGBManuellFarbWert",'.$VarID_RGBManuellFarbWert.' /**/, true); // ID der Variable RGBManuellFarbWert speichert den Manueel Wert
define("Chromoflexprofilname",'.$VarID_Chromoflexprofilname.' /**/, true); // ID der Variable Chromoflexprofilname
//*** 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(RGBManuellFarbWert));
// Variablenwerte einlesen
$DeviceID = GetValue(DeviceID);
$Net = GetValue(Net);
$idchromoscript = idchromoscript;
$HerstellerFarben = GetValue(HerstellerFarben);
$RGBAutomatikFarbWert = GetValue(RGBAutomatikFarbWert);
$RGBManuellFarbWert = GetValue(RGBManuellFarbWert);
$programm = GetValue(programm);
$dimmer = GetValue(dimmer);
$Chromoflexprofilname = GetValue(Chromoflexprofilname);
$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 ChromoflexRC_SetPalColor($idchromoscript, $Net, $DeviceID, $palColor, $dimmer)
{
global $cf_color_table;
IPS_RunScriptEx($idchromoscript, Array("Net" => $Net, "DeviceID" => "$DeviceID", "Action"=>"SetColor", "R"=> $cf_color_table[$palColor][0], "G" => $cf_color_table[$palColor][1], "B" => $cf_color_table[$palColor][2], "D" => $dimmer));
}
// 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 (RGBAutomatikFarbWert, GetValueFormatted(rgbfader)); // Farbe für Autmatik speichern
$Profilcolor = GetValueFormatted(rgbfader);
IPS_SetVariableProfileAssociation("$Chromoflexprofilname", 100, "Auto","",hexdec($Profilcolor));
WFC_SendNotification(WebFrontCFID, "Farbänderung", "<p>Die Farbe für die Automatik wurde geändert.</p><table width=\"200\" height=\"80px\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td bgcolor=\"#".GetValueFormatted(rgbfader)."\"> </td></tr></table>", "RGB",4);
break;
// *** Feste Farben Buttens *** ///
case (HerstellerFarben):
SetValue (RGBAutomatikFarbWert, $cf_color_table[$HerstellerFarben][3]); // Farbe für Autmatik speichern
SetValue(rgbfader, hexdec ($cf_color_table[$HerstellerFarben][3]));
WFC_SendNotification(WebFrontCFID, "Farbänderung","<p>Die Farbe für die Automatik wurde auf ".$cf_color_table[$HerstellerFarben][4]." geändert.</p><table width=\"200\" height=\"80px\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td bgcolor=\"#".$cf_color_table[$HerstellerFarben][3]."\"> </td></tr></table>", "RGB",4);
IPS_SetVariableProfileAssociation("$Chromoflexprofilname", 100, "Auto","",hexdec($cf_color_table[$HerstellerFarben][3]));
break;
// *** Programmwahl *** ///
case (programm):
SetValue(HerstellerFarben, 99);
SetValue(rgbfader, hexdec($RGBAutomatikFarbWert));
WFC_SendNotification(WebFrontCFID, "Automatik","Um die Farbe für die Automatik zu ändern, einfach den RGB Fader, Picker oder Farbfelder nutzen. Die Farbe wird gespeichert.", "RGB",12);
break;
}
}
else // Wen Automatik aus
{
switch ($IPS_VARIABLE)
{
// *** RGB Colorfader ****///
case (rgbfader):
$farb_rgb = hex2rgb(GetValueFormatted(rgbfader));
IPS_RunScriptEx(idchromoscript, Array("Net" => $Net, "DeviceID" => "$DeviceID", "Action"=>"SetColor", "R"=> $rot, "G" => $gruen, "B" => $blau, "D" => $dimmer));
SetValue(programm, 99); // Programm auf Manuell umschalten
SetValue(HerstellerFarben, 99); // HerstellerFarben auf Manuell umschalten
SetValue (RGBManuellFarbWert, GetValueFormatted(rgbfader)); // Farbe für Manuell speichern
$Profilcolor = GetValueFormatted(rgbfader);
IPS_SetVariableProfileAssociation("$Chromoflexprofilname", 99, "Manuell","",hexdec($Profilcolor)); // Profilfarbe setzen
break;
// *** Programmwahl *** ///
case (programm):
if ($IPS_VALUE < 50) // Hersteller Programm
{
IPS_RunScriptEx(idchromoscript, Array("Net" => $Net, "DeviceID" => "$DeviceID", "Action"=>"SetProgram", "P"=> $programm,"D"=>"$dimmer"));
SetValue(HerstellerFarben, 99);
SetValue(rgbfader, 0);
}
if ($IPS_VALUE == 99) // Manuell ausgewählt
{
SetValue(rgbfader, hexdec($RGBManuellFarbWert));
$farb_rgb = hex2rgb($RGBManuellFarbWert);
IPS_RunScriptEx(idchromoscript, Array("Net" => $Net, "DeviceID" => "$DeviceID", "Action"=>"SetColor", "R"=> $rotmanuell, "G" => $gruenmanuell, "B" => $blaumanuell, "D" => $dimmer));
}
break;
// *** Feste Farben Buttens *** ///
case (HerstellerFarben):
if ($HerstellerFarben < 99)
{
$funktionsreturn = ChromoflexRC_SetPalColor($idchromoscript, $Net, $DeviceID, $HerstellerFarben, $dimmer);// Funktionsaufruf anhand des gedrückten Buttens HerstellerFarben im WebFront.
SetValue(programm, 99);
SetValue(rgbfader, hexdec ($cf_color_table[$HerstellerFarben][3]));
$Profilcolor = $cf_color_table[$HerstellerFarben][3];
IPS_SetVariableProfileAssociation("$Chromoflexprofilname", 99, "Manuell","",hexdec($Profilcolor)); // Profilfarbe setzen
SetValue (RGBManuellFarbWert, $cf_color_table[$HerstellerFarben][3]); // Farbe für Manuell speichern
}
break;
// *** Dimmer Manuell *** ///
case (dimmer):
if ($programm == 99)
{
IPS_RunScriptEx(idchromoscript, Array("Net" => $Net, "DeviceID" => "$DeviceID", "Action"=>"SetColor", "R"=> $rot, "G" => $gruen, "B" => $blau, "D" => $dimmer));
}
elseif ($programm < 99)
{
IPS_RunScriptEx(idchromoscript, Array("Net" => $Net, "DeviceID" => "$DeviceID", "Action"=>"SetProgram", "P"=> $programm, "D"=>"$dimmer"));
}
break;
}
}
?>'
);
// Script den Variablen zuweisen
IPS_SetVariableCustomAction($VarID_Dimmer, $ScriptIDHauptscriptRGBSteuerung); // Script zuweisen
IPS_SetVariableCustomAction($VarID_Programm, $ScriptIDHauptscriptRGBSteuerung); // Script zuweisen
IPS_SetVariableCustomAction($VarID_RGBFader, $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 /> Gruß NickBlue
</p>
<p><br />Dieses Script kann gelöscht werden</p>";
?>
- Im Installationsscript müssen die IDs des Chromoflex Scripts, DeviceID, NetzID und WebfrontConfigurator ID eingetragen werden-
- Installationsscript ausführen. Es kann nach dem ausführen gelöscht werden
Jetzt sollten alle Variablen angelegt sein und schon fertig konfiguriert. - Bei Belieben das Installationsscript löschen.
Fertig
Upgrate:
Von 1.4 nach 2.0 ist eine Neuinstallation erforderlich.!!
Automatik
Bei mir nutze ich die Auto Funktion um nachts per Bewegungsmelder die RGB LEDs zu schallten um nicht von meinen 12 x 60Leds Downlights erschlagen zu werden.
<?
// Konstanten definieren.
define("DeviceID", 33808 /*in Hex*/, true); // ID der Variable des ChromoFlex Controllers
define("Net", 33137 /**/, true); // ID der Variable des ChromoFlex Netz
define("idchromoscript", 32839 /**/, true); // ID des ChromoFlex Steuerscripts
define("WebFrontCFID",25147 /**/, true); // ID des WebFrontconfigurators
define("dimmer", 47298 /**/, true); // ID der Variable DIMMER
define("programm", 32322 /**/, true); // ID der Variable PROGRAMM (Programme kommen von 1-18)
define("rgbfader", 27671 /**/, true); // ID der Variable RGB Steuerung mit dem HEXCOLOR Profil
define("HerstellerFarben",29506 /**/, true); // ID der Variable Festen Farb Buttons
define("RGBAutomatikFarbWert",58299 /**/, true); // ID der Variable RGBAutomatikFarbWert speichert den Auto Wert
define("RGBManuellFarbWert",55703 /**/, true); // ID der Variable RGBManuellFarbWert speichert den Manueel Wert
// Variablendevinition
$farb_rgb = hex2rgb (GetValue(RGBAutomatikFarbWert));
$rot = $farb_rgb[0];
$gruen = $farb_rgb[1];
$blau = $farb_rgb[2];
$programm = GetValue(programm);
$dimmer = GetValue(dimmer);
// 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;
}
// RGB LED im Flur für 20 sek einschalten
if($IPS_SENDER == "TimerEvent") // Wenn das Script durch den Timer getriggert wird.
{
if ($programm == 100) // ist automatik eingeschaltet
{
//Aus Befehl mit Fade auf Null
IPS_RunScriptEx(idchromoscript, Array("Action"=>"SetColor", "R"=> 0, "G" => 0, "B" => 0, "D" => 0));
IPS_SetScriptTimer($IPS_SELF, 0);
}
}
else
{
if ($programm == 100) // ist automatik eingeschaltet
{
//An Befehl mit Fader
IPS_RunScriptEx(idchromoscript, Array("Action"=>"SetColor", "R"=> $rot, "G" => $gruen, "B" => $blau, "D" => $dimmer));
//Timer anschalten
IPS_SetScriptTimer($IPS_SELF, 40);
}
}
?>
Viel Spaß damit euer NickBlue
Der Ursrung des Themas
imagepicker.zip (670 KB)