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 18, 2023
1 parent d70dedc commit 762f7e5
Show file tree
Hide file tree
Showing 29 changed files with 335 additions and 282 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/style.yml
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .vscode
Submodule .vscode updated 1 files
+6 −6 tasks.json
12 changes: 12 additions & 0 deletions ClimacontrolRegulator/form.json
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion ClimacontrolRegulator/locale.json
Expand Up @@ -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",
Expand Down
31 changes: 12 additions & 19 deletions ClimacontrolRegulator/module.php
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* @addtogroup homematicextended
* @addtogroup HomeMaticExtended
* @{
*
* @file module.php
Expand All @@ -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

Expand All @@ -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();

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

/* @} */
45 changes: 23 additions & 22 deletions DisplayStatusAnzeige/module.php
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);
/**
* @addtogroup homematicextended
* @addtogroup HomeMaticExtended
* @{
*
* @file module.php
Expand All @@ -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

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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();
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -146,15 +147,15 @@ public function ResetTimer()
/**
* Wird ausgeführt wenn der Kernel hochgefahren wurde.
*/
protected function KernelReady()
protected function KernelReady(): void
{
$this->ApplyChanges();
}

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

0 comments on commit 762f7e5

Please sign in to comment.