diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 23ef350..9210c30 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -9,8 +9,8 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 7.4 + php-version: 8.2 - name: Checkout module uses: actions/checkout@master - name: Check style - uses: Nall-chan/action-style@master + uses: Nall-chan/action-style@strict diff --git a/.vscode b/.vscode index 672a096..53a482b 160000 --- a/.vscode +++ b/.vscode @@ -1 +1 @@ -Subproject commit 672a096abc8fcc6afa43f4aedd47821b5583b4c5 +Subproject commit 53a482b4bb3bed8ae533487145b93c70e0b4c472 diff --git a/ClimacontrolRegulator/form.json b/ClimacontrolRegulator/form.json index d690049..32a0c54 100644 --- a/ClimacontrolRegulator/form.json +++ b/ClimacontrolRegulator/form.json @@ -5,6 +5,18 @@ "type": "ValidationTextBox", "caption": "Address" }, + { + "type": "ExpansionPanel", + "caption": "General", + "expanded": true, + "items": [ + { + "name": "SetPointBehavior", + "type": "CheckBox", + "caption": "Changing the target temperature sets the mode to manual" + } + ] + }, { "type": "ExpansionPanel", "caption": "Schedule", diff --git a/ClimacontrolRegulator/locale.json b/ClimacontrolRegulator/locale.json index 26e019c..29d3622 100644 --- a/ClimacontrolRegulator/locale.json +++ b/ClimacontrolRegulator/locale.json @@ -2,11 +2,13 @@ "translations": { "de": { "Address": "Adresse", + "General": "Allgemein", + "Changing the target temperature sets the mode to manual": "Verändern der Solltemperatur setzt Modus auf Manuell", "Optional status variables": "Optionale Statusvariablen", "Schedule": "Zeitplan", "Schedule save": "Zeitplan speichern", "Temperature": "Temperatur", - "Setpoint temperature": "Solltemperatur", + "Target temperature": "Solltemperatur", "Operation mode": "Betriebsart", "Automatic": "Automatik", "Manually": "Manuell", diff --git a/ClimacontrolRegulator/module.php b/ClimacontrolRegulator/module.php index fc69f90..3e01bb5 100644 --- a/ClimacontrolRegulator/module.php +++ b/ClimacontrolRegulator/module.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @file module.php @@ -11,7 +11,7 @@ * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 * - * @version 3.70 + * @version 3.71 */ require_once __DIR__ . '/../libs/HMHeatingDevice.php'; // HMBase Klasse @@ -28,10 +28,11 @@ class HomeMaticClimateControlRegulator extends HMHeatingDevice protected const WeekScheduleIndexTemp = 'TEMPERATUR_%2$s_%1$d'; protected const WeekScheduleIndexEndTime = 'TIMEOUT_%2$s_%1$d'; protected const NumberOfTimeSlot = 24; + /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); @@ -45,9 +46,10 @@ public function Create() /** * Interne Funktion des SDK. */ - public function RequestAction($Ident, $Value) + public function RequestAction(string $Ident, mixed $Value, bool &$done = false): void { - if (parent::RequestAction($Ident, $Value)) { + parent::RequestAction($Ident, $Value, $done); + if ($done) { return; } if (array_key_exists($Ident, \HMExtended\ValuesSet::$Variables[static::DeviceTyp])) { @@ -56,8 +58,10 @@ public function RequestAction($Ident, $Value) $SendValue = $Value; switch ($Ident) { case \HMExtended\ClimacontrolRegulator::SETPOINT: - if ($this->GetValue(\HMExtended\ClimacontrolRegulator::MODE_TEMPERATUR_REGULATOR) != 0) { - $this->PutParamSet([\HMExtended\ClimacontrolRegulator::MODE_TEMPERATUR_REGULATOR => 0], true); + if ($this->ReadPropertyBoolean(\HMExtended\Device\Property::SetPointBehavior)) { + if ($this->GetValue(\HMExtended\ClimacontrolRegulator::MODE_TEMPERATUR_REGULATOR) != 0) { + $this->PutParamSet([\HMExtended\ClimacontrolRegulator::MODE_TEMPERATUR_REGULATOR => 0], true); + } } break; } @@ -121,7 +125,7 @@ public function RequestAction($Ident, $Value) return; } - protected function SetParamVariables(array $Params) + protected function SetParamVariables(array $Params): void { $d = new DateTime(); $d->setTime( @@ -142,17 +146,6 @@ protected function SetParamVariables(array $Params) $Params[\HMExtended\ClimacontrolRegulator::PARTY_END_TIME] = $d->add($i)->getTimestamp(); parent::SetParamVariables($Params); } - - protected function SetVariable(string $Ident, $Value) - { - parent::SetVariable($Ident, $Value); - switch ($Ident) { - case \HMExtended\ClimacontrolRegulator::SETPOINT: - IPS_RunScriptText('IPS_RequestAction(' . $this->InstanceID . ',"getParam",0);'); - break; - } - } - //################# PRIVATE } /* @} */ diff --git a/DisplayStatusAnzeige/module.php b/DisplayStatusAnzeige/module.php index f88c97c..53f13e5 100644 --- a/DisplayStatusAnzeige/module.php +++ b/DisplayStatusAnzeige/module.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @file module.php @@ -11,7 +11,7 @@ * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 * - * @version 3.70 + * @version 3.71 */ require_once __DIR__ . '/../libs/HMBase.php'; // HMBase Klasse @@ -41,11 +41,11 @@ class HomeMaticDisWM55 extends HMBase /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); - $this->RegisterHMPropertys('XXX9999995'); + $this->RegisterHMProperties('XXX9999995'); $this->RegisterPropertyBoolean(\HMExtended\Device\Property::EmulateStatus, false); $this->RegisterPropertyInteger('PageUpID', 0); $this->RegisterPropertyInteger('PageDownID', 0); @@ -77,12 +77,12 @@ public function Create() /** * Nachrichten aus der Nachrichtenschlange verarbeiten. * - * @param int $TimeStamp - * @param int $SenderID - * @param int $Message - * @param array|int $Data + * @param int $TimeStamp + * @param int $SenderID + * @param int $Message + * @param array $Data */ - public function MessageSink($TimeStamp, $SenderID, $Message, $Data) + public function MessageSink(int $TimeStamp, int $SenderID, int $Message, array $Data): void { parent::MessageSink($TimeStamp, $SenderID, $Message, $Data); switch ($Message) { @@ -107,7 +107,7 @@ public function MessageSink($TimeStamp, $SenderID, $Message, $Data) /** * Interne Funktion des SDK. */ - public function ApplyChanges() + public function ApplyChanges(): void { parent::ApplyChanges(); $this->SetNewConfig(); @@ -118,7 +118,7 @@ public function ApplyChanges() /** * Interne Funktion des SDK. */ - public function ReceiveData($JSONString) + public function ReceiveData(string $JSONString): string { $Data = json_decode($JSONString); unset($Data->DataID); @@ -127,15 +127,16 @@ public function ReceiveData($JSONString) $ReceiveData = ['HMDeviceAddress' => (string) $Data->DeviceID, 'HMDeviceDatapoint' => (string) $Data->VariableName]; $Action = array_search($ReceiveData, $this->HMEventData); if ($Action === false) { - return; + return ''; } $this->RunDisplayScript($Action); + return ''; } /** * Wird bei einem timeout ausgeführt und setzt die aktuelle Seite wieder auf Null. */ - public function ResetTimer() + public function ResetTimer(): void { $this->Page = 0; $this->SetTimerInterval('DisplayTimeout', 0); @@ -146,7 +147,7 @@ public function ResetTimer() /** * Wird ausgeführt wenn der Kernel hochgefahren wurde. */ - protected function KernelReady() + protected function KernelReady(): void { $this->ApplyChanges(); } @@ -154,7 +155,7 @@ protected function KernelReady() /** * Wird ausgeführt wenn sich der Status vom Parent ändert. */ - protected function IOChangeState($State) + protected function IOChangeState(int $State): void { if ($State == IS_ACTIVE) { $this->ApplyChanges(); @@ -165,7 +166,7 @@ protected function IOChangeState($State) /** * Überführt die Config in die Filter. */ - private function SetNewConfig() + private function SetNewConfig(): void { if (IPS_GetKernelRunlevel() == KR_READY) { if ($this->CheckConfig()) { @@ -198,7 +199,7 @@ private function SetNewConfig() * * @return bool True wenn Konfig ok, sonst false. */ - private function CheckConfig() + private function CheckConfig(): bool { $Result = true; $OldHMEventDatas = $this->HMEventData; @@ -277,7 +278,7 @@ private function CheckConfig() * * @return array|bool Array mit den Daten zum Datenpunkt. False im Fehlerfall. */ - private function GetDisplayAddress(int $EventID) + private function GetDisplayAddress(int $EventID): false|array { if (!IPS_VariableExists($EventID)) { return false; @@ -299,7 +300,7 @@ private function GetDisplayAddress(int $EventID) * * @throws Exception Wenn CCU nicht erreicht wurde. */ - private function RunDisplayScript($Action) + private function RunDisplayScript(string $Action): void { $Page = $this->Page; $MaxPage = $this->ReadPropertyInteger('MaxPage'); @@ -347,11 +348,11 @@ private function RunDisplayScript($Action) /** * Konvertiert die Daten in ein für das Display benötigte Format. * - * @param object $Data Enthält die Daten für das Display + * @param object[] $Data Enthält die Daten für das Display * * @return string Die konvertierten Daten als String. */ - private function ConvertDisplayData($Data) + private function ConvertDisplayData(array $Data): string { $SendData = '0x02'; foreach ($Data as $Line) { @@ -380,7 +381,7 @@ private function ConvertDisplayData($Data) * * @return string */ - private function CreateDisplayScript() + private function CreateDisplayScript(): string { return file_get_contents(__DIR__ . '/Display-Taster-Script-Vorlage.php'); } diff --git a/ExtendedConfigurator/module.php b/ExtendedConfigurator/module.php index efecd94..95a21d4 100644 --- a/ExtendedConfigurator/module.php +++ b/ExtendedConfigurator/module.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @file module.php @@ -11,7 +11,7 @@ * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 * - * @version 3.70 + * @version 3.71 */ require_once __DIR__ . '/../libs/HMBase.php'; // HMBase Klasse require_once __DIR__ . '/../libs/HMTypes.php'; // HMTypes Data @@ -28,10 +28,10 @@ class HomeMaticExtendedConfigurator extends HMBase /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); - $this->RegisterHMPropertys('XXX9999994'); + $this->RegisterHMProperties('XXX9999994'); $this->RegisterPropertyBoolean(\HMExtended\Device\Property::EmulateStatus, false); $this->RegisterPropertyInteger('Interval', 0); } @@ -39,7 +39,7 @@ public function Create() /** * Interne Funktion des SDK. */ - public function ApplyChanges() + public function ApplyChanges(): void { parent::ApplyChanges(); } @@ -48,7 +48,7 @@ public function ApplyChanges() /** * Interne Funktion des SDK. */ - public function GetConfigurationForm() + public function GetConfigurationForm(): string { $Form = json_decode(file_get_contents(__DIR__ . '/form.json'), true); if ($this->GetStatus() == IS_CREATING) { @@ -97,7 +97,7 @@ public function GetConfigurationForm() } //################# protected - protected function GetInstanceList(string $GUID, string $ConfigParam = null) + protected function GetInstanceList(string $GUID, string $ConfigParam = null): array { $InstanceIDList = array_filter(IPS_GetInstanceListByModuleID($GUID), [$this, 'FilterInstances']); if ($ConfigParam != null) { @@ -107,17 +107,17 @@ protected function GetInstanceList(string $GUID, string $ConfigParam = null) return $InstanceIDList; } - protected function FilterInstances(int $InstanceID) + protected function FilterInstances(int $InstanceID): bool { return IPS_GetInstance($InstanceID)['ConnectionID'] == $this->ParentID; } - protected function GetConfigParam(&$item1, $InstanceID, $ConfigParam) + protected function GetConfigParam(mixed &$item1, int $InstanceID, string $ConfigParam): void { $item1 = IPS_GetProperty($InstanceID, $ConfigParam); } - private function GetConfigRows(int $Protocol, string $GUID) + private function GetConfigRows(int $Protocol, string $GUID): array { $CreateParams = [ 'moduleID' => $GUID, @@ -162,7 +162,7 @@ private function GetConfigRows(int $Protocol, string $GUID) return $Devices; } - private function GetDeviceData(int $Protocol, array &$Device) + private function GetDeviceData(int $Protocol, array &$Device): void { $InterfaceString = \HMExtended\CCU::$Interfaces[$Protocol]; if (isset($this->DeviceData[$InterfaceString][$Device['address']])) { @@ -181,7 +181,7 @@ private function GetDeviceData(int $Protocol, array &$Device) } } - private function GetDevices(int $Protocol, array $Types) + private function GetDevices(int $Protocol, array $Types): array { if (!array_key_exists($Protocol, $this->listDevices)) { $Devices = $this->SendRPC('listDevices', $Protocol, []); @@ -206,7 +206,7 @@ private function GetDevices(int $Protocol, array $Types) return array_values($Result); } - private function LoadDeviceData() + private function LoadDeviceData(): array { $Values = []; $Script = 'string did; string cid; string rid; @@ -245,7 +245,7 @@ private function LoadDeviceData() return $Values; } - private function SendRPC(string $MethodName, int $Protocol, array $Data) + private function SendRPC(string $MethodName, int $Protocol, array $Data): false|array { if (!$this->HasActiveParent()) { trigger_error($this->Translate('Instance has no active Parent Instance!'), E_USER_NOTICE); diff --git a/HeatingGroup/form.json b/HeatingGroup/form.json index c7e0327..02fb2b6 100644 --- a/HeatingGroup/form.json +++ b/HeatingGroup/form.json @@ -5,6 +5,18 @@ "type": "ValidationTextBox", "caption": "Address" }, + { + "type": "ExpansionPanel", + "caption": "General", + "expanded": true, + "items": [ + { + "name": "SetPointBehavior", + "type": "CheckBox", + "caption": "Changing the target temperature sets the mode to manual" + } + ] + }, { "type": "ExpansionPanel", "caption": "Schedule", diff --git a/HeatingGroup/locale.json b/HeatingGroup/locale.json index 9c25a6b..5f6a5f3 100644 --- a/HeatingGroup/locale.json +++ b/HeatingGroup/locale.json @@ -2,6 +2,8 @@ "translations": { "de": { "Address": "Adresse", + "General": "Allgemein", + "Changing the target temperature sets the mode to manual": "Verändern der Solltemperatur setzt Modus auf Manuell", "Optional status variables": "Optionale Statusvariablen", "Control": "Regelung", "Schedule": "Zeitplan", @@ -24,7 +26,7 @@ "Automatic": "Automatik", "Manually": "Manuell", "Boost": "Boost", - "Setpoint temperature": "Solltemperatur", + "Target temperature": "Solltemperatur", "Decalcification": "Entkalkung", "Decalcification day": "Entkalkung Wochentag", "Saturday": "Samstag", diff --git a/HeatingGroup/module.php b/HeatingGroup/module.php index da93e2a..b66faaf 100644 --- a/HeatingGroup/module.php +++ b/HeatingGroup/module.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @file module.php @@ -11,7 +11,7 @@ * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 * - * @version 3.70 + * @version 3.71 */ require_once __DIR__ . '/../libs/HMHeatingDevice.php'; // HMBase Klasse @@ -31,7 +31,7 @@ class HomeMaticHeatingGroup extends HMHeatingDevice /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); @@ -45,9 +45,10 @@ public function Create() /** * Interne Funktion des SDK. */ - public function RequestAction($Ident, $Value) + public function RequestAction(string $Ident, mixed $Value, bool &$done = false): void { - if (parent::RequestAction($Ident, $Value)) { + parent::RequestAction($Ident, $Value, $done); + if ($done) { return; } if (array_key_exists($Ident, \HMExtended\ValuesSet::$Variables[static::DeviceTyp])) { @@ -113,7 +114,12 @@ public function RequestAction($Ident, $Value) $Mode = $this->GetValue(\HMExtended\HeatingGroup::CONTROL_MODE); switch ($Mode) { case 0: - case 3: + if (!$this->ReadPropertyBoolean(\HMExtended\Device\Property::SetPointBehavior)) { + break; + } + // SetPoint change from Auto to Manually + // No break. Add additional comment above this line if intentional + case 3: //Abort Boost, change to Manually $Ident = \HMExtended\HeatingGroup::MANU_MODE; break; case 2: @@ -203,7 +209,7 @@ public function RequestAction($Ident, $Value) return; } - protected function SetParamVariables(array $Params) + protected function SetParamVariables(array $Params): void { $d = new DateTime(); $d->setTime( @@ -220,7 +226,7 @@ protected function SetParamVariables(array $Params) parent::SetParamVariables($Params); } - protected function SetVariable(string $Ident, $Value) + protected function SetVariable(string $Ident, mixed $Value): void { if ($this->ReadPropertyBoolean('enable_PARTY')) { switch ($Ident) { diff --git a/HeatingGroupHmIP/form.json b/HeatingGroupHmIP/form.json index de8743e..f2a0a57 100644 --- a/HeatingGroupHmIP/form.json +++ b/HeatingGroupHmIP/form.json @@ -5,6 +5,18 @@ "type": "ValidationTextBox", "caption": "Address" }, + { + "type": "ExpansionPanel", + "caption": "General", + "expanded": true, + "items": [ + { + "name": "SetPointBehavior", + "type": "CheckBox", + "caption": "Changing the target temperature sets the mode to manual" + } + ] + }, { "type": "ExpansionPanel", "caption": "Schedule", diff --git a/HeatingGroupHmIP/locale.json b/HeatingGroupHmIP/locale.json index 6675a2c..0402f47 100644 --- a/HeatingGroupHmIP/locale.json +++ b/HeatingGroupHmIP/locale.json @@ -2,6 +2,8 @@ "translations": { "de": { "Address": "Adresse", + "General": "Allgemein", + "Changing the target temperature sets the mode to manual": "Verändern der Solltemperatur setzt Modus auf Manuell", "Optional status variables": "Optionale Statusvariablen", "Control": "Regelung", "Schedule": "Zeitplan", @@ -28,7 +30,7 @@ "Automatic": "Automatik", "Manually": "Manuell", "Boost": "Boost", - "Setpoint temperature": "Solltemperatur", + "Target temperature": "Solltemperatur", "Switch point occurred": "Schaltpunkt erreicht", "Valve": "Ventil", "Valve adaption": "Ventilanpassung", diff --git a/HeatingGroupHmIP/module.php b/HeatingGroupHmIP/module.php index c51430c..ed0f946 100644 --- a/HeatingGroupHmIP/module.php +++ b/HeatingGroupHmIP/module.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @file module.php @@ -11,7 +11,7 @@ * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 * - * @version 3.70 + * @version 3.71 */ require_once __DIR__ . '/../libs/HMHeatingDevice.php'; // HMBase Klasse @@ -31,7 +31,7 @@ class HomeMaticIPHeatingGroup extends HMHeatingDevice /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); @@ -45,9 +45,10 @@ public function Create() /** * Interne Funktion des SDK. */ - public function RequestAction($Ident, $Value) + public function RequestAction(string $Ident, mixed $Value, bool &$done = false): void { - if (parent::RequestAction($Ident, $Value)) { + parent::RequestAction($Ident, $Value, $done); + if ($done) { return; } if (array_key_exists($Ident, \HMExtended\ValuesSet::$Variables[static::DeviceTyp])) { @@ -76,8 +77,10 @@ public function RequestAction($Ident, $Value) } break; case \HMExtended\HeatingGroupHmIP::SET_POINT_TEMPERATURE: - if ($this->GetValue(\HMExtended\HeatingGroupHmIP::SET_POINT_MODE) == 0) { - $this->PutValue(\HMExtended\HeatingGroupHmIP::CONTROL_MODE, 1); + if ($this->ReadPropertyBoolean(\HMExtended\Device\Property::SetPointBehavior)) { + if ($this->GetValue(\HMExtended\HeatingGroupHmIP::SET_POINT_MODE) == 0) { + $this->PutValue(\HMExtended\HeatingGroupHmIP::CONTROL_MODE, 1); + } } break; case \HMExtended\HeatingGroupHmIP::CONTROL_MODE: @@ -122,7 +125,7 @@ public function RequestAction($Ident, $Value) return; } - protected function SetParamVariables(array $Params) + protected function SetParamVariables(array $Params): void { $d = new DateTime(); $d->setTime( @@ -136,7 +139,7 @@ protected function SetParamVariables(array $Params) parent::SetParamVariables($Params); } - protected function SetVariable(string $Ident, $Value) + protected function SetVariable(string $Ident, mixed $Value): void { switch ($Ident) { case \HMExtended\HeatingGroupHmIP::ACTIVE_PROFILE: diff --git a/HomeMaticScript/module.php b/HomeMaticScript/module.php index 525e7f4..911ce7c 100644 --- a/HomeMaticScript/module.php +++ b/HomeMaticScript/module.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @file module.php @@ -11,7 +11,7 @@ * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 * - * @version 3.70 + * @version 3.71 */ require_once __DIR__ . '/../libs/HMBase.php'; @@ -24,10 +24,10 @@ class HomeMaticRemoteScript extends HMBase /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); - $this->RegisterHMPropertys('XXX9999993'); + $this->RegisterHMProperties('XXX9999993'); $this->SetReceiveDataFilter('.*9999999999.*'); $this->RegisterPropertyBoolean(\HMExtended\Device\Property::EmulateStatus, false); } @@ -35,7 +35,7 @@ public function Create() /** * Interne Funktion des SDK. */ - public function ApplyChanges() + public function ApplyChanges(): void { parent::ApplyChanges(); } @@ -50,7 +50,7 @@ public function ApplyChanges() * * @return string|bool Das Ergebnis als JSON-String oder FALSE im Fehlerfall. */ - public function RunScript(string $Script) + public function RunScript(string $Script): false|string { return $this->LoadHMScript($Script); $xml = $this->SendScript($Script); @@ -69,9 +69,9 @@ public function RunScript(string $Script) * * @throws Exception Wenn die CCU nicht erreicht wurde. * - * @return string das Ergebnis von der CCU als JSON-String. + * @return SimpleXMLElement das Ergebnis von der CCU als JSON-String. */ - private function SendScript(string $Script) + private function SendScript(string $Script): SimpleXMLElement { $HMScriptResult = $this->LoadHMScript($Script); if ($HMScriptResult === false) { diff --git a/ParaInterface/module.php b/ParaInterface/module.php index f74b313..059b744 100644 --- a/ParaInterface/module.php +++ b/ParaInterface/module.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @file module.php @@ -11,7 +11,7 @@ * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 * - * @version 3.70 + * @version 3.71 */ require_once __DIR__ . '/../libs/HMBase.php'; // HMBase Klasse @@ -24,7 +24,7 @@ class HomeMaticParasetInterface extends HMBase /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); @@ -36,7 +36,7 @@ public function Create() /** * Interne Funktion des SDK. */ - public function ApplyChanges() + public function ApplyChanges(): void { parent::ApplyChanges(); $this->SetReceiveDataFilter('.*9999999999.*'); @@ -48,14 +48,14 @@ public function ApplyChanges() //################# PUBLIC /** - * IPS-Instanz-Funktion 'HM_ReadParamset'. + * IPS-Instanz-Funktion 'HM_ReadParamSet'. * Liest die Daten des WR-Interface. * * @return bool True bei Erfolg, sonst false. */ - public function ReadParamset() + public function ReadParamSet(): array { - $Result = $this->GetParamset(); + $Result = $this->GetParamSet(); return $Result; } @@ -65,7 +65,7 @@ public function ReadParamset() * * @return bool True bei Erfolg, sonst false. */ - public function WriteParameterBoolean(string $Parameter, bool $Data) + public function WriteParameterBoolean(string $Parameter, bool $Data): bool { $Result = $this->PutParamSet([$Parameter=> $Data]); return $Result; @@ -77,7 +77,7 @@ public function WriteParameterBoolean(string $Parameter, bool $Data) * * @return bool True bei Erfolg, sonst false. */ - public function WriteParameterInteger(string $Parameter, int $Data) + public function WriteParameterInteger(string $Parameter, int $Data): bool { $Result = $this->PutParamSet([$Parameter=> $Data]); return $Result; @@ -89,7 +89,7 @@ public function WriteParameterInteger(string $Parameter, int $Data) * * @return bool True bei Erfolg, sonst false. */ - public function WriteParameterFloat(string $Parameter, float $Data) + public function WriteParameterFloat(string $Parameter, float $Data): bool { $Result = $this->PutParamSet([$Parameter=> $Data]); return $Result; @@ -101,21 +101,21 @@ public function WriteParameterFloat(string $Parameter, float $Data) * * @return bool True bei Erfolg, sonst false. */ - public function WriteParameterString(string $Parameter, string $Data) + public function WriteParameterString(string $Parameter, string $Data): bool { $Result = $this->PutParamSet([$Parameter=> $Data]); return $Result; } /** - * IPS-Instanz-Funktion 'HM_WriteParamset'. + * IPS-Instanz-Funktion 'HM_WriteParamSet'. * Liest die Daten des WR-Interface. * * @return bool True bei Erfolg, sonst false. */ - public function WriteParamset(string $Paramset) + public function WriteParamSet(string $ParamSet): bool { - $Data = @json_decode($Paramset, true); + $Data = @json_decode($ParamSet, true); if ($Data === false) { trigger_error('Error in Parameter', E_USER_NOTICE); return false; @@ -131,7 +131,7 @@ public function WriteParamset(string $Paramset) * * @return array Ein Array mit den Daten des Interface. */ - private function GetParamset() + private function GetParamSet(): false|array { if (!$this->HasActiveParent()) { trigger_error($this->Translate('Instance has no active Parent Instance!'), E_USER_NOTICE); @@ -159,11 +159,11 @@ private function GetParamset() } /** - * Liest alle Parameter des Devices aus. + * Schreibt Parameter zu einem Devices. * - * @return array Ein Array mit den Daten des Interface. + * @return bool */ - private function PutParamSet(array $Parameter) + private function PutParamSet(array $Parameter): bool { if (!$this->HasActiveParent()) { trigger_error($this->Translate('Instance has no active Parent Instance!'), E_USER_NOTICE); diff --git a/PowerMeter/module.php b/PowerMeter/module.php index 8db477c..c8f12a8 100644 --- a/PowerMeter/module.php +++ b/PowerMeter/module.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @file module.php @@ -11,7 +11,7 @@ * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 * - * @version 3.70 + * @version 3.71 */ require_once __DIR__ . '/../libs/HMBase.php'; // HMBase Klasse @@ -31,10 +31,10 @@ class HomeMaticPowermeter extends HMBase /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); - $this->RegisterHMPropertys('XXX9999997'); + $this->RegisterHMProperties('XXX9999997'); $this->RegisterPropertyBoolean(\HMExtended\Device\Property::EmulateStatus, false); $this->RegisterPropertyInteger('EventID', 0); } @@ -45,9 +45,9 @@ public function Create() * @param int $TimeStamp * @param int $SenderID * @param int $Message - * @param array|int $Data + * @param array $Data */ - public function MessageSink($TimeStamp, $SenderID, $Message, $Data) + public function MessageSink(int $TimeStamp, int $SenderID, int $Message, array $Data): void { parent::MessageSink($TimeStamp, $SenderID, $Message, $Data); switch ($Message) { @@ -64,7 +64,7 @@ public function MessageSink($TimeStamp, $SenderID, $Message, $Data) /** * Interne Funktion des SDK. */ - public function ApplyChanges() + public function ApplyChanges(): void { parent::ApplyChanges(); $this->SetNewConfig(); @@ -75,9 +75,10 @@ public function ApplyChanges() /** * Interne Funktion des SDK. */ - public function ReceiveData($JSONString) + public function ReceiveData(string $JSONString): string { $this->ReadPowerSysVar(); + return ''; } //################# protected @@ -85,7 +86,7 @@ public function ReceiveData($JSONString) /** * Wird ausgeführt wenn der Kernel hochgefahren wurde. */ - protected function KernelReady() + protected function KernelReady(): void { $this->ApplyChanges(); } @@ -93,7 +94,7 @@ protected function KernelReady() /** * Wird ausgeführt wenn sich der Status vom Parent ändert. */ - protected function IOChangeState($State) + protected function IOChangeState(int $State): void { $this->ApplyChanges(); } @@ -103,7 +104,7 @@ protected function IOChangeState($State) /** * Übernimmt die neue Konfiguration. */ - private function SetNewConfig() + private function SetNewConfig(): void { if (IPS_GetKernelRunlevel() != KR_READY) { $this->HMDeviceAddress = ''; @@ -119,7 +120,6 @@ private function SetNewConfig() if ($this->CheckConfig()) { $HMDeviceDatapoint = $this->HMDeviceDatapoint; $this->SetReceiveDataFilter('.*"DeviceID":"' . $this->HMDeviceAddress . '","VariableName":"' . $HMDeviceDatapoint . '".*'); - switch ($HMDeviceDatapoint) { case 'GAS_ENERGY_COUNTER': $Profil = '~Gas'; @@ -159,7 +159,7 @@ private function SetNewConfig() * * @return bool True wenn Konfig ok, sonst false. */ - private function CheckConfig() + private function CheckConfig(): bool { $OldEvent = $this->Event; if ($OldEvent > 0) { @@ -190,7 +190,7 @@ private function CheckConfig() * * @return bool True wenn Quelle gültig ist, sonst false. */ - private function GetPowerAddress(int $EventID) + private function GetPowerAddress(int $EventID): bool { if (($EventID == 0) || (!IPS_VariableExists($EventID))) { $this->HMDeviceAddress = ''; @@ -234,7 +234,7 @@ private function GetPowerAddress(int $EventID) * * @throws Exception Wenn CCU nicht erreicht wurde. */ - private function ReadPowerSysVar() + private function ReadPowerSysVar(): bool { $HMScript = 'object oitemID;' . PHP_EOL . 'oitemID = dom.GetObject("svEnergyCounter' . $this->HMSuffix . '_" # dom.GetObject("' . $this->HMProtocol . '.' . $this->HMDeviceAddress . '.' . $this->HMDeviceDatapoint . '").Channel() # "_' . $this->HMDeviceAddress . '");' . PHP_EOL @@ -248,6 +248,7 @@ private function ReadPowerSysVar() $this->SendDebug($this->HMDeviceDatapoint, (string) $xml->Value, 0); $Value = ((float) $xml->Value) / $this->HMFactor; $this->SetValue($this->HMDeviceDatapoint . '_TOTAL', $Value); + return true; } } diff --git a/Programme/module.php b/Programme/module.php index 1cbbf43..64d138f 100644 --- a/Programme/module.php +++ b/Programme/module.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @file module.php @@ -11,7 +11,7 @@ * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 * - * @version 3.70 + * @version 3.71 */ require_once __DIR__ . '/../libs/HMBase.php'; // HMBase Klasse @@ -24,17 +24,17 @@ class HomeMaticProgramme extends HMBase /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); - $this->RegisterHMPropertys('XXX9999998'); + $this->RegisterHMProperties('XXX9999998'); $this->RegisterPropertyBoolean(\HMExtended\Device\Property::EmulateStatus, false); } /** * Interne Funktion des SDK. */ - public function Destroy() + public function Destroy(): void { if (!IPS_InstanceExists($this->InstanceID)) { $this->UnregisterProfile('Execute.HM'); @@ -46,7 +46,7 @@ public function Destroy() /** * Interne Funktion des SDK. */ - public function ApplyChanges() + public function ApplyChanges(): void { parent::ApplyChanges(); $this->SetReceiveDataFilter('.*9999999999.*'); @@ -70,9 +70,10 @@ public function ApplyChanges() /** * Interne Funktion des SDK. */ - public function RequestAction($Ident, $Value) + public function RequestAction(string $Ident, mixed $Value, bool &$done = false): void { - if (parent::RequestAction($Ident, $Value)) { + parent::RequestAction($Ident, $Value, $done); + if ($done) { return; } @@ -87,7 +88,7 @@ public function RequestAction($Ident, $Value) * * @return bool True bei erfolg, sonst false. */ - public function ReadPrograms() + public function ReadPrograms(): bool { return $this->ReadCCUPrograms(); } @@ -98,7 +99,7 @@ public function ReadPrograms() * * @return bool True bei erfolg, sonst false. */ - public function StartProgram(string $Parameter) + public function StartProgram(string $Parameter): bool { return $this->StartCCUProgram($Parameter); } @@ -108,7 +109,7 @@ public function StartProgram(string $Parameter) /** * Wird ausgeführt wenn der Kernel hochgefahren wurde. */ - protected function KernelReady() + protected function KernelReady(): void { $this->ApplyChanges(); } @@ -116,7 +117,7 @@ protected function KernelReady() /** * Wird ausgeführt wenn sich der Status vom Parent ändert. */ - protected function IOChangeState($State) + protected function IOChangeState(int $State): void { if ($State != IS_ACTIVE) { return; @@ -133,7 +134,7 @@ protected function IOChangeState($State) * * @return bool True bei Erfolg, sonst false. */ - private function ReadCCUPrograms() + private function ReadCCUPrograms(): bool { $HMScript = 'SysPrgs=dom.GetObject(ID_PROGRAMS).EnumUsedIDs();'; $HMScriptResult = $this->LoadHMScript($HMScript); @@ -159,7 +160,6 @@ private function ReadCCUPrograms() $this->SendDebug($SysPrg, (string) $varXml->Name, 0); $var = @IPS_GetObjectIDByIdent($SysPrg, $this->InstanceID); $Name = (string) $varXml->Name; - $Info = (string) $varXml->Name; if ($var === false) { $this->MaintainVariable($SysPrg, $Name, 1, 'Execute.HM', 0, true); $this->EnableAction($SysPrg); @@ -178,7 +178,7 @@ private function ReadCCUPrograms() * * @return bool True bei Erfolg sonst Exception. */ - private function StartCCUProgram($Ident) + private function StartCCUProgram(string $Ident): bool { $HMScript = 'State=dom.GetObject(' . $Ident . ').ProgramExecute();'; diff --git a/README.md b/README.md index 4005a43..1fbe462 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![SDK](https://img.shields.io/badge/Symcon-PHPModul-red.svg)](https://www.symcon.de/service/dokumentation/entwicklerbereich/sdk-tools/sdk-php/) -[![Version](https://img.shields.io/badge/Modul%20version-3.70-blue.svg)]() +[![Version](https://img.shields.io/badge/Modul%20version-3.71-blue.svg)]() [![License](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-green.svg)](https://creativecommons.org/licenses/by-nc-sa/4.0/) [![Version](https://img.shields.io/badge/Symcon%20Version-6.1%20%3E-green.svg)](https://community.symcon.de/t/ip-symcon-6-1-stable-changelog/40276) [![Check Style](https://github.com/Nall-chan/HomematicExtended/workflows/Check%20Style/badge.svg)](https://github.com/Nall-chan/HomematicExtended/actions) [![Run Tests](https://github.com/Nall-chan/HomematicExtended/workflows/Run%20Tests/badge.svg)](https://github.com/Nall-chan/HomematicExtended/actions) @@ -140,6 +140,9 @@ Erweitert IPS um die native Unterstützung von: ### 2. Changelog +Version 3.71: +* Neue Eigenschaft in der Konfiguration der Heizgruppen und des HM-CC-TC Instanzen, um das Verhalten des Modus bei manueller Bedienung der Soll-Temperatur einzustellen. + Version 3.70: * Zeitprofile der Heizgruppen und des HM-CC-TC werden als Wochenplan in IPS dargestellt und können dort bearbeitet werden. @@ -150,11 +153,11 @@ Version 3.60: * Heating.Control.Profile.HmIP * Heating.Control.SetPoint.Mode.HM -Fixes für die ClimacontrolRegulator: +Anpassungen für die ClimacontrolRegulator: * Prüfung der maximalen Anzahl von Tagen für den Party/Urlaub Modus war defekt. * Veränderungen der Solltemperatur setzen den Modus auf Manuell. -Fixes für die HeatingGroupHmIP: +Anpassungen für die HeatingGroupHmIP: * Modus Solltemperatur ist nicht mehr optional. * Veränderungen der Solltemperatur während des Modus Automatik setzen den Modus auf Manuell. * Veränderungen der Solltemperatur während des Modus Party/Urlaub sind möglich. diff --git a/RFInterface/module.php b/RFInterface/module.php index fa961dd..89265b3 100644 --- a/RFInterface/module.php +++ b/RFInterface/module.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @file module.php @@ -11,22 +11,22 @@ * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 * - * @version 3.70 + * @version 3.71 */ require_once __DIR__ . '/../libs/HMBase.php'; // HMBase Klasse /** * HomeMaticRFInterface ist die Klasse für das IPS-Modul 'HomeMatic RF-Interface'. - * Erweitert IPSModule. + * Erweitert IPSModuleStrict. */ -class HomeMaticRFInterface extends IPSModule +class HomeMaticRFInterface extends IPSModuleStrict { use HMExtended\DebugHelper; /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); $this->RegisterPropertyString(\HMExtended\Device\Property::Address, ''); @@ -36,7 +36,7 @@ public function Create() /** * Interne Funktion des SDK. */ - public function ApplyChanges() + public function ApplyChanges(): void { parent::ApplyChanges(); @@ -55,7 +55,7 @@ public function ApplyChanges() /** * Interne Funktion des SDK. */ - public function ReceiveData($JSONString) + public function ReceiveData(string $JSONString): string { $Data = json_decode($JSONString); unset($Data->DataID); @@ -99,6 +99,7 @@ public function ReceiveData($JSONString) $this->SetValue($Ident, $Value); } } + return ''; } } diff --git a/RFInterfaceConfigurator/module.php b/RFInterfaceConfigurator/module.php index 1326ba9..99ae057 100644 --- a/RFInterfaceConfigurator/module.php +++ b/RFInterfaceConfigurator/module.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @file module.php @@ -11,22 +11,22 @@ * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 * - * @version 3.70 + * @version 3.71 */ require_once __DIR__ . '/../libs/HMBase.php'; // HMBase Klasse /** * HomeMaticRFInterfaceConfigurator ist die Klasse für das IPS-Modul 'HomeMatic RF-Interface Konfigurator'. - * Erweitert IPSModule. + * Erweitert IPSModuleStrict. */ -class HomeMaticRFInterfaceConfigurator extends IPSModule +class HomeMaticRFInterfaceConfigurator extends IPSModuleStrict { use HMExtended\DebugHelper; /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); $this->ConnectParent('{6EE35B5B-9DD9-4B23-89F6-37589134852F}'); @@ -35,7 +35,7 @@ public function Create() /** * Interne Funktion des SDK. */ - public function ApplyChanges() + public function ApplyChanges(): void { parent::ApplyChanges(); $this->SetReceiveDataFilter('.*9999999999.*'); @@ -44,7 +44,7 @@ public function ApplyChanges() /** * Interne Funktion des SDK. */ - public function GetConfigurationForm() + public function GetConfigurationForm(): string { $Form = json_decode(file_get_contents(__DIR__ . '/form.json'), true); if ($this->GetStatus() == IS_CREATING) { @@ -135,7 +135,7 @@ public function GetConfigurationForm() } //################# Datenaustausch - private function GetInterfaces() + private function GetInterfaces(): array { $Data['DataID'] = \HMExtended\GUID::SendToRFSplitter; $this->SendDebug('Request', 'GetInterfaces', 0); diff --git a/RFInterfaceSplitter/module.php b/RFInterfaceSplitter/module.php index 3e00144..0f83486 100644 --- a/RFInterfaceSplitter/module.php +++ b/RFInterfaceSplitter/module.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @file module.php @@ -11,7 +11,7 @@ * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 * - * @version 3.70 + * @version 3.71 */ require_once __DIR__ . '/../libs/HMBase.php'; // HMBase Klasse @@ -24,10 +24,10 @@ class HomeMaticRFInterfaceSplitter extends HMBase /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); - $this->RegisterHMPropertys('XXX9999994'); + $this->RegisterHMProperties('XXX9999994'); $this->RegisterPropertyBoolean(\HMExtended\Device\Property::EmulateStatus, false); $this->RegisterPropertyInteger('Interval', 0); $this->RegisterTimer('ReadRFInterfaces', 0, '@HM_ReadRFInterfaces($_IPS[\'TARGET\']);'); @@ -36,7 +36,7 @@ public function Create() /** * Interne Funktion des SDK. */ - public function ApplyChanges() + public function ApplyChanges(): void { parent::ApplyChanges(); $this->SetReceiveDataFilter('.*9999999999.*'); @@ -71,7 +71,7 @@ public function ApplyChanges() * * @return string Die Antwort an den anfragenden Child */ - public function ForwardData($JSONString) + public function ForwardData(string $JSONString): string { return serialize($this->GetInterfaces()); } @@ -84,7 +84,7 @@ public function ForwardData($JSONString) * * @return bool True bei Erfolg, sonst false. */ - public function ReadRFInterfaces() + public function ReadRFInterfaces(): bool { $Result = $this->GetInterfaces(); $ret = false; @@ -108,7 +108,7 @@ public function ReadRFInterfaces() /** * Wird ausgeführt wenn der Kernel hochgefahren wurde. */ - protected function KernelReady() + protected function KernelReady(): void { $this->ApplyChanges(); } @@ -116,7 +116,7 @@ protected function KernelReady() /** * Wird ausgeführt wenn sich der Status vom Parent ändert. */ - protected function IOChangeState($State) + protected function IOChangeState(int $State): void { if ($State == IS_ACTIVE) { $this->ApplyChanges(); @@ -132,7 +132,7 @@ protected function IOChangeState($State) * * @return bool True wenn Konfig ok, sonst false. */ - private function CheckConfig() + private function CheckConfig(): bool { $Interval = $this->ReadPropertyInteger('Interval'); if ($Interval < 0) { @@ -158,7 +158,7 @@ private function CheckConfig() * * @return array Ein Array mit den Daten der Interfaces. */ - private function GetInterfaces() + private function GetInterfaces(): array { if (!$this->HasActiveParent()) { trigger_error($this->Translate('Instance has no active parent instance!'), E_USER_NOTICE); diff --git a/Systemvariablen/module.php b/Systemvariablen/module.php index fc05ba8..6dba3a1 100644 --- a/Systemvariablen/module.php +++ b/Systemvariablen/module.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @file module.php @@ -11,7 +11,7 @@ * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 * - * @version 3.70 + * @version 3.71 */ require_once __DIR__ . '/../libs/HMBase.php'; // HMBase Klasse @@ -32,10 +32,10 @@ class HomeMaticSystemvariablen extends HMBase /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); - $this->RegisterHMPropertys('XXX9999999'); + $this->RegisterHMProperties('XXX9999999'); $this->RegisterPropertyInteger('EventID', 0); $this->RegisterPropertyInteger('Interval', 0); @@ -55,7 +55,7 @@ public function Create() /** * Interne Funktion des SDK. */ - public function Destroy() + public function Destroy(): void { if (!IPS_InstanceExists($this->InstanceID)) { $this->UnregisterProfile('HM.AlReceipt'); @@ -77,14 +77,11 @@ public function Destroy() * @param int $TimeStamp * @param int $SenderID * @param int $Message - * @param array|int $Data + * @param array $Data */ - public function MessageSink($TimeStamp, $SenderID, $Message, $Data) + public function MessageSink(int $TimeStamp, int $SenderID, int $Message, array $Data): void { $OldVars = $this->SystemVars; - /* if (!IPS_InstanceExists($this->InstanceID)) { - return; - } */ parent::MessageSink($TimeStamp, $SenderID, $Message, $Data); switch ($Message) { case VM_DELETE: @@ -109,7 +106,7 @@ public function MessageSink($TimeStamp, $SenderID, $Message, $Data) /** * Interne Funktion des SDK. */ - public function ApplyChanges() + public function ApplyChanges(): void { parent::ApplyChanges(); @@ -155,9 +152,10 @@ public function ApplyChanges() /** * Interne Funktion des SDK. */ - public function RequestAction($Ident, $Value) + public function RequestAction(string $Ident, mixed $Value, bool &$done = false): void { - if (parent::RequestAction($Ident, $Value)) { + parent::RequestAction($Ident, $Value, $done); + if ($done) { return; } if (strpos($Ident, 'AlDP') !== false) { @@ -192,9 +190,10 @@ public function RequestAction($Ident, $Value) /** * Interne Funktion des SDK. */ - public function ReceiveData($JSONString) + public function ReceiveData(string $JSONString): string { $this->ReadSysVars(); + return ''; } //################# PUBLIC @@ -207,7 +206,7 @@ public function ReceiveData($JSONString) * * @return bool True bei erfolg, sonst false. */ - public function AlarmReceipt(string $Ident) + public function AlarmReceipt(string $Ident): bool { if (IPS_GetKernelRunlevel() != KR_READY) { return false; @@ -252,7 +251,7 @@ public function AlarmReceipt(string $Ident) * IPS-Instanz-Funktion 'HM_SystemVariablesTimer'. * Wird durch den Timer ausgeführt und liest alle Systemvariablen von der CCU. */ - public function SystemVariablesTimer() + public function SystemVariablesTimer(): void { if (!$this->HasActiveParent()) { return; @@ -477,7 +476,7 @@ public function WriteValueString2(string $Parameter, string $Value) /** * Interne Funktion des SDK. */ - protected function KernelReady() + protected function KernelReady(): void { $this->ApplyChanges(); } @@ -485,7 +484,7 @@ protected function KernelReady() /** * Wird ausgeführt wenn sich der Status vom Parent ändert. */ - protected function IOChangeState($State) + protected function IOChangeState(int $State): void { $this->ApplyChanges(); } @@ -495,7 +494,7 @@ protected function IOChangeState($State) * * @return bool True wenn Konfig ok, sonst false. */ - private function SetNewConfig() + private function SetNewConfig(): bool { $this->UnregisterReference($this->AlarmScriptID); $this->AlarmScriptID = $this->ReadPropertyInteger('AlarmScriptID'); @@ -556,7 +555,7 @@ private function SetNewConfig() * * @return bool True wenn Quelle gültig ist, sonst false. */ - private function GetTriggerVar() + private function GetTriggerVar(): bool { $EventID = $this->ReadPropertyInteger('EventID'); if (($EventID == 0) || (!IPS_VariableExists($EventID))) { @@ -582,7 +581,7 @@ private function GetTriggerVar() * * @return bool True bei Erfolg, sonst false. */ - private function ReadSysVars() + private function ReadSysVars(): bool { // Systemvariablen $HMScript = 'SysVars=dom.GetObject(ID_SYSTEM_VARIABLES).EnumUsedIDs();'; @@ -757,7 +756,7 @@ private function ReadSysVars() * * @return bool True bei Erfolg, sonst false. */ - private function ProcessAlarmVariable(string $VarIdent, string $SysVar, string $CCUTimeZone) + private function ProcessAlarmVariable(string $VarIdent, string $SysVar, string $CCUTimeZone): bool { $HMScript = 'Value = dom.GetObject(' . $SysVar . ').Value(); string FirstTime = dom.GetObject(' . $SysVar . ').AlOccurrenceTime(); @@ -854,7 +853,7 @@ private function ProcessAlarmVariable(string $VarIdent, string $SysVar, string $ * * @return bool True bei Erfolg, sonst false. */ - private function WriteSysVar(string $Parameter, string $ValueStr) + private function WriteSysVar(string $Parameter, string $ValueStr): bool { if (IPS_GetKernelRunlevel() != KR_READY) { return false; @@ -889,7 +888,7 @@ private function WriteSysVar(string $Parameter, string $ValueStr) * * @return int IPS-ID der neuen Variable. */ - private function RegisterSubVariable($ParentID, $Ident, $Name, $Type, $Profile = '', $Position = 0) + private function RegisterSubVariable($ParentID, $Ident, $Name, $Type, $Profile = '', $Position = 0): int { if ($Profile != '') { if (IPS_VariableProfileExists('~' . $Profile)) { diff --git a/WRInterface/module.php b/WRInterface/module.php index 66a4ce4..b16c223 100644 --- a/WRInterface/module.php +++ b/WRInterface/module.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @file module.php @@ -11,7 +11,7 @@ * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 * - * @version 3.70 + * @version 3.71 */ require_once __DIR__ . '/../libs/HMBase.php'; // HMBase Klasse @@ -24,11 +24,11 @@ class HomeMaticWRInterface extends HMBase /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); - $this->RegisterHMPropertys('XXX9999993'); + $this->RegisterHMProperties('XXX9999993'); $this->RegisterPropertyBoolean(\HMExtended\Device\Property::EmulateStatus, false); $this->RegisterPropertyInteger('Interval', 0); @@ -39,7 +39,7 @@ public function Create() /** * Interne Funktion des SDK. */ - public function ApplyChanges() + public function ApplyChanges(): void { parent::ApplyChanges(); $this->SetReceiveDataFilter('.*9999999999.*'); @@ -72,7 +72,7 @@ public function ApplyChanges() * * @return bool True bei Erfolg, sonst false. */ - public function ReadWRInterface() + public function ReadWRInterface(): bool { $Result = $this->GetInterface(); if ($Result === false) { @@ -120,7 +120,7 @@ public function ReadWRInterface() /** * Wird ausgeführt wenn der Kernel hochgefahren wurde. */ - protected function KernelReady() + protected function KernelReady(): void { $this->ApplyChanges(); } @@ -128,7 +128,7 @@ protected function KernelReady() /** * Wird ausgeführt wenn sich der Status vom Parent ändert. */ - protected function IOChangeState($State) + protected function IOChangeState(int $State): void { if ($State == IS_ACTIVE) { $this->ApplyChanges(); @@ -144,7 +144,7 @@ protected function IOChangeState($State) * * @return bool True wenn Konfig ok, sonst false. */ - private function CheckConfig() + private function CheckConfig(): bool { $Interval = $this->ReadPropertyInteger('Interval'); if ($Interval < 0) { @@ -171,7 +171,7 @@ private function CheckConfig() * * @return array Ein Array mit den Daten des Interface. */ - private function GetInterface() + private function GetInterface(): false|array { if (!$this->HasActiveParent()) { trigger_error($this->Translate('Instance has no active parent instance!'), E_USER_NOTICE); diff --git a/ePaperStatusAnzeige/module.php b/ePaperStatusAnzeige/module.php index 583978a..f3542cc 100644 --- a/ePaperStatusAnzeige/module.php +++ b/ePaperStatusAnzeige/module.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @file module.php @@ -11,7 +11,7 @@ * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 * - * @version 3.70 + * @version 3.71 */ require_once __DIR__ . '/../libs/HMBase.php'; // HMBase Klasse @@ -24,7 +24,7 @@ class HomeMaticDisEPWM55 extends HMBase /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); @@ -36,7 +36,7 @@ public function Create() /** * Interne Funktion des SDK. */ - public function ApplyChanges() + public function ApplyChanges(): void { parent::ApplyChanges(); $Address = $this->ReadPropertyString(\HMExtended\Device\Property::Address); @@ -57,7 +57,7 @@ public function ApplyChanges() * * @return bool True bei Erfolg, sonst false. */ - public function WriteValueDisplayNotify(int $Chime, int $Repeat, int $Wait, int $Color) + public function WriteValueDisplayNotify(int $Chime, int $Repeat, int $Wait, int $Color): bool { $Data = $this->GetSignal($Chime, $Repeat, $Wait, $Color); if ($Data === false) { @@ -76,7 +76,7 @@ public function WriteValueDisplayNotify(int $Chime, int $Repeat, int $Wait, int * * @return bool True bei Erfolg, sonst false. */ - public function WriteValueDisplayLine(int $Line, string $Text, int $Icon) + public function WriteValueDisplayLine(int $Line, string $Text, int $Icon): bool { $Data[] = '0x0A'; for ($index = 1; $index <= 3; $index++) { @@ -90,7 +90,6 @@ public function WriteValueDisplayLine(int $Line, string $Text, int $Icon) $Data[] = '0x0A'; } } - return $this->SendData($Data); } @@ -108,7 +107,7 @@ public function WriteValueDisplayLine(int $Line, string $Text, int $Icon) * * @return bool True bei Erfolg, sonst false. */ - public function WriteValueDisplayLineEx(int $Line, string $Text, int $Icon, int $Chime, int $Repeat, int $Wait, int $Color) + public function WriteValueDisplayLineEx(int $Line, string $Text, int $Icon, int $Chime, int $Repeat, int $Wait, int $Color): bool { $Data[] = '0x0A'; for ($index = 1; $index <= 3; $index++) { @@ -143,7 +142,7 @@ public function WriteValueDisplayLineEx(int $Line, string $Text, int $Icon, int * * @return bool True bei Erfolg, sonst false. */ - public function WriteValueDisplay(string $Text1, int $Icon1, string $Text2, int $Icon2, string $Text3, int $Icon3) + public function WriteValueDisplay(string $Text1, int $Icon1, string $Text2, int $Icon2, string $Text3, int $Icon3): bool { $Data[] = '0x0A'; $Line1 = $this->GetLine($Text1, $Icon1); @@ -151,7 +150,6 @@ public function WriteValueDisplay(string $Text1, int $Icon1, string $Text2, int return false; } $Data = array_merge($Data, $Line1); - $Line2 = $this->GetLine($Text2, $Icon2); if ($Line2 === false) { return false; @@ -162,7 +160,6 @@ public function WriteValueDisplay(string $Text1, int $Icon1, string $Text2, int return false; } $Data = array_merge($Data, $Line3); - return $this->SendData($Data); } @@ -183,7 +180,7 @@ public function WriteValueDisplay(string $Text1, int $Icon1, string $Text2, int * * @return bool True bei Erfolg, sonst false. */ - public function WriteValueDisplayEx(string $Text1, int $Icon1, string $Text2, int $Icon2, string $Text3, int $Icon3, int $Chime, int $Repeat, int $Wait, int $Color) + public function WriteValueDisplayEx(string $Text1, int $Icon1, string $Text2, int $Icon2, string $Text3, int $Icon3, int $Chime, int $Repeat, int $Wait, int $Color): bool { $Data[] = '0x0A'; $Line1 = $this->GetLine($Text1, $Icon1); @@ -219,10 +216,8 @@ public function WriteValueDisplayEx(string $Text1, int $Icon1, string $Text2, in * @param array $Submit Das Array mit allen Werten, welche an das Display gesendet werden sollen. * * @return bool True bei Erfolg, sonst false. - * - * @todo Rückgabewerte fehlen! */ - private function SendData($Submit) + private function SendData(array $Submit): bool { $ParentData = [ 'DataID' => \HMExtended\GUID::SendRpcToIO, @@ -258,9 +253,9 @@ private function SendData($Submit) * @param int $Wait Wartezeit in 10 Sekunden zwischen den Wiederholungen. * @param int $Color Farbe der LED 0-3 * - * @return bool|array Das Array mit den Daten, oder im Fehlerfall false. + * @return false|array Das Array mit den Daten, oder im Fehlerfall false. */ - private function GetSignal(int $Chime, int $Repeat, int $Wait, int $Color) + private function GetSignal(int $Chime, int $Repeat, int $Wait, int $Color): false|array { try { if (!is_int($Chime)) { @@ -308,9 +303,9 @@ private function GetSignal(int $Chime, int $Repeat, int $Wait, int $Color) * @param string $Text Der darzustellenden Text (0-12 Zeichen) * @param int $Icon Das anzuzeigende Icon (0-9) * - * @return array Das Daten-Array für eine Zeile. + * @return false|array Das Daten-Array für eine Zeile. */ - private function GetLine(string $Text, int $Icon) + private function GetLine(string $Text, int $Icon): false|array { try { if (!is_string($Text)) { @@ -355,7 +350,7 @@ private function GetLine(string $Text, int $Icon) * * @return string Der veränderte String. */ - private function hex_encode(string $string) + private function hex_encode(string $string): string { $umlaut = ['Ä', 'Ö', 'Ü', 'ä', 'ö', 'ü', 'ß', ':']; $hex_neu = [chr(0x5b), chr(0x23), chr(0x24), chr(0x7b), chr(0x7c), chr(0x7d), chr(0x5f), chr(0x3a)]; diff --git a/library.json b/library.json index ba54039..e9a5ed2 100644 --- a/library.json +++ b/library.json @@ -7,6 +7,6 @@ "version": "6.1" }, "version": "3.7", - "build": 370, - "date": 1702831462 + "build": 371, + "date": 1702919819 } \ No newline at end of file diff --git a/libs/HMBase.php b/libs/HMBase.php index 67c6a44..863267e 100644 --- a/libs/HMBase.php +++ b/libs/HMBase.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @package HomematicExtended @@ -10,7 +10,7 @@ * @author Michael Tröger * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 - * @version 3.70 + * @version 3.71 */ eval('declare(strict_types=1);namespace HMExtended {?>' . file_get_contents(__DIR__ . '/helper/DebugHelper.php') . '}'); eval('declare(strict_types=1);namespace HMExtended {?>' . file_get_contents(__DIR__ . '/helper/BufferHelper.php') . '}'); @@ -21,7 +21,7 @@ /** * HMBase ist die Basis-Klasse für alle Module welche HMScript verwenden. - * Erweitert IPSModule. + * Erweitert IPSModuleStrictStrict. * * @property int $ParentID Aktueller IO-Parent. * @@ -32,7 +32,7 @@ * @method void UnregisterProfile(string $Profile) * */ -abstract class HMBase extends IPSModule +abstract class HMBase extends IPSModuleStrict { use \HMExtended\DebugHelper, \HMExtended\VariableHelper, @@ -47,7 +47,7 @@ abstract class HMBase extends IPSModule /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); $this->ParentID = 0; @@ -58,7 +58,7 @@ public function Create() /** * Interne Funktion des SDK. */ - public function ApplyChanges() + public function ApplyChanges(): void { parent::ApplyChanges(); $this->RegisterMessage($this->InstanceID, FM_CONNECT); @@ -77,9 +77,9 @@ public function ApplyChanges() * @param int $TimeStamp * @param int $SenderID * @param int $Message - * @param array|int $Data + * @param array $Data */ - public function MessageSink($TimeStamp, $SenderID, $Message, $Data) + public function MessageSink(int $TimeStamp, int $SenderID, int $Message, array $Data): void { $this->IOMessageSink($TimeStamp, $SenderID, $Message, $Data); switch ($Message) { @@ -90,9 +90,9 @@ public function MessageSink($TimeStamp, $SenderID, $Message, $Data) } //################# ActionHandler - public function RequestAction($Ident, $Value) + public function RequestAction(string $Ident, mixed $Value, bool &$done = false): void { - return $this->IORequestAction($Ident, $Value); + $done = $this->IORequestAction($Ident, $Value); } //################# protected @@ -100,14 +100,14 @@ public function RequestAction($Ident, $Value) /** * Wird ausgeführt wenn sich der Status vom Parent ändert. */ - protected function IOChangeState($State) + protected function IOChangeState(int $State): void { } /** * Wird ausgeführt wenn der Kernel hochgefahren wurde. */ - protected function KernelReady() + protected function KernelReady(): void { $this->UnregisterMessage(0, IPS_KERNELSTARTED); $this->RegisterParent(); @@ -116,9 +116,9 @@ protected function KernelReady() /** * Setzte alle Eigenschaften, welche Instanzen die mit einem Homematic-Socket verbunden sind, haben müssen. * - * @param string $Address Die zu verwendene HM-Device Adresse. + * @param string $Address Die zu nutzende HM-Device Adresse. */ - protected function RegisterHMPropertys(string $Address) + protected function RegisterHMProperties(string $Address): void { $this->RegisterPropertyInteger(\HMExtended\Device\Property::Protocol, 0); if (IPS_GetKernelRunlevel() == KR_READY) { @@ -136,7 +136,7 @@ protected function RegisterHMPropertys(string $Address) * * @return int ID des Parent. */ - protected function RegisterParent() + protected function RegisterParent(): int { return $this->IORegisterParent(); } @@ -148,9 +148,9 @@ protected function RegisterParent() * * @throws Exception Wenn die CCU nicht erreicht wurde. * - * @return string Das Ergebnis von der CCU. + * @return false|string Das Ergebnis von der CCU. */ - protected function LoadHMScript(string $HMScript) + protected function LoadHMScript(string $HMScript): false|string { if (!$this->HasActiveParent()) { trigger_error($this->Translate('Instance has no active Parent Instance!'), E_USER_NOTICE); @@ -166,7 +166,7 @@ protected function LoadHMScript(string $HMScript) return utf8_encode($Result); } - protected function GetScriptXML($Content) + protected function GetScriptXML(string $Content): SimpleXMLElement { try { $xml = @new SimpleXMLElement(utf8_encode($Content), LIBXML_NOBLANKS + LIBXML_NONET); diff --git a/libs/HMHeatingDevice.php b/libs/HMHeatingDevice.php index f76f41c..a293c1c 100644 --- a/libs/HMHeatingDevice.php +++ b/libs/HMHeatingDevice.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** - * @addtogroup homematicextended + * @addtogroup HomeMaticExtended * @{ * * @file module.php @@ -11,7 +11,7 @@ * @copyright 2023 Michael Tröger * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC BY-NC-SA 4.0 * - * @version 3.70 + * @version 3.71 */ require_once __DIR__ . '/HMBase.php'; // HMBase Klasse @@ -58,13 +58,15 @@ class HMHeatingDevice extends HMBase /** * Interne Funktion des SDK. */ - public function Create() + public function Create(): void { parent::Create(); foreach (\HMExtended\Property::$Properties[static::DeviceTyp] as $Property => $Value) { $this->RegisterPropertyBoolean('enable_' . $Property, $Value); } - $this->RegisterPropertyBoolean('enable_SCHEDULE', false); + $this->RegisterPropertyBoolean(\HMExtended\Device\Property::Schedule, true); + $this->RegisterPropertyBoolean(\HMExtended\Device\Property::SetPointBehavior, true); + $ScheduleTempsInit = [ [5, 0x000080], [16, 0x333399], @@ -80,13 +82,14 @@ public function Create() [30, 0xFF0000], ]; $this->RegisterAttributeString('ScheduleColors', json_encode($ScheduleTempsInit)); + $this->WeekSchedules = []; } /** * Interne Funktion des SDK. */ - public function Destroy() + public function Destroy(): void { if (!IPS_InstanceExists($this->InstanceID)) { foreach (\HMExtended\Variables::$Profiles as $ProfileName => $ProfileData) { @@ -99,7 +102,7 @@ public function Destroy() /** * Interne Funktion des SDK. */ - public function ApplyChanges() + public function ApplyChanges(): void { parent::ApplyChanges(); $Address = $this->ReadPropertyString(\HMExtended\Device\Property::Address); @@ -121,7 +124,7 @@ public function ApplyChanges() } } } - if ($this->ReadPropertyBoolean('enable_SCHEDULE')) { + if ($this->ReadPropertyBoolean(\HMExtended\Device\Property::Schedule)) { $this->CreateWeekPlan(); $ProfileSubmitPlan = false; switch (static::SelectedWeekScheduleIdent) { //Nur Speichern Button @@ -166,25 +169,29 @@ public function ApplyChanges() /** * Interne Funktion des SDK. */ - public function RequestAction($Ident, $Value) + public function RequestAction(string $Ident, mixed $Value, bool &$done = false): void { - if (parent::RequestAction($Ident, $Value)) { - return true; + parent::RequestAction($Ident, $Value, $done); + if ($done) { + return; } switch ($Ident) { case 'getParam': $this->GetParamsAndSetVariable(); - return true; + $done = true; + return; case \HMExtended\Variables::SUBMIT_WEEK_PROGRAM: if (static::SelectedWeekScheduleIdent) { $this->SaveSchedule((int) $this->GetValue(\HMExtended\Variables::SELECT_NEW_WEEK_PROGRAM)); } else { $this->SaveSchedule(1); } - return true; + $done = true; + return; case \HMExtended\Variables::SELECT_NEW_WEEK_PROGRAM: $this->SetValue($Ident, $Value); - return true; + $done = true; + return; } $Property = $Ident; if (array_key_exists($Ident, \HMExtended\ValuesSet::$Variables[static::DeviceTyp])) { @@ -196,13 +203,14 @@ public function RequestAction($Ident, $Value) if (array_key_exists($Property, \HMExtended\Property::$Properties[static::DeviceTyp])) { if (!$this->ReadPropertyBoolean('enable_' . $Property)) { trigger_error('Variable is disabled in config.', E_USER_NOTICE); - return true; + $done = true; + return; } } - return false; + return; } - public function RequestState(string $Ident) + public function RequestState(string $Ident): bool { if (!array_key_exists($Ident, \HMExtended\ValuesSet::$Variables[static::DeviceTyp])) { trigger_error($this->Translate('Invalid Ident for VALUE.'), E_USER_NOTICE); @@ -217,16 +225,16 @@ public function RequestState(string $Ident) return true; } - public function RequestParams() + public function RequestParams(): bool { return $this->GetParamsAndSetVariable(); } - public function ReceiveData($JSONString) + public function ReceiveData(string $JSONString): string { $Event = json_decode($JSONString, true); - //$this->SendDebug('EVENT:' . $Event['VariableName'], $Event['VariableValue'], 0); $this->SetVariable($Event['VariableName'], $Event['VariableValue']); + return ''; } //################# protected @@ -234,7 +242,7 @@ public function ReceiveData($JSONString) /** * Wird ausgeführt wenn sich der Status vom Parent ändert. */ - protected function IOChangeState($State) + protected function IOChangeState(int $State): void { if ($State == IS_ACTIVE) { if (($this->ReadPropertyString(\HMExtended\Device\Property::Address) != '') && ($this->HasActiveParent())) { @@ -244,12 +252,12 @@ protected function IOChangeState($State) } } - protected function SetVariable(string $Ident, $Value) + protected function SetVariable(string $Ident, mixed $Value): void { @$this->SetValue($Ident, $Value); } - protected function SetParamVariables(array $Params) + protected function SetParamVariables(array $Params): void { $ScheduleData = []; $ScheduleTemps = $this->GetTempColorsAttribute(); @@ -288,7 +296,7 @@ protected function SetParamVariables(array $Params) $this->RefreshScheduleObject($ScheduleActionHasChanged); } - protected function FixValueType($VarType, &$Value) + protected function FixValueType(int $VarType, mixed &$Value): void { switch ($VarType) { case VARIABLETYPE_BOOLEAN: @@ -306,21 +314,21 @@ protected function FixValueType($VarType, &$Value) } } - protected function PutParamSet(array $Parameter, bool $EmulateStatus = false) + protected function PutParamSet(array $Parameter, bool $EmulateStatus = false): bool { $Paramset = [$this->ReadPropertyString(\HMExtended\Device\Property::Address) . static::ParamChannel, \HMExtended\CCU::MASTER]; $Result = $this->SendRPC('putParamset', $Paramset, $Parameter, $EmulateStatus); return ($Result !== null) ? true : false; } - protected function PutValueSet($Value, bool $EmulateStatus = false) + protected function PutValueSet(array $Values, bool $EmulateStatus = false): bool { $Paramset = [$this->ReadPropertyString(\HMExtended\Device\Property::Address) . static::ValuesChannel, \HMExtended\CCU::VALUES]; - $Result = $this->SendRPC('putParamset', $Paramset, $Value, $EmulateStatus); + $Result = $this->SendRPC('putParamset', $Paramset, $Values, $EmulateStatus); return ($Result !== null) ? true : false; } - protected function PutValue(string $ValueName, $Value, bool $EmulateStatus = false) + protected function PutValue(string $ValueName, $Value, bool $EmulateStatus = false): bool { $Paramset = [$this->ReadPropertyString(\HMExtended\Device\Property::Address) . static::ValuesChannel, $ValueName]; $Result = $this->SendRPC('setValue', $Paramset, $Value, $EmulateStatus); @@ -330,9 +338,9 @@ protected function PutValue(string $ValueName, $Value, bool $EmulateStatus = fal return ($Result !== null) ? true : false; } - protected function RefreshScheduleObject(bool $ScheduleActionHasChanged = false) + protected function RefreshScheduleObject(bool $ScheduleActionHasChanged = false): void { - if (!$this->ReadPropertyBoolean('enable_SCHEDULE')) { + if (!$this->ReadPropertyBoolean(\HMExtended\Device\Property::Schedule)) { return; } if (!count($this->WeekSchedules)) { @@ -370,7 +378,7 @@ protected function RefreshScheduleObject(bool $ScheduleActionHasChanged = false) } } - protected function SaveSchedule(int $Plan) + protected function SaveSchedule(int $Plan): void { $EventId = @IPS_GetObjectIDByIdent(self::EVENT, $this->InstanceID); if ($EventId === false) { @@ -387,7 +395,6 @@ protected function SaveSchedule(int $Plan) foreach ($Event['ScheduleGroups'] as $Group) { $Day = static::$Weekdays[$Group['Days']]; $Slot = 1; - for ($i = 1; $i <= count($Group['Points']); $i++) { $TimeIndex = sprintf(static::WeekScheduleIndexEndTime, $Slot, $Day, $Plan); $TempIndex = sprintf(static::WeekScheduleIndexTemp, $Slot, $Day, $Plan); @@ -421,7 +428,7 @@ protected function SaveSchedule(int $Plan) //################# PRIVATE - private function CreateVariablesFromValues() + private function CreateVariablesFromValues(): void { $AddressWithChannel = $this->ReadPropertyString(\HMExtended\Device\Property::Address) . static::ValuesChannel; $Result = $this->GetParamsetDescription(\HMExtended\CCU::VALUES, $AddressWithChannel); @@ -472,7 +479,7 @@ private function GetValuesAndSetVariable(): bool return false; } - private function CreateVariablesFromParams() + private function CreateVariablesFromParams(): void { $AddressWithChannel = $this->ReadPropertyString(\HMExtended\Device\Property::Address) . static::ParamChannel; $Result = $this->GetParamsetDescription(\HMExtended\CCU::MASTER, $AddressWithChannel); @@ -532,7 +539,7 @@ private function GetParamsAndSetVariable(): bool return false; } - private function CreateProfile($Profile) + private function CreateProfile($Profile): void { if ($Profile) { if (substr($Profile, 0, 1) != '~') { @@ -553,19 +560,19 @@ private function CreateProfile($Profile) } } - private function GetParamset(string $Paramset, string $AddressWithChannel) + private function GetParamset(string $Paramset, string $AddressWithChannel): array { $Result = $this->SendRPC('getParamset', [$AddressWithChannel, $Paramset]); return is_array($Result) ? $Result : []; } - private function GetParamsetDescription(string $Paramset, string $AddressWithChannel) + private function GetParamsetDescription(string $Paramset, string $AddressWithChannel): array { $Result = $this->SendRPC('getParamsetDescription', [$AddressWithChannel, $Paramset]); return is_array($Result) ? $Result : []; } - private function SendRPC(string $MethodName, array $Paramset, $Data = null, bool $EmulateStatus = false) + private function SendRPC(string $MethodName, array $Paramset, $Data = null, bool $EmulateStatus = false): null|true|array { if (!$this->HasActiveParent()) { trigger_error($this->Translate('Instance has no active Parent Instance!'), E_USER_NOTICE); @@ -619,7 +626,7 @@ private function UpdateScheduleActions(array $Event, bool $ScheduleActionHasChan return array_keys($ScheduleActionColors); } - private function CreateWeekPlan() + private function CreateWeekPlan(): void { $this->WeekSchedules = []; $EventId = @IPS_GetObjectIDByIdent(self::EVENT, $this->InstanceID); @@ -637,7 +644,7 @@ private function CreateWeekPlan() } } - private function SetTempColorsAttribute(array $Values) + private function SetTempColorsAttribute(array $Values): void { ksort($Values); foreach ($Values as $Temp => $Color) { @@ -646,7 +653,7 @@ private function SetTempColorsAttribute(array $Values) $this->WriteAttributeString('ScheduleColors', json_encode($ScheduleTemps)); } - private function GetTempColorsAttribute() + private function GetTempColorsAttribute(): array { $Values = []; $ScheduleTemps = json_decode($this->ReadAttributeString('ScheduleColors'), true); @@ -657,7 +664,7 @@ private function GetTempColorsAttribute() return $Values; } - private function GetNextColor(float $Temp, $Colors) + private function GetNextColor(float $Temp, array $Colors): int { $Found = 0x000080; foreach ($Colors as $TempColor => $Color) { diff --git a/libs/HMTypes.php b/libs/HMTypes.php index 1e6e8d5..6bd3777 100644 --- a/libs/HMTypes.php +++ b/libs/HMTypes.php @@ -524,7 +524,7 @@ class ValuesSet VARIABLETYPE_FLOAT, '~Temperature.HM', true, - 'Setpoint temperature' + 'Target temperature' ], ClimacontrolRegulator::ADJUSTING_DATA => [ \HMExtended\Variables::VARIABLETYPE_NONE @@ -634,7 +634,7 @@ class ValuesSet VARIABLETYPE_FLOAT, 'Heating.Control.SetPoint.Temperature.HM', true, - 'Setpoint temperature' + 'Target temperature' ], HeatingGroupHmIP::SWITCH_POINT_OCCURED => [ VARIABLETYPE_BOOLEAN, @@ -678,7 +678,7 @@ class ValuesSet VARIABLETYPE_FLOAT, 'Heating.Control.SetPoint.Temperature.HM', true, - 'Setpoint temperature' + 'Target temperature' ], HeatingGroup::MANU_MODE => [ \HMExtended\Variables::VARIABLETYPE_NONE @@ -981,5 +981,7 @@ class Property public const EmulateStatus = 'EmulateStatus'; public const Address = 'Address'; public const Protocol = 'Protocol'; + public const SetPointBehavior = 'SetPointBehavior'; + public const Schedule = 'enable_SCHEDULE'; } } \ No newline at end of file diff --git a/libs/helper b/libs/helper index 6cb1dce..9ae514f 160000 --- a/libs/helper +++ b/libs/helper @@ -1 +1 @@ -Subproject commit 6cb1dce113b8fe3135d8ccb6aa06b7b89c73d1db +Subproject commit 9ae514f03dd84da35c90cfbd500ca6bf58afcf64