Skip to content

Commit

Permalink
Merge branch 'main' into patch-6
Browse files Browse the repository at this point in the history
  • Loading branch information
Schnittcher authored Oct 27, 2023
2 parents c18b4b2 + 67f455c commit f32ead8
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Device/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
"Emergency": "Notfall",
"Energy": "Energie",
"Enrolled": "Enrolled",
"Error": "Fehler",
"Excellent": "Exzellent",
"External Measured Room Sensor": "Extern gemessener Raumfühler",
"Externally": "Extern",
Expand Down Expand Up @@ -332,6 +333,10 @@
"LED disable night": "LED NAchtabschaltung",
"LED Enable": "LED Status",
"LED State": "LED-Status",
"Left Hold": "Links Halten",
"Left Hold Release": "Links Halten beendet",
"Left Press": "Links Gedrückt",
"Left Press Release": "Links Drücken beendet",
"Level": "Stufe",
"Lily": "Lilie",
"Linkage Alarm State": "Verknüpfungsalarmzustand",
Expand All @@ -344,6 +349,7 @@
"Local Temperature": "Lokale Temperatur",
"Lock 1": "Sperre 1",
"Lock 2": "Sperre 2",
"Long": "Lange",
"Lost": "Verloren",
"Lovebirds": "Liebesvögel",
"Low": "Niedrig",
Expand Down Expand Up @@ -482,6 +488,10 @@
"Resplendent": "Strahlend",
"Restore Reports": "Restore Reports",
"restore": "Wiederherstellen",
"Right Hold": "Rechts Halten",
"Right Hold Release": "Rechts Halten Beendet",
"Right Press", "Rechts Gedrückt",
"Right Press Release", "Rechts Gedrückt Beendet",
"Rio": "Rio",
"Rosy Sparkle": "Rosiger Glanz",
"Rotate Left": "Links drehen",
Expand All @@ -492,6 +502,7 @@
"Runy Glow": "Flüssiges Glühen",
"Saturday": "Samstag",
"Savanna Sunset": "Savanna Sonnenuntergang",
"Scale Protection": "Ventil Schutz",
"Scarlet Dream": "Scarlets Traum",
"Scene": "Szene",
"Schedule": "Geplant",
Expand Down
54 changes: 53 additions & 1 deletion libs/Zigbee2MQTTHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public function RequestAction($Ident, $Value)
case 'Z2M_DeviceMode':
$Payload['device_mode'] = $Value;
break;
case 'Z2M_ScaleProtection':
$Payload['scale_protection'] = strval($this->OnOff($Value));
break;
case 'Z2M_LearnIRCode':
$Payload['learn_ir_code'] = strval($this->OnOff($Value));
break;
Expand Down Expand Up @@ -636,6 +639,19 @@ public function ReceiveData($JSONString)
if (array_key_exists('device_mode', $Payload)) {
$this->SetValue('Z2M_DeviceMode', $Payload['device_mode']);
}
if (array_key_exists('scale_protection', $Payload)) {
switch ($Payload['scale_protection']) {
case 'ON':
$this->SetValue('Z2M_ScaleProtection', true);
break;
case 'OFF':
$this->SetValue('Z2M_ScaleProtection', false);
break;
default:
$this->SendDebug('Z2M_ScaleProtection', 'Undefined State: ' . $Payload['scale_protection'], 0);
break;
}
}
if (array_key_exists('learn_ir_code', $Payload)) {
switch ($Payload['learn_ir_code']) {
case 'ON':
Expand All @@ -649,6 +665,9 @@ public function ReceiveData($JSONString)
break;
}
}
if (array_key_exists('error', $Payload)) {
$this->SetValue('Z2M_TRVError', $Payload['error']);
}
if (array_key_exists('learned_ir_code', $Payload)) {
$this->SetValue('Z2M_LearnedIRCode', $Payload['learned_ir_code']);
}
Expand Down Expand Up @@ -2475,11 +2494,14 @@ private function registerVariableProfile($expose)
}
break;
case 'Z2M.action.d9f7f4ac':
case 'Z2M.action.a3d14936':
if (!IPS_VariableProfileExists($ProfileName)) {
$this->RegisterProfileStringEx($ProfileName, 'Information', '', '', [
['single', $this->Translate('Single'), '', 0x00FF00],
['double', $this->Translate('Double'), '', 0x00FF00],
['hold', $this->Translate('Hold'), '', 0x00FF00],
['long', $this->Translate('Long'), '', 0x00FF00],

]);
}
break;
Expand Down Expand Up @@ -2550,6 +2572,7 @@ private function registerVariableProfile($expose)
]);
}
break;
case 'Z2M.action.dc7fd161':
case 'Z2M.action.dc7fd161':
if (!IPS_VariableProfileExists($ProfileName)) {
$this->RegisterProfileStringEx($ProfileName, 'Information', '', '', [
Expand Down Expand Up @@ -2720,7 +2743,21 @@ private function registerVariableProfile($expose)
]);
}
break;

case 'Z2M.action.e87c79ad':
if (!IPS_VariableProfileExists($ProfileName)) {
$this->RegisterProfileStringEx($ProfileName, 'Information', '', '', [
['left_hold', $this->Translate('Left Hold'), '', 0x00FF00],
['left_hold_release', $this->Translate('Left Hold Release'), '', 0x00FF00],
['left_press', $this->Translate('Left Press'), '', 0x00FF00],
['left_press_release', $this->Translate('Left Press Release'), '', 0x00FF00],
['right_hold', $this->Translate('Right Hold'), '', 0x00FF00],
['right_hold_release', $this->Translate('Right Hold Release'), '', 0x00FF00],
['right_press', $this->Translate('Right Press'), '', 0x00FF00],
['right_press_release', $this->Translate('Right Press Release'), '', 0x00FF00],
['toggle', $this->Translate('Toggle'), '', 0x00FF00]
]);
}
break;
case 'Z2M.action.85b816e8':
if (!IPS_VariableProfileExists($ProfileName)) {
$this->RegisterProfileStringEx($ProfileName, 'Information', '', '', [
Expand Down Expand Up @@ -3509,6 +3546,11 @@ private function registerVariableProfile($expose)
break;
case 'numeric':
switch ($expose['property']) {
case 'error':
if (!IPS_VariableProfileExists($ProfileName)) {
$this->RegisterProfileInteger($ProfileName, 'Alert', '', ' ', 0, 0, 0);
}
break;
case 'alarm_time':
$ProfileName .= $expose['value_min'] . '_' . $expose['value_max'];
$ProfileName = str_replace(',', '.', $ProfileName);
Expand Down Expand Up @@ -4318,6 +4360,10 @@ private function mapExposesToVariables(array $exposes)
break; //Lock break
case 'binary':
switch ($expose['property']) {
case 'scale_protection':
$this->RegisterVariableBoolean('Z2M_ScaleProtection', $this->Translate('Scale Protection'), '~Switch');
$this->EnableAction('Z2M_ScaleProtection');
break;
case 'charge_state':
$this->RegisterVariableBoolean('Z2M_ChargeState', $this->Translate('Charge State'), 'Z2M.ChargeState');
break;
Expand Down Expand Up @@ -4935,6 +4981,12 @@ private function mapExposesToVariables(array $exposes)
break; //enum break
case 'numeric':
switch ($expose['property']) {
case 'error':
$ProfileName = $this->registerVariableProfile($expose);
if ($ProfileName != false) {
$this->RegisterVariableInteger('Z2M_TRVError', $this->Translate('Error'), $ProfileName);
}
break;
case 'alarm_time':
$ProfileName = $this->registerVariableProfile($expose);
if ($ProfileName != false) {
Expand Down

0 comments on commit f32ead8

Please sign in to comment.