Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
Nall-chan committed Dec 25, 2023
1 parent 2b65a01 commit a2a31d1
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 17 deletions.
3 changes: 0 additions & 3 deletions HeatingGroup/module.php
Expand Up @@ -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);
Expand Down
9 changes: 1 addition & 8 deletions HeatingGroupHmIP/module.php
Expand Up @@ -18,6 +18,7 @@
/**
* HomeMaticIPHeatingGroup
* Erweitert HMHeatingDevice Virtuelles Gerät: HmIP-HEATING
*
*/
class HomeMaticIPHeatingGroup extends HMHeatingDevice
{
Expand Down Expand Up @@ -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') {
Expand All @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -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:

Expand Down
37 changes: 31 additions & 6 deletions libs/HMHeatingDevice.php
Expand Up @@ -19,6 +19,7 @@
* HMHeatingDevice
*
* @property array $WeekSchedules
* @property int $WeekProfile
*/
class HMHeatingDevice extends HMBase
{
Expand Down Expand Up @@ -84,6 +85,7 @@ public function Create()
$this->RegisterAttributeString('ScheduleColors', json_encode($ScheduleTempsInit));

$this->WeekSchedules = [];
$this->WeekProfile = 1;
}

/**
Expand All @@ -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 . '.*');

Expand Down Expand Up @@ -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])) {
Expand Down Expand Up @@ -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 '';
}
Expand All @@ -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);
}

Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a2a31d1

Please sign in to comment.