diff --git a/HeatingGroup/module.php b/HeatingGroup/module.php index f7585c3..1736861 100644 --- a/HeatingGroup/module.php +++ b/HeatingGroup/module.php @@ -199,9 +199,6 @@ public function RequestAction($Ident, $Value) if ($this->PutParamSet([$Ident=>$SendValue], true)) { $this->SetValue($Ident, $Value); } - if ($Ident == \HMExtended\HeatingGroup::WEEK_PROGRAM_POINTER) { - $this->RefreshScheduleObject(); - } return; } trigger_error($this->Translate('Invalid Ident.') . ' (' . $Ident . ')', E_USER_NOTICE); diff --git a/HeatingGroupHmIP/module.php b/HeatingGroupHmIP/module.php index 805750a..5d6939b 100644 --- a/HeatingGroupHmIP/module.php +++ b/HeatingGroupHmIP/module.php @@ -18,6 +18,7 @@ /** * HomeMaticIPHeatingGroup * Erweitert HMHeatingDevice Virtuelles Gerät: HmIP-HEATING + * */ class HomeMaticIPHeatingGroup extends HMHeatingDevice { @@ -141,9 +142,6 @@ protected function SetParamVariables(array $Params) protected function SetVariable(string $Ident, $Value) { switch ($Ident) { - case \HMExtended\HeatingGroupHmIP::ACTIVE_PROFILE: - $OldValue = $this->GetValue($Ident); - break; case \HMExtended\HeatingGroupHmIP::PARTY_TIME_START: case \HMExtended\HeatingGroupHmIP::PARTY_TIME_END: if ($Value == '1999_11_30 00:00') { @@ -155,11 +153,6 @@ protected function SetVariable(string $Ident, $Value) break; } parent::SetVariable($Ident, $Value); - if ($Ident == \HMExtended\HeatingGroupHmIP::ACTIVE_PROFILE) { - if ($OldValue != $Value) { - $this->RefreshScheduleObject(); - } - } } //################# PRIVATE } diff --git a/README.md b/README.md index 1fbe462..8586bf5 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,8 @@ Erweitert IPS um die native Unterstützung von: 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. +* Fehlermeldungen wenn Aktives Zeitprofil in der Konfiguration abgeschaltet und Zeitplan eingeschaltet war. +* Zeitplan schaltet sofort um, wenn sich aktive Zeitprofil ändert. Version 3.70: diff --git a/libs/HMHeatingDevice.php b/libs/HMHeatingDevice.php index 6390b68..357d186 100644 --- a/libs/HMHeatingDevice.php +++ b/libs/HMHeatingDevice.php @@ -19,6 +19,7 @@ * HMHeatingDevice * * @property array $WeekSchedules + * @property int $WeekProfile */ class HMHeatingDevice extends HMBase { @@ -84,6 +85,7 @@ public function Create() $this->RegisterAttributeString('ScheduleColors', json_encode($ScheduleTempsInit)); $this->WeekSchedules = []; + $this->WeekProfile = 1; } /** @@ -105,6 +107,7 @@ public function Destroy() public function ApplyChanges() { parent::ApplyChanges(); + $this->WeekProfile = 1; $Address = $this->ReadPropertyString(\HMExtended\Device\Property::Address); $this->SetReceiveDataFilter($Address == '' ? '.*9999999999.*' : '.*"DeviceID":"' . $Address . static::ValuesChannel . '.*'); @@ -188,6 +191,14 @@ public function RequestAction($Ident, $Value) case \HMExtended\Variables::SELECT_NEW_WEEK_PROGRAM: $this->SetValue($Ident, $Value); return true; + case static::SelectedWeekScheduleIdent: + if ($this->WeekProfile != (int) $Value) { + $this->WeekProfile = (int) $Value; + $this->SendDebug(__FUNCTION__, '', 0); + $this->SendDebug('ActivePlan', $Value, 0); + $this->RefreshScheduleObject(); + } + break; } $Property = $Ident; if (array_key_exists($Ident, \HMExtended\ValuesSet::$Variables[static::DeviceTyp])) { @@ -228,6 +239,7 @@ public function RequestParams() public function ReceiveData($JSONString) { $Event = json_decode($JSONString, true); + $this->SendDebug('EVENT:' . $Event['VariableName'], $Event['VariableValue'], 0); $this->SetVariable($Event['VariableName'], $Event['VariableValue']); return ''; } @@ -249,6 +261,14 @@ protected function IOChangeState($State) protected function SetVariable(string $Ident, $Value) { + if ($Ident == static::SelectedWeekScheduleIdent) { + if ($this->WeekProfile != (int) $Value) { + $this->WeekProfile = (int) $Value; + $this->SendDebug(__FUNCTION__, '', 0); + $this->SendDebug('ActivePlan', $Value, 0); + $this->RefreshScheduleObject(); + } + } @$this->SetValue($Ident, $Value); } @@ -334,8 +354,11 @@ protected function PutValue(string $ValueName, $Value, bool $EmulateStatus = fal return ($Result !== null) ? true : false; } - protected function RefreshScheduleObject(bool $ScheduleActionHasChanged = false) + //################# PRIVATE + + private function RefreshScheduleObject(bool $ScheduleActionHasChanged = false) { + $this->SendDebug(__FUNCTION__, '', 0); if (!$this->ReadPropertyBoolean(\HMExtended\Device\Property::Schedule)) { return; } @@ -354,10 +377,11 @@ protected function RefreshScheduleObject(bool $ScheduleActionHasChanged = false) } $Actions = $this->UpdateScheduleActions($Event, $ScheduleActionHasChanged); if (static::SelectedWeekScheduleIdent) { - $ActivePlan = $this->GetValue(static::SelectedWeekScheduleIdent); + $ActivePlan = $this->WeekProfile; } else { $ActivePlan = 1; } + $this->SendDebug('ActivePlan', $ActivePlan, 0); $ScheduleData = $this->WeekSchedules[$ActivePlan]; foreach ($Event['ScheduleGroups'] as $Group) { $StartHour = 0; @@ -374,8 +398,9 @@ protected function RefreshScheduleObject(bool $ScheduleActionHasChanged = false) } } - protected function SaveSchedule(int $Plan) + private function SaveSchedule(int $Plan) { + $this->SendDebug(__FUNCTION__, '', 0); $EventId = @IPS_GetObjectIDByIdent(self::EVENT, $this->InstanceID); if ($EventId === false) { return; @@ -413,17 +438,16 @@ protected function SaveSchedule(int $Plan) $this->PutParamSet($Params); if (static::SelectedWeekScheduleIdent) { - $ActivePlan = $this->GetValue(static::SelectedWeekScheduleIdent); + $ActivePlan = $this->WeekProfile; } else { $ActivePlan = 1; } + $this->SendDebug('ActivePlan', $ActivePlan, 0); if ($ActivePlan != $Plan) { $this->RefreshScheduleObject(); } } - //################# PRIVATE - private function CreateVariablesFromValues() { $AddressWithChannel = $this->ReadPropertyString(\HMExtended\Device\Property::Address) . static::ValuesChannel; @@ -606,6 +630,7 @@ private function SendRPC(string $MethodName, array $Paramset, $Data = null, bool private function UpdateScheduleActions(array $Event, bool $ScheduleActionHasChanged): array { + $this->SendDebug(__FUNCTION__, '', 0); $ScheduleActionColors = $this->GetTempColorsAttribute(); if ($ScheduleActionHasChanged) { foreach ($Event['ScheduleActions'] as $Action) {