commit b5d983cd925b0c76d0d06b125f32962aa651f274 Author: jhartworks Date: Mon Jun 22 15:38:18 2026 +0200 first com diff --git a/RoomcontrolerHeating/form.json b/RoomcontrolerHeating/form.json new file mode 100644 index 0000000..5800bbf --- /dev/null +++ b/RoomcontrolerHeating/form.json @@ -0,0 +1,16 @@ +{ + "elements": + [ + { "type": "SelectVariable", "name": "PropertyCalctemp", "caption": "Sollwert errechnet", "validVariableTypes": [2], "requiredAction": 1} + + + ], + "actions": + [ + + ], + "status": + [ + + ] +} \ No newline at end of file diff --git a/RoomcontrolerHeating/module.json b/RoomcontrolerHeating/module.json new file mode 100644 index 0000000..adc75c7 --- /dev/null +++ b/RoomcontrolerHeating/module.json @@ -0,0 +1,14 @@ +{ + "id": "{FF28E5FF-27E5-AAF9-28C8-B99A707756E9}", + "name": "RoomcontrolerHeating", + "type": 3, + "vendor": "J.H. Artworks", + "aliases": + [ + ], + "url": "https://jh-artworks.com", + "parentRequirements": [], + "childRequirements": [], + "implemented": [], + "prefix": "RCH" +} \ No newline at end of file diff --git a/RoomcontrolerHeating/module.php b/RoomcontrolerHeating/module.php new file mode 100644 index 0000000..2c090db --- /dev/null +++ b/RoomcontrolerHeating/module.php @@ -0,0 +1,197 @@ +createClockprofile(); + $this->createRoomstateprofile(); + $this->createRoommodeprofile(); + + $this->RegisterPropertyInteger("PropertyComforttemp",12345); + $this->RegisterPropertyInteger("PropertyReducetemp",12345); + $this->RegisterPropertyInteger("PropertyCalctemp",12345); + + SetValue($this->RegisterVariableInteger("Mode", "Modus","Raummodus",0),1); + $this->EnableAction("Mode"); + + SetValue($this->RegisterVariableInteger("State", "Status","Raumstatus",10),1); + + + + $this->RegisterVariableBoolean("Clock", "Schaltuhrenkanal","Schaltuhr",50); + $this->EnableAction("Clock"); + SetValue($this->RegisterVariableFloat("Comforttemp", "Komforttemperatur","~Temperature.Room",60),22); + $this->EnableAction("Comforttemp"); + SetValue($this->RegisterVariableFloat("Reducetemp", "Absenktemperatur","~Temperature.Room",70),17); + $this->EnableAction("Reducetemp"); + + $this->createSchedule(); + $this->RegisterTimer("Update", 0, 'RCH_controlRoom('.$this->InstanceID.');'); + } + + // Überschreibt die intere IPS_ApplyChanges($id) Funktion + public function ApplyChanges() { + // Diese Zeile nicht löschen + parent::ApplyChanges(); + + $this->SetTimerInterval("Update", 10 * 1000); + + } + /** + * Die folgenden Funktionen stehen automatisch zur Verfügung, wenn das Modul über die "Module Control" eingefügt wurden. + * Die Funktionen werden, mit dem selbst eingerichteten Prefix, in PHP und JSON-RPC wiefolgt zur Verfügung gestellt: + * + * + */ + public function createClockprofile(){ + if(!IPS_VariableProfileExists ("Schaltuhr") ){ + + IPS_CreateVariableProfile("Schaltuhr", 0); + IPS_SetVariableProfileAssociation("Schaltuhr", true, "Schaltuhr EIN", "", 0x00FF00); + IPS_SetVariableProfileAssociation("Schaltuhr", false, "Schaltuhr AUS", "", 0xFF0000); + + } + } + + public function createRoomstateprofile(){ + if(!IPS_VariableProfileExists ("Raumstatus") ){ + + IPS_CreateVariableProfile("Raumstatus", 1); + IPS_SetVariableProfileDigits ("Raumstatus", 0); + IPS_SetVariableProfileValues("Raumstatus", 1, 30, 0); + IPS_SetVariableProfileAssociation("Raumstatus", 5, "Frostschutz", "", 0xFF0000); + IPS_SetVariableProfileAssociation("Raumstatus", 10, "Ferien", "", 0xFFFF00); + IPS_SetVariableProfileAssociation("Raumstatus", 20, "Absenkbetrieb", "", -1); + IPS_SetVariableProfileAssociation("Raumstatus", 30, "Komfortbetrieb", "", -1); + + } + } + public function createRoommodeprofile(){ + if(!IPS_VariableProfileExists ("Raummodus") ){ + + IPS_CreateVariableProfile("Raummodus", 1); + IPS_SetVariableProfileDigits ("Raummodus", 0); + IPS_SetVariableProfileValues("Raummodus", 1, 30, 0); + IPS_SetVariableProfileAssociation("Raummodus", 1, "Automatik", "", -1); + IPS_SetVariableProfileAssociation("Raummodus", 5, "Frostschutz", "", 0xFF0000); + IPS_SetVariableProfileAssociation("Raummodus", 10, "Ferien", "", 0xFFFF00); + IPS_SetVariableProfileAssociation("Raummodus", 20, "DAUER Absenkbetrieb", "", 0xFFFF00); + IPS_SetVariableProfileAssociation("Raummodus", 30, "DAUER Komfortbetrieb", "", 0xFFFF00); + + } + } + public function RequestAction($Ident, $Value) { + $varid = $this->GetIDForIdent($Ident); + SetValue($varid, $Value); + + + $this->controlRoom(); + } + public function createSchedule(){ + if (!@IPS_GetEventIDByName("Schaltuhr",$this->InstanceID)){ + $EventID= IPS_CreateEvent(2); + IPS_SetName($EventID,"Schaltuhr"); + IPS_SetParent($EventID,$this->InstanceID); + IPS_SetPosition($EventID,40); + IPS_SetEventActive($EventID, true); // Activates the event + $clockid = $this->GetIDForIdent("Clock"); + IPS_SetEventScheduleAction($EventID, 2, "Uhr AUS", 16731202, "RequestAction(".$clockid.",false);"); + IPS_SetEventScheduleAction($EventID, 1, "Uhr EIN", 10020520, "RequestAction(".$clockid.",true);"); + IPS_SetEventScheduleGroup($EventID, 0, 1); + IPS_SetEventScheduleGroup($EventID, 1, 2); + IPS_SetEventScheduleGroup($EventID, 2, 4); + IPS_SetEventScheduleGroup($EventID, 3, 8); + IPS_SetEventScheduleGroup($EventID, 4, 16); + IPS_SetEventScheduleGroup($EventID, 5, 32); + IPS_SetEventScheduleGroup($EventID, 6, 64); + + IPS_SetEventScheduleGroupPoint($EventID, 0, 0, 0, 0, 0, 2); + IPS_SetEventScheduleGroupPoint($EventID, 0, 1, 8, 0, 0, 1); + IPS_SetEventScheduleGroupPoint($EventID, 0, 2, 20, 0, 0, 2); + + IPS_SetEventScheduleGroupPoint($EventID, 1, 0, 0, 0, 0, 2); + IPS_SetEventScheduleGroupPoint($EventID, 1, 1, 8, 0, 0, 1); + IPS_SetEventScheduleGroupPoint($EventID, 1, 2, 20, 0, 0, 2); + + IPS_SetEventScheduleGroupPoint($EventID, 2, 0, 0, 0, 0, 2); + IPS_SetEventScheduleGroupPoint($EventID, 2, 1, 8, 0, 0, 1); + IPS_SetEventScheduleGroupPoint($EventID, 2, 2, 20, 0, 0, 2); + + IPS_SetEventScheduleGroupPoint($EventID, 3, 0, 0, 0, 0, 2); + IPS_SetEventScheduleGroupPoint($EventID, 3, 1, 8, 0, 0, 1); + IPS_SetEventScheduleGroupPoint($EventID, 3, 2, 20, 0, 0, 2); + + IPS_SetEventScheduleGroupPoint($EventID, 4, 0, 0, 0, 0, 2); + IPS_SetEventScheduleGroupPoint($EventID, 4, 1, 8, 0, 0, 1); + IPS_SetEventScheduleGroupPoint($EventID, 4, 2, 20, 0, 0, 2); + + IPS_SetEventScheduleGroupPoint($EventID, 5, 0, 0, 0, 0, 2); + IPS_SetEventScheduleGroupPoint($EventID, 5, 1, 9, 0, 0, 1); + IPS_SetEventScheduleGroupPoint($EventID, 5, 2, 19, 0, 0, 2); + + //IPS_SetEventScheduleGroupPoint($EventID, 6, 0, 0, 0, 0, 2); + //IPS_SetEventScheduleGroupPoint($EventID, 6, 1, 0, 0, 0, 1); + + } + + } + + public function controlRoom(){ + $calcId = $this->ReadPropertyInteger("PropertyCalctemp"); + $mode = GetValue($this->GetIDForIdent("Mode")); + $clock = GetValue($this->GetIDForIdent("Clock")); + + switch ($mode){ + case 1: + if ($clock == true){ + + if (IPS_VariableExists($calcId)){ + RequestAction($calcId,$this->GetValue("Comforttemp")); + SetValueInteger($this->GetIDForIdent("State"),30); + } + + }else{ + if (IPS_VariableExists($calcId)){ + RequestAction($calcId,$this->GetValue("Reducetemp")); + SetValueInteger($this->GetIDForIdent("State"),20); + } + } + break; + case 5: + if (IPS_VariableExists($calcId)){ + RequestAction($calcId,5); + SetValueInteger($this->GetIDForIdent("State"),5); + } + break; + case 10: + if (IPS_VariableExists($calcId)){ + RequestAction($calcId,$this->GetValue("Reducetemp")-3); + SetValueInteger($this->GetIDForIdent("State"),10); + } + break; + + case 20: + if (IPS_VariableExists($calcId)){ + RequestAction($calcId,$this->GetValue("Reducetemp")); + SetValueInteger($this->GetIDForIdent("State"),20); + } + break; + case 30: + if (IPS_VariableExists($calcId)){ + RequestAction($calcId,$this->GetValue("Comforttemp")); + SetValueInteger($this->GetIDForIdent("State"),30); + } + break; + + } + + + + } + + +} + +?> \ No newline at end of file diff --git a/library.json b/library.json new file mode 100644 index 0000000..2b5eaf6 --- /dev/null +++ b/library.json @@ -0,0 +1,13 @@ +{ + "id": "{47E5AB94-B8E3-F869-343B-037D159E5E5E}", + "author": "J.H. Artworks", + "name": "RoomControl", + "url": "https://jh-artworks.com", + "compatibility": { + "version": "6.0", + "date": 1491343200 + }, + "version": "1.1", + "build": 1, + "date": 0 +} \ No newline at end of file