From c1fd224c803e5b3f6ea9806836f52e7c57890812 Mon Sep 17 00:00:00 2001 From: Burkhard Kneiseler Date: Sat, 20 Jul 2024 06:48:41 +0200 Subject: [PATCH 1/3] ADD: Exposes Belongs to: https://community.symcon.de/t/modul-zigbee2mqtt/49507/3565?u=burki24 ADD: Z2M_ActionType Z2M_ActionDirection Z2M_ActionTime Z2M_Brightness (outside from Light) --- libs/Zigbee2MQTTHelper.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/libs/Zigbee2MQTTHelper.php b/libs/Zigbee2MQTTHelper.php index 258abd8..1dca581 100644 --- a/libs/Zigbee2MQTTHelper.php +++ b/libs/Zigbee2MQTTHelper.php @@ -871,6 +871,15 @@ public function ReceiveData($JSONString) $this->RegisterVariableInteger('Z2M_LastSeen', $this->Translate('Last Seen'), '~UnixTimestamp'); $this->SetValue('Z2M_LastSeen', ($Payload['last_seen'] / 1000)); } + if (array_key_exists('action_type', $Payload)) { + $this->SetValue('Z2M_ActionType', $Payload['action_type']); + } + if (array_key_exists('action_time', $Payload)) { + $this->SetValue('Z2M_ActionTime', $Payload['action_time']); + } + if (array_key_exists('action_direction', $Payload)) { + $this->SetValue('Z2M_ActionDirection', $Payload['action_direction']); + } if (array_key_exists('device_fault', $Payload)) { $this->handleStateChange('device_fault', 'Z2M_DeviceFault', 'Device Fault', $Payload); } @@ -2580,6 +2589,22 @@ private function registerVariableProfile($expose) $ProfileName .= '.'; $ProfileName .= dechex(crc32($tmpProfileName)); switch ($ProfileName) { + case 'Z2M.action_type': + if (!IPS_VariableProfileExists($ProfileName)) { + $this->RegisterProfileStringEx($ProfileName, 'Information', '', '', [ + ['step', $this->Translate('Step'), '', 0x00FF00], + ['rotate', $this->Translate('Rotate'), '', 0x00FF00], + ]); + } + break; + case 'Z2M.action_direction': + if (!IPS_VariableProfileExists($ProfileName)) { + $this->RegisterProfileStringEx($ProfileName, 'Information', '', '', [ + ['left', $this->Translate('Left'), '', 0x00FF00], + ['right', $this->Translate('Right'), '', 0x00FF00], + ]); + } + break; case 'Z2M.identify.12619917': if (!IPS_VariableProfileExists($ProfileName)) { $this->RegisterProfileStringEx($ProfileName, 'Identify', '', '', [ @@ -4697,6 +4722,7 @@ private function registerVariableProfile($expose) } break; case 'occupancy_timeout': + case 'action_time': $ProfileName .= $expose['value_min'] . '_' . $expose['value_max']; $ProfileName = str_replace(',', '.', $ProfileName); if (!IPS_VariableProfileExists($ProfileName)) { From c77f60abd16ac318f5adbe58be3934f04dd69bbc Mon Sep 17 00:00:00 2001 From: Burkhard Kneiseler Date: Sat, 20 Jul 2024 07:01:04 +0200 Subject: [PATCH 2/3] Update locale.json --- Device/locale.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Device/locale.json b/Device/locale.json index 44db83c..6bb595c 100644 --- a/Device/locale.json +++ b/Device/locale.json @@ -18,6 +18,7 @@ "Action angle": "Aktionswinkel", "Action Code": "Aktions Code", "Action Color Temperature": "Aktion Farbtemperatur", + "Action Direction": "Aktionsrichtung", "Action Duration": "Aktionsdauer", "Action from side": "Aktion von der Seite", "Action Group": "Aktionsgruppe", @@ -27,6 +28,8 @@ "Action to side": "Aktion zur Seite", "Action Transaction": "Aktion Transaktion", "Action Transition Time": "Aktion Übergangszeit", + "Action Type": "Aktionsart", + "Action Time": "Aktionszeit", "Action Zone": "Aktionsbereich", "Action": "Aktion", "Adaptation Run Control": "Anpassungslaufsteuerung", @@ -426,6 +429,7 @@ "Led Indication": "LED-Anzeige", "LED Indicator": "LED-Anzeige", "Leave": "Verlassen", + "Left": "Links", "Left Leave": "Links Verlassen", "Left Enter": "Links Enter", "Left Hold": "Links Halten", @@ -652,6 +656,7 @@ "Resplendent": "Strahlend", "Restore Reports": "Restore Reports", "restore": "Wiederherstellen", + "Right": "Rechts", "Right Enter": "Rechts Enter", "Right Hold": "Rechts Halten", "Right Hold Release": "Rechts Halten Beendet", @@ -660,6 +665,7 @@ "Right Press Release": "Rechts Gedrückt Beendet", "Rio": "Rio", "Rosy Sparkle": "Rosiger Glanz", + "Rotate": "Drehen", "Rotate Left": "Links drehen", "Rotate Right": "Rechts drehen", "Rotate Stop": "Drehen anhalten", @@ -739,6 +745,7 @@ "State Right": "Status rechts", "State White": "Status Weiß", "State": "Status", + "Step": "Schritt", "Stop": "Stop", "Stop Effect": "Effekt beenden", "Stop Colorloop": "Farbverlauf stoppen", From 114bd26a07408b3f56c5791afc0b0835e520e08b Mon Sep 17 00:00:00 2001 From: Burkhard Kneiseler Date: Mon, 22 Jul 2024 16:34:04 +0200 Subject: [PATCH 3/3] FIX: $Profilname -> $ProfilName --- libs/Zigbee2MQTTHelper.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libs/Zigbee2MQTTHelper.php b/libs/Zigbee2MQTTHelper.php index 1dca581..c00f354 100644 --- a/libs/Zigbee2MQTTHelper.php +++ b/libs/Zigbee2MQTTHelper.php @@ -6958,32 +6958,32 @@ private function mapExposesToVariables(array $exposes) } break; case 'action_rate': - $Profilename = $this->registerVariableProfile($expose); - if ($Profilename != false) { + $ProfileName = $this->registerVariableProfile($expose); + if ($ProfileName != false) { $this->RegisterVariableInteger('Z2M_ActionRate', $this->Translate('Action Rate'), $ProfileName); } break; case 'action_step_size': - $Profilename = $this->registerVariableProfile($expose); - if ($Profilename != false) { + $ProfileName = $this->registerVariableProfile($expose); + if ($ProfileName != false) { $this->RegisterVariableInteger('Z2M_ActionStepSize', $this->Translate('Action Step Size'), $ProfileName); } break; case 'action_transition_time': - $Profilename = $this->registerVariableProfile($expose); - if ($Profilename != false) { + $ProfileName = $this->registerVariableProfile($expose); + if ($ProfileName != false) { $this->RegisterVariableInteger('Z2M_ActionTransTime', $this->Translate('Action Transition Time'), $ProfileName); } break; case 'action_group': - $Profilename = $this->registerVariableProfile($expose); - if ($Profilename != false) { + $ProfileName = $this->registerVariableProfile($expose); + if ($ProfileName != false) { $this->RegisterVariableInteger('Z2M_ActionGroup', $this->Translate('Action Group'), $ProfileName); } break; case 'action_color_temperature': - $Profilename = $this->registerVariableProfile($expose); - if ($Profilename != false) { + $ProfileName = $this->registerVariableProfile($expose); + if ($ProfileName != false) { $this->RegisterVariableInteger('Z2M_ActionColorTemp', $this->Translate('Action Color Temperature'), $ProfileName); } break;