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 17, 2023
1 parent 36d0f03 commit d70dedc
Show file tree
Hide file tree
Showing 30 changed files with 507 additions and 773 deletions.
89 changes: 0 additions & 89 deletions ClimacontrolRegulator/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"caption": "Address"
},
{
"visible": false,
"type": "ExpansionPanel",
"caption": "Schedule",
"expanded": true,
Expand All @@ -16,94 +15,6 @@
"type": "CheckBox",
"caption": "Schedule",
"width": "250px"
},
{
"type": "RowLayout",
"items": [
{
"name": "ScheduleMinTemp",
"type": "NumberSpinner",
"caption": "lowest temperature",
"digits": 0,
"minimum": 5,
"maximum": 17,
"suffix": " °C",
"width": "250px"
},
{
"name": "ScheduleMaxTemp",
"type": "NumberSpinner",
"caption": "highest temperature",
"digits": 0,
"minimum": 18,
"maximum": 30,
"suffix": " °C",
"width": "250px"
},
{
"name": "ScheduleStepsTemp",
"type": "Select",
"caption": "temperature steps",
"options": [
{
"caption": "0,5 °C",
"value": 1
},
{
"caption": "1,0 °C",
"value": 2
},
{
"caption": "2 °C",
"value": 4
},
{
"caption": "3 °C",
"value": 6
},
{
"caption": "4 °C",
"value": 8
},
{
"caption": "5 °C",
"value": 10
},
{
"caption": "6 °C",
"value": 12
},
{
"caption": "7 °C",
"value": 14
},
{
"caption": "8 °C",
"value": 16
}
],
"width": "250px"
}
]
},
{
"type": "RowLayout",
"items": [
{
"name": "ScheduleMinColor",
"type": "SelectColor",
"caption": "lowest temperature color",
"allowTransparent ": false,
"width": "250px"
},
{
"name": "ScheduleMaxColor",
"type": "SelectColor",
"caption": "highest temperature color",
"allowTransparent ": false,
"width": "250px"
}
]
}
]
},
Expand Down
1 change: 1 addition & 0 deletions ClimacontrolRegulator/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"Address": "Adresse",
"Optional status variables": "Optionale Statusvariablen",
"Schedule": "Zeitplan",
"Schedule save": "Zeitplan speichern",
"Temperature": "Temperatur",
"Setpoint temperature": "Solltemperatur",
"Operation mode": "Betriebsart",
Expand Down
23 changes: 12 additions & 11 deletions ClimacontrolRegulator/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,26 @@
* @file module.php
*
* @author Michael Tröger <[email protected]>
* @copyright 2020 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.12
* @version 3.70
*/
require_once __DIR__ . '/../libs/HMDeviceBase.php'; // HMBase Klasse
require_once __DIR__ . '/../libs/HMHeatingDevice.php'; // HMBase Klasse

/**
* HomeMaticClimateControlRegulator
* Erweitert HMDeviceBase. Gerät: HM-CC-TC
*
* Erweitert HMHeatingDevice. Gerät: HM-CC-TC
*/
class HomeMaticClimateControlRegulator extends HMDeviceBase
class HomeMaticClimateControlRegulator extends HMHeatingDevice
{
public const DeviceTyp = \HMExtended\DeviceType::ClimacontrolRegulator;
public const ValuesChannel = \HMExtended\Channels::Second;
public const ParamChannel = \HMExtended\Channels::Second;

protected const WeekScheduleIndexTemp = 'TEMPERATUR_%2$s_%1$d';
protected const WeekScheduleIndexEndTime = 'TIMEOUT_%2$s_%1$d';
protected const NumberOfTimeSlot = 24;
/**
* Interne Funktion des SDK.
*/
Expand Down Expand Up @@ -118,7 +121,7 @@ public function RequestAction($Ident, $Value)
return;
}

protected function SetParamVariable(array $Params)
protected function SetParamVariables(array $Params)
{
$d = new DateTime();
$d->setTime(
Expand All @@ -137,14 +140,12 @@ protected function SetParamVariable(array $Params)
);
$i = new DateInterval('P' . $Params[\HMExtended\ClimacontrolRegulator::PARTY_END_DAY] . 'D');
$Params[\HMExtended\ClimacontrolRegulator::PARTY_END_TIME] = $d->add($i)->getTimestamp();
foreach ($Params as $Ident => $Value) {
@$this->SetValue($Ident, $Value);
}
parent::SetParamVariables($Params);
}

protected function SetVariable(string $Ident, $Value)
{
@$this->SetValue($Ident, $Value);
parent::SetVariable($Ident, $Value);
switch ($Ident) {
case \HMExtended\ClimacontrolRegulator::SETPOINT:
IPS_RunScriptText('IPS_RequestAction(' . $this->InstanceID . ',"getParam",0);');
Expand Down
2 changes: 1 addition & 1 deletion DisplayStatusAnzeige/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Dieses Modul ist Bestandteil der [HomeMaticExtended-Library](../).
Ebenso ist das Timeout einstellbar, nach wieviel Sekunden wieder auf Seite 1 gesprungen wird.

![Instanzen](../docs/HMExtendedInstanzen.png)
Unter Instanz hinzufügen ist das Gerät 'HomeMatic WM55-Dis' unter dem Hersteller 'HomeMatic' zu finden.
Unter Instanz hinzufügen ist das Gerät 'HomeMatic Dis-WM55' unter dem Hersteller 'HomeMatic' zu finden.
Nach dem Anlegen der Instanz sollte als übergeordnetes Gerät schon der HomeMatic Socket ausgewählt sein.
Existieren in IPS mehrere Homematic Socket, so ist der auszuwählen, an welcher CCU das Statusdisplay angelernt ist.

Expand Down
4 changes: 2 additions & 2 deletions DisplayStatusAnzeige/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
* @file module.php
*
* @author Michael Tröger <[email protected]>
* @copyright 2020 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.12
* @version 3.70
*/
require_once __DIR__ . '/../libs/HMBase.php'; // HMBase Klasse

Expand Down
119 changes: 29 additions & 90 deletions ExtendedConfigurator/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
* @file module.php
*
* @author Michael Tröger <[email protected]>
* @copyright 2020 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.12
* @version 3.70
*/
require_once __DIR__ . '/../libs/HMBase.php'; // HMBase Klasse
require_once __DIR__ . '/../libs/HMTypes.php'; // HMTypes Data

/**
* HomeMaticExtendedConfigurator ist die Klasse für das IPS-Modul 'HomeMatic Extended Configurator'.
* Erweitert HMBase.
*
* @property array $DeviceNames
*/
class HomeMaticExtendedConfigurator extends HMBase
{
private $DeviceData = [];
private $listDevices = [];
private $DeviceTyp = '';
/**
* Interne Funktion des SDK.
Expand All @@ -34,7 +34,6 @@ public function Create()
$this->RegisterHMPropertys('XXX9999994');
$this->RegisterPropertyBoolean(\HMExtended\Device\Property::EmulateStatus, false);
$this->RegisterPropertyInteger('Interval', 0);
//$this->DeviceNames = [];
}

/**
Expand All @@ -46,17 +45,6 @@ public function ApplyChanges()
}
//################# PUBLIC

/**
* IPS-Instanz-Funktion 'HM_ReadRFInterfaces'.
* Liest die Daten der RF-Interfaces und versendet sie an die Children.
*
* @return bool True bei Erfolg, sonst false.
*/
public function Test(string $MethodName, int $Protocol, array $Data)
{
return $this->SendRPC($MethodName, $Protocol, $Data);
}

/**
* Interne Funktion des SDK.
*/
Expand All @@ -82,71 +70,10 @@ public function GetConfigurationForm()

return json_encode($Form);
}
/*
$DevicesIDs = IPS_GetInstanceListByModuleID('{36549B96-FA11-4651-8662-F310EEEC5C7D}');
$InstanceIDList = [];
foreach ($DevicesIDs as $DeviceID) {
if (IPS_GetInstance($DeviceID)['ConnectionID'] == $ParentId) {
$InstanceIDList[$DeviceID] = IPS_GetProperty($DeviceID, \HMExtended\Device\Property::Address);
}
}
$Liste = [];
$Result = $this->GetInterfaces();
foreach ($Result as $ProtocolID => $Protocol) {
if (!is_array($Protocol)) {
continue;
}
foreach ($Protocol as $InterfaceIndex => $Interface) {
switch ($ProtocolID) {
case 0:
$Type = 'Funk';
break;
case 2:
$Type = 'HmIP';
break;
default:
$Type = 'unknown';
break;
}
$InstanceID = array_search($Interface['ADDRESS'], $InstanceIDList);
if ($InstanceID !== false) {
$AddValue = [
'instanceID' => $InstanceID,
'name' => IPS_GetName($InstanceID),
'type' => $Type,
'address' => $Interface['ADDRESS'],
'location' => stristr(IPS_GetLocation($InstanceID), IPS_GetName($InstanceID), true)
];
unset($InstanceIDList[$InstanceID]);
} else {
$AddValue = [
'instanceID' => 0,
'name' => $Interface['TYPE'],
'type' => $Type,
'address' => $Interface['ADDRESS'],
'location' => ''
];
}
$AddValue['create'] = [
'moduleID' => '{36549B96-FA11-4651-8662-F310EEEC5C7D}',
'configuration' => [\HMExtended\Device\Property::Address => $Interface['ADDRESS']]
];
$Liste[] = $AddValue;
}
}
foreach ($InstanceIDList as $InstanceID => $Address) {
$AddValue = [
'instanceID' => $InstanceID,
'name' => IPS_GetName($InstanceID),
'type' => 'unknown',
'address' => $Address,
'location' => stristr(IPS_GetLocation($InstanceID), IPS_GetName($InstanceID), true)
];
$Liste[] = $AddValue;
}
*/
$this->DeviceData = $this->LoadDeviceData();
if (IPS_GetProperty($ParentId, 'RFOpen')) {
//$Form['actions'][0]['values'] = array_merge($Form['actions'][0]['values'], $this->GetConfigRows(0, \HMExtended\GUID::Powermeter));
//$Form['actions'][0]['values'] = array_merge($Form['actions'][0]['values'], $this->GetConfigRows(0, \HMExtended\GUID::Dis_WM55));
$Form['actions'][0]['values'] = array_merge($Form['actions'][0]['values'], $this->GetConfigRows(0, \HMExtended\GUID::ClimacontrolRegulator));
}
if (IPS_GetProperty($ParentId, 'GROpen')) {
Expand Down Expand Up @@ -199,6 +126,7 @@ private function GetConfigRows(int $Protocol, string $GUID)
];

$Devices = $this->GetDevices($Protocol, \HMExtended\DeviceType::$GuidToType[$GUID]);
$this->SendDebug('Devices', $Devices, 0);
$IPSDevices = $this->GetInstanceList($GUID, \HMExtended\Device\Property::Address);
foreach ($Devices as &$Device) {
$Device = array_change_key_case($Device);
Expand Down Expand Up @@ -253,17 +181,28 @@ private function GetDeviceData(int $Protocol, array &$Device)
}
}

private function GetDevices(int $Protocol, string $Type)
private function GetDevices(int $Protocol, array $Types)
{
$Result = $this->SendRPC('listDevices', $Protocol, []);
if ($Result === false) {
return [];
if (!array_key_exists($Protocol, $this->listDevices)) {
$Devices = $this->SendRPC('listDevices', $Protocol, []);
if ($Devices === false) {
return [];
}
$this->listDevices[$Protocol] = $Devices;
} else {
$Devices = $this->listDevices[$Protocol];
}
$Result = [];
foreach ($Types as $Type) {
$this->DeviceTyp = $Type;
$Result = array_merge(
$Result,
array_filter($Devices, function ($Device)
{
return $Device['TYPE'] == $this->DeviceTyp;
})
);
}
$this->DeviceTyp = $Type;
$Result = array_filter($Result, function ($Device)
{
return $Device['TYPE'] == $this->DeviceTyp;
});
return array_values($Result);
}

Expand Down Expand Up @@ -316,7 +255,7 @@ private function SendRPC(string $MethodName, int $Protocol, array $Data)
'DataID' => \HMExtended\GUID::SendRpcToIO,
'Protocol' => $Protocol,
'MethodName' => $MethodName,
'WaitTime' => 5000,
'WaitTime' => 3,
'Data' => $Data
];
$this->SendDebug('Send', $ParentData, 0);
Expand All @@ -326,8 +265,8 @@ private function SendRPC(string $MethodName, int $Protocol, array $Data)
$this->SendDebug('Error', '', 0);
return false;
}
$this->SendDebug('Receive', $ResultJSON, 0);
$Result = json_decode(utf8_encode($ResultJSON), true);
$this->SendDebug('Receive', $Result, 0);
return $Result;
}
}
Expand Down
Loading

0 comments on commit d70dedc

Please sign in to comment.