From cf00bfe69b238f8b92cbe458a40831898c2594a6 Mon Sep 17 00:00:00 2001 From: Burki24 Date: Sat, 24 Feb 2024 06:40:21 +0100 Subject: [PATCH 01/10] ADD: missed exposes Temp-Display Belong to: https://community.symcon.de/t/modul-zigbee2mqtt/49507/3187?u=burki24 --- Device/locale.json | 9 ++ libs/Zigbee2MQTTHelper.php | 187 +++++++++++++++++++++++++++++++++++++ 2 files changed, 196 insertions(+) diff --git a/Device/locale.json b/Device/locale.json index 74c8e5a4..88c801b6 100644 --- a/Device/locale.json +++ b/Device/locale.json @@ -333,6 +333,8 @@ "Humidity Alarm": "Luftfeuchtigkeits Alarm", "Humidity Max": "Luftfeuchtigkeitgrenze max", "Humidity Min": "Luftfeuchtigkeitsgrenze min", + "Humidity Periodic Report": "Luftfeuchtigkeit Periodische Berichte", + "Humidity Sensitivity": "Empfindlichkeit Luftfeuchtigkeitswert", "Humidity": "Luftfeuchte", "Ibiza": "Ibiza", "Idle": "Standby", @@ -403,6 +405,8 @@ "Many": "Viele", "Max Brightness L1": "Max Helligkeit L1", "Max Brightness L2": "Max Helligkeit L2", + "Max Humidity Alarm": "Maximale Alarmluftfeuchtigkeit", + "Max Temperature Alarm": "Maximale Alarmtemperatur", "Max Temperature Limit": "Maximale Temperaturgrenze", "Max Temperature": "Max Temperatur", "Maximum Range": "Maximale Reichweite", @@ -421,7 +425,10 @@ "Midwinter": "Mittwinter", "Min Brightness L1": "Min Helligkeit L1", "Min Brightness L2": "Min Helligkeit L2", + "Min Humidity Alarm": "Minimale Alarmluftfeuchtigkeit", "Min Temperature": "Min Temperatur", + "Min Temperature Alarm": "Minimale Alarmtemperatur", + "Min Temperature Limit": "Minimale Temperaturgrenze", "Minimum Range": "Minimale Reichweite", "Minutes": "Minutes", "Mode": "Modus", @@ -669,6 +676,8 @@ "Temperature Unit": "Temperatureinheit", "Temperature": "Temperatur", "temporary_manual": "Vorrübergehend Manuell", + "Temperature Sensitivity": "Temperatur Empfindlichkeit", + "Temperature Periodic Report": "Temperatur Periodischer Report", "Test": "Test", "Thermostat Vertical Orientation": "Vertikale Thermostatausrichtung", "Throw": "werfen", diff --git a/libs/Zigbee2MQTTHelper.php b/libs/Zigbee2MQTTHelper.php index a0a98198..9336a52a 100644 --- a/libs/Zigbee2MQTTHelper.php +++ b/libs/Zigbee2MQTTHelper.php @@ -11,6 +11,36 @@ public function RequestAction($Ident, $Value) $variableID = $this->GetIDForIdent($Ident); $variableType = IPS_GetVariable($variableID)['VariableType']; switch ($Ident) { + case 'Z2M_TemperaturePeriodicReport': + $Payload['temperature_periodic_report'] = $Value; + break; + case 'Z2M_HumidityPeriodicReport': + $Payload['humidity_periodic_report'] = $Value; + break; + case 'Z2M_TemperatureSensitivity': + $Payload['temperature_sensitivity'] = $Value; + break; + case 'Z2M_HumiditySensitivity': + $Payload['humidity_sensitivity'] = $Value; + break; + case 'Z2M_TemperatureAlarm': + $Payload['temperature_alarm'] = $Value; + break; + case 'Z2M_HumidityAlarm': + $Payload['humidity_alarm'] = $Value; + break; + case'Z2M_MinHumidityAlarm': + $Payload['min_humidity_alarm'] = $Value; + break; + case 'Z2M_MaxHumidityAlarm': + $Payload['max_humidity_alarm'] = $Value; + break; + case 'Z2M_MaxTemperatureAlarm': + $Payload['max_temperature_alarm'] = $Value; + break; + case 'Z2M_MinTemperatureAlarm': + $Payload['min_temperature_alarm'] = $Value; + break; case 'Z2M_Online': $Payload['online'] = strval($this->OnOff($Value)); break; @@ -753,6 +783,36 @@ 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('temperature_periodic_report', $Payload)) { + $this->SetValue('Z2M_TemperaturePeriodicReport', $Payload['temperature_periodic_report']); + } + if (array_key_exists('humidity_periodic_report', $Payload)) { + $this->SetValue('Z2M_HumidityPeriodicReport', $Payload['humidity_periodic_report']); + } + if (array_key_exists('temperature_sensitivity', $Payload)) { + $this->SetValue('Z2M_TemperatureSensitivity', $Payload['temperature_sensitivity']); + } + if (array_key_exists('humidity_sensitivity', $Payload)) { + $this->SetValue('Z2M_HumiditySensitivity', $Payload['humidity_sensitivity']); + } + if (array_key_exists('temperature_alarm', $Payload)) { + $this->SetValue('Z2M_TemperatureAlarm', $Payload['temperature_alarm']); + } + if (array_key_exists('humidity_alarm', $Payload)) { + $this->SetValue('Z2M_HumidityAlarm', $Payload['humidity_alarm']); + } + if (array_key_exists('max_temperature_alarm', $Payload)) { + $this->SetValue('Z2M_MaxTemperatureAlarm', $Payload['max_temperature_alarm']); + } + if (array_key_exists('min_temperature_alarm', $Payload)) { + $this->SetValue('Z2M_MinTemperatureAlarm', $Payload['min_temperature_alarm']); + } + if (array_key_exists('max_humidity_alarm', $Payload)) { + $this->SetValue('Z2M_MaxHumidityAlarm', $Payload['max_humidity_alarm']); + } + if (array_key_exists('min_humidity_alarm', $Payload)) { + $this->SetValue('Z2M_MinHumidityAlarm', $Payload['min_humidity_alarm']); + } if (array_key_exists('online', $Payload)) { $this->SetValue('Z2M_Online', $Payload['online']); } @@ -2640,6 +2700,16 @@ private function registerVariableProfile($expose) $ProfileName .= '.'; $ProfileName .= dechex(crc32($tmpProfileName)); switch ($ProfileName) { + case 'Z2M_temperature_alarm.15475477': + case 'Z2M_humidity_alarm.15475477': + if (!IPS_VariableProfileExists($ProfileName)) { + $this->RegisterProfileStringEx($ProfileName, 'Alarm', '', '', [ + ['lower_alarm', $this->Translate('Lower Alarm'), '', 0x00FF00], + ['upper_alarm', $this->Translate('Upper Alarm'), '', 0x00FF00], + ['cancel', $this->Translate('Cancel'), '', 0x00FF00], + ]); + } + break; case 'Z2M.working_day.19c5c139': if (!IPS_VariableProfileExists($ProfileName)) { $this->RegisterProfileStringEx($ProfileName, 'Information', '', '', [ @@ -4097,6 +4167,54 @@ private function registerVariableProfile($expose) break; case 'numeric': switch ($expose['property']) { + case 'temperature_periodic_report': + $ProfileName = $expose['value_min'] . '_' . $expose['value_max']; + if (!IPS_VariableProfileExists($ProfileName)) { + $this->RegisterProfileInteger($ProfileName, 'Report', '', ' ' . $expose['unit'], $expose['value_min'], $expose['value_max'], 1, 0); + } + break; + case 'humidity_periodic_report': + $ProfileName = $expose['value_min'] . '_' . $expose['value_max']; + if (!IPS_VariableProfileExists($ProfileName)) { + $this->RegisterProfileInteger($ProfileName, 'Report', '', ' ' . $expose['unit'], $expose['value_min'], $expose['value_max'], 1, 0); + } + break; + case 'temperature_sensitivity': + $ProfileName = $expose['value_min'] . '_' . $expose['value_max']; + if (!IPS_VariableProfileExists($ProfileName)) { + $this->RegisterProfileInteger($ProfileName, 'Report', '', ' ' . $expose['unit'], $expose['value_min'], $expose['value_max'], 1, 0); + } + break; + case 'humidity_sensitivity': + $ProfileName = $expose['value_min'] . '_' . $expose['value_max']; + if (!IPS_VariableProfileExists($ProfileName)) { + $this->RegisterProfileInteger($ProfileName, 'Report', '', ' ' . $expose['unit'], $expose['value_min'], $expose['value_max'], 1, 0); + } + break; + case 'min_temperature_alarm': + $ProfileName = $expose['value_min'] . '_' . $expose['value_max']; + if (!IPS_VariableProfileExists($ProfileName)) { + $this->RegisterProfileInteger($ProfileName, 'Alert', '', ' ' . $expose['unit'], $expose['value_min'], $expose['value_max'], 1, 0); + } + break; + case 'max_humidity_alarm': + $ProfileName = $expose['value_min'] . '_' . $expose['value_max']; + if (!IPS_VariableProfileExists($ProfileName)) { + $this->RegisterProfileInteger($ProfileName, 'Alert', '', ' ' . $expose['unit'], $expose['value_min'], $expose['value_max'], 1, 0); + } + break; + case 'min_humidity_alarm': + $ProfileName = $expose['value_min'] . '_' . $expose['value_max']; + if (!IPS_VariableProfileExists($ProfileName)) { + $this->RegisterProfileInteger($ProfileName, 'Alert', '', ' ' . $expose['unit'], $expose['value_min'], $expose['value_max'], 1, 0); + } + break; + case 'max_temperature_alarm': + $ProfileName = $expose['value_min'] . '_' . $expose['value_max']; + if (!IPS_VariableProfileExists($ProfileName)) { + $this->RegisterProfileInteger($ProfileName, 'Alert', '', ' ' . $expose['unit'], $expose['value_min'], $expose['value_max'], 1, 0); + } + break; case 'error_status': if (!IPS_VariableProfileExists($ProfileName)) { $this->RegisterProfileInteger($ProfileName, 'Alert', '', '', 0, 100, 1, 0); @@ -5491,6 +5609,20 @@ private function mapExposesToVariables(array $exposes) break; //binary break case 'enum': switch ($expose['property']) { + case 'humidity_alarm': + $ProfileName = $this->registerVariableProfile($expose); + if ($ProfileName != false) { + $this->RegisterVariableString('Z2M_HumidityAlarm', $this->Translate('Humidity Alarm'), $ProfileName); + $this->EnableAction('Z2M_HumidityAlarm'); + } + break; + case 'temperature_alarm': + $ProfileName = $this->registerVariableProfile($expose); + if ($ProfileName != false) { + $this->RegisterVariableString('Z2M_TemperatureAlarm', $this->Translate('Temperature Alarm'), $ProfileName); + $this->EnableAction('Z2M_TemperatureAlarm'); + } + break; case 'working_day': $ProfileName = $this->registerVariableProfile($expose); if ($ProfileName != false) { @@ -5932,6 +6064,61 @@ private function mapExposesToVariables(array $exposes) break; //enum break case 'numeric': switch ($expose['property']) { + case 'humidity_sensitivity': + $ProfileName = $this->registerVariableProfile($expose); + if ($ProfileName != false) { + $this->RegisterVariableInteger('Z2M_HumiditySensitivity', $this->Translate('Humidity Sensitivity'), $ProfileName); + $this->EnableAction('Z2M_HumiditySensitivity'); + } + break; + case 'temperature_sensitivity': + $ProfileName = $this->registerVariableProfile($expose); + if ($ProfileName != false) { + $this->RegisterVariableInteger('Z2M_TemperatureSensitivity', $this->Translate('Temperature Sensitivity'), $ProfileName); + $this->EnableAction('Z2M_TemperatureSensitivity'); + } + break; + case 'humidity_periodic_report': + $ProfileName = $this->registerVariableProfile($expose); + if ($ProfileName != false) { + $this->RegisterVariableInteger('Z2M_HumidityPeriodicReport', $this->Translate('Humidity Periodic Report'), $ProfileName); + $this->EnableAction('Z2M_HumidityPeriodicReport'); + } + break; + case 'temperature_periodic_report': + $ProfileName = $this->registerVariableProfile($expose); + if ($ProfileName != false) { + $this->RegisterVariableInteger('Z2M_TemperaturePeriodicReport', $this->Translate('Temperature Periodic Report'), $ProfileName); + $this->EnableAction('Z2M_TemperaturePeriodicReport'); + } + break; + case 'max_temperature_alarm': + $ProfileName = $this->registerVariableProfile($expose); + if ($ProfileName != false) { + $this->RegisterVariableInteger('Z2M_MaxTemperatureAlarm', $this->Translate('Max Temperature Alarm'), $ProfileName); + $this->EnableAction('Z2M_MaxTemperatureAlarm'); + } + break; + case 'min_temperature_alarm': + $ProfileName = $this->registerVariableProfile($expose); + if ($ProfileName != false) { + $this->RegisterVariableInteger('Z2M_MinTemperatureAlarm', $this->Translate('Min Temperature Alarm'), $ProfileName); + $this->EnableAction('Z2M_MinTemperatureAlarm'); + } + case 'max_humidity_alarm': + $ProfileName = $this->registerVariableProfile($expose); + if ($ProfileName != false) { + $this->RegisterVariableInteger('Z2M_MaxHumidityAlarm', $this->Translate('Max Humidity Alarm'), $ProfileName); + $this->EnableAction('Z2M_MaxHumidityAlarm'); + } + break; + case 'min_humidity_alarm': + $ProfileName = $this->registerVariableProfile($expose); + if ($ProfileName != false) { + $this->RegisterVariableInteger('Z2M_MinHumidityAlarm', $this->Translate('Min Humidity Alarm'), $ProfileName); + $this->EnableAction('Z2M_MinHumidityAlarm'); + } + break; case 'error_status': $ProfileName = $this->registerVariableProfile($expose); if ($ProfileName != false) { From af34ff10818240334352d4d65c87c3cc25042019 Mon Sep 17 00:00:00 2001 From: Burki24 Date: Sat, 24 Feb 2024 06:45:06 +0100 Subject: [PATCH 02/10] FIX: [lint] (no_break_comment) --- libs/Zigbee2MQTTHelper.php | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/Zigbee2MQTTHelper.php b/libs/Zigbee2MQTTHelper.php index 9336a52a..61f2add3 100644 --- a/libs/Zigbee2MQTTHelper.php +++ b/libs/Zigbee2MQTTHelper.php @@ -6105,6 +6105,7 @@ private function mapExposesToVariables(array $exposes) $this->RegisterVariableInteger('Z2M_MinTemperatureAlarm', $this->Translate('Min Temperature Alarm'), $ProfileName); $this->EnableAction('Z2M_MinTemperatureAlarm'); } + break; case 'max_humidity_alarm': $ProfileName = $this->registerVariableProfile($expose); if ($ProfileName != false) { From eb140e644a2ed76ecd6c25cb67fc57edcd1c7554 Mon Sep 17 00:00:00 2001 From: Burki24 Date: Sun, 25 Feb 2024 04:36:25 +0100 Subject: [PATCH 03/10] FIX: WaterValve Belongs to: https://community.symcon.de/t/modul-zigbee2mqtt/49507/3189?u=burki24 --- Device/locale.json | 1 + libs/Zigbee2MQTTHelper.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Device/locale.json b/Device/locale.json index 88c801b6..fa683f03 100644 --- a/Device/locale.json +++ b/Device/locale.json @@ -168,6 +168,7 @@ "Calibration": "Kalibrierung", "Cancel Adaptation": "Anpassung abbrechen", "Cancun": "Cancún", + "Capacity": "Kapazität", "Carbon Monoxide": "Kohlenmonoxid", "Charge State": "Ladezustand", "Charging": "Aufladen", diff --git a/libs/Zigbee2MQTTHelper.php b/libs/Zigbee2MQTTHelper.php index 61f2add3..4712ca7b 100644 --- a/libs/Zigbee2MQTTHelper.php +++ b/libs/Zigbee2MQTTHelper.php @@ -4010,6 +4010,14 @@ private function registerVariableProfile($expose) ]); } break; + case 'Z2M.mode.a774535': + if (!IPS_VariableProfileExists($ProfileName)) { + $this->RegisterProfileStringEx($ProfileName, 'Mode', '', '', [ + ['duration', $this->Translate('Duration'), '', 0x00FF00], + ['capacity', $this->Translate('Capacity'), '', 0xFF8800] + ]); + } + break; case 'Z2M.mode.fecb2e2f': if (!IPS_VariableProfileExists($ProfileName)) { $this->RegisterProfileStringEx($ProfileName, 'Intensity', '', '', [ @@ -6136,13 +6144,13 @@ private function mapExposesToVariables(array $exposes) case 'irrigation_start_time': $ProfileName = $this->registerVariableProfile($expose); if ($ProfileName != false) { - $this->RegisterVariableInteger('Z2M_IrrigationStartTime', $this->Translate('Irrigation Start Time'), $ProfileName); + $this->RegisterVariableFloat('Z2M_IrrigationStartTime', $this->Translate('Irrigation Start Time'), $ProfileName); } break; case 'irrigation_end_time': $ProfileName = $this->registerVariableProfile($expose); if ($ProfileName != false) { - $this->RegisterVariableInteger('Z2M_IrrigationEndTime', $this->Translate('Irrigation End Time'), $ProfileName); + $this->RegisterVariableFloat('Z2M_IrrigationEndTime', $this->Translate('Irrigation End Time'), $ProfileName); } break; case 'last_irrigation_duration': From 7b676c6f448d55d8571e2e24a405095efc67704c Mon Sep 17 00:00:00 2001 From: Burki24 Date: Sun, 25 Feb 2024 08:17:49 +0100 Subject: [PATCH 04/10] ADD: backlicht_mode as bool --- libs/Zigbee2MQTTHelper.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libs/Zigbee2MQTTHelper.php b/libs/Zigbee2MQTTHelper.php index 4712ca7b..04c81a64 100644 --- a/libs/Zigbee2MQTTHelper.php +++ b/libs/Zigbee2MQTTHelper.php @@ -4853,6 +4853,10 @@ private function mapExposesToVariables(array $exposes) switch ($feature['type']) { case 'binary': switch ($feature['property']) { + case 'backlight_mode': + $this->RegisterVariableBoolean('Z2M_BacklightMode', $this->Translate('Backlight Mode'), '~Switch'); + $this->EnableAction('Z2M_BacklightMode'); + break; case 'learn_ir_code': $this->RegisterVariableBoolean('Z2M_LearnIRCode', $this->Translate('Learn IR Code'), '~Switch'); $this->EnableAction('Z2M_LearnIRCode'); @@ -5332,6 +5336,12 @@ private function mapExposesToVariables(array $exposes) break; //Lock break case 'binary': switch ($expose['property']) { + case 'backlight_mode': + if ($ProfileName != false) { + $this->RegisterVariableBoolean('Z2M_BacklightMode', $this->Translate('Backlight Mode'), $ProfileName); + $this->EnableAction('Z2M_BacklightMode'); + } + break; case 'online': $this->RegisterVariableBoolean('Z2M_Online', $this->Translate('Online'), '~Switch'); $this->EnableAction('Z2M_Online'); From 6d921600e519e747c9c5ca2eb98756646acb7183 Mon Sep 17 00:00:00 2001 From: Burki24 Date: Sun, 25 Feb 2024 10:57:34 +0100 Subject: [PATCH 05/10] FIX: backlight_mode --- libs/Zigbee2MQTTHelper.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/Zigbee2MQTTHelper.php b/libs/Zigbee2MQTTHelper.php index 04c81a64..5222ded5 100644 --- a/libs/Zigbee2MQTTHelper.php +++ b/libs/Zigbee2MQTTHelper.php @@ -356,9 +356,13 @@ public function RequestAction($Ident, $Value) case 'Z2M_TemperatureMin': $Payload['temperature_min'] = number_format($Value, 2, '.', ' '); break; - case 'Z2M_BacklightMode': - $Payload['backlight_mode'] = strval($Value); - break; + case 'Z2M_BacklightMode': + if ($variableType == 3) { + $Payload['backlight_mode'] = strval($Value); + break; + } + $Payload['backlight_mode'] = strval($this->OnOff($Value)); + break; case 'Z2M_LedState': $Payload['led_state'] = strval($Value); break; From 8ef9609e69f6377ba0bb4cbef9a6bd6670d30dc7 Mon Sep 17 00:00:00 2001 From: Burki24 Date: Sun, 25 Feb 2024 11:06:49 +0100 Subject: [PATCH 06/10] ADD: Z2M_Identify --- Device/locale.json | 1 + libs/Zigbee2MQTTHelper.php | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/Device/locale.json b/Device/locale.json index fa683f03..74ad3a85 100644 --- a/Device/locale.json +++ b/Device/locale.json @@ -339,6 +339,7 @@ "Humidity": "Luftfeuchte", "Ibiza": "Ibiza", "Idle": "Standby", + "Identify": "Identifizieren", "Illuminance Above Threshold": "Beleuchtungsstärke über dem Schwellenwert", "Illuminance Lux l1": "Helligkeit Lux l1", "Illuminance Lux l2": "Helligkeit Lux l2", diff --git a/libs/Zigbee2MQTTHelper.php b/libs/Zigbee2MQTTHelper.php index 5222ded5..915ebbd3 100644 --- a/libs/Zigbee2MQTTHelper.php +++ b/libs/Zigbee2MQTTHelper.php @@ -11,6 +11,9 @@ public function RequestAction($Ident, $Value) $variableID = $this->GetIDForIdent($Ident); $variableType = IPS_GetVariable($variableID)['VariableType']; switch ($Ident) { + case 'Z2M_Identify': + $Payload['identify'] = $Value; + break; case 'Z2M_TemperaturePeriodicReport': $Payload['temperature_periodic_report'] = $Value; break; @@ -4179,6 +4182,12 @@ private function registerVariableProfile($expose) break; case 'numeric': switch ($expose['property']) { + case 'identify': + $ProfileName = $expose['value_min'] . '_' . $expose['value_max']; + if (!IPS_VariableProfileExists($ProfileName)) { + $this->RegisterProfileInteger($ProfileName, 'Clock', '', ' seconds', $expose['value_min'], $expose['value_max'], 1, 0); + } + break; case 'temperature_periodic_report': $ProfileName = $expose['value_min'] . '_' . $expose['value_max']; if (!IPS_VariableProfileExists($ProfileName)) { @@ -6086,6 +6095,13 @@ private function mapExposesToVariables(array $exposes) break; //enum break case 'numeric': switch ($expose['property']) { + case 'identify': + $ProfileName = $this->registerVariableProfile($expose); + if ($ProfileName != false) { + $this->RegisterVariableBoolean('Z2M_Identify', $this->Translate('Identify'), $ProfileName); + $this->EnableAction('Z2M_Identify'); + } + break; case 'humidity_sensitivity': $ProfileName = $this->registerVariableProfile($expose); if ($ProfileName != false) { From dcc9e89945ebc5f59e3362f298bb2d5a2f8b46fa Mon Sep 17 00:00:00 2001 From: Burki24 Date: Sun, 25 Feb 2024 11:10:49 +0100 Subject: [PATCH 07/10] FIX: Z2M_Identify --- libs/Zigbee2MQTTHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/Zigbee2MQTTHelper.php b/libs/Zigbee2MQTTHelper.php index 915ebbd3..03d3cee8 100644 --- a/libs/Zigbee2MQTTHelper.php +++ b/libs/Zigbee2MQTTHelper.php @@ -6098,7 +6098,7 @@ private function mapExposesToVariables(array $exposes) case 'identify': $ProfileName = $this->registerVariableProfile($expose); if ($ProfileName != false) { - $this->RegisterVariableBoolean('Z2M_Identify', $this->Translate('Identify'), $ProfileName); + $this->RegisterVariableInteger('Z2M_Identify', $this->Translate('Identify'), $ProfileName); $this->EnableAction('Z2M_Identify'); } break; From c345aa34b09aa7e6e140442c7227aae88e16665f Mon Sep 17 00:00:00 2001 From: Burki24 Date: Mon, 26 Feb 2024 05:37:17 +0100 Subject: [PATCH 08/10] FIX: binary backlight_mode --- libs/Zigbee2MQTTHelper.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libs/Zigbee2MQTTHelper.php b/libs/Zigbee2MQTTHelper.php index 03d3cee8..64c28b89 100644 --- a/libs/Zigbee2MQTTHelper.php +++ b/libs/Zigbee2MQTTHelper.php @@ -4866,10 +4866,6 @@ private function mapExposesToVariables(array $exposes) switch ($feature['type']) { case 'binary': switch ($feature['property']) { - case 'backlight_mode': - $this->RegisterVariableBoolean('Z2M_BacklightMode', $this->Translate('Backlight Mode'), '~Switch'); - $this->EnableAction('Z2M_BacklightMode'); - break; case 'learn_ir_code': $this->RegisterVariableBoolean('Z2M_LearnIRCode', $this->Translate('Learn IR Code'), '~Switch'); $this->EnableAction('Z2M_LearnIRCode'); @@ -5350,10 +5346,8 @@ private function mapExposesToVariables(array $exposes) case 'binary': switch ($expose['property']) { case 'backlight_mode': - if ($ProfileName != false) { - $this->RegisterVariableBoolean('Z2M_BacklightMode', $this->Translate('Backlight Mode'), $ProfileName); - $this->EnableAction('Z2M_BacklightMode'); - } + $this->RegisterVariableBoolean('Z2M_BacklightMode', $this->Translate('Backlight Mode'), '~Switch'); + $this->EnableAction('Z2M_BacklightMode'); break; case 'online': $this->RegisterVariableBoolean('Z2M_Online', $this->Translate('Online'), '~Switch'); From 52efe8d684830da667d8fd1105bd53f693ed9af4 Mon Sep 17 00:00:00 2001 From: Burki24 Date: Mon, 26 Feb 2024 05:43:53 +0100 Subject: [PATCH 09/10] FIX: Cannot autoconvert value --- libs/Zigbee2MQTTHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/Zigbee2MQTTHelper.php b/libs/Zigbee2MQTTHelper.php index 64c28b89..79c4a384 100644 --- a/libs/Zigbee2MQTTHelper.php +++ b/libs/Zigbee2MQTTHelper.php @@ -361,7 +361,7 @@ public function RequestAction($Ident, $Value) break; case 'Z2M_BacklightMode': if ($variableType == 3) { - $Payload['backlight_mode'] = strval($Value); + $Payload['backlight_mode'] = ($Value); break; } $Payload['backlight_mode'] = strval($this->OnOff($Value)); From aafeee45913805832c7f43f4730b0b8453c87ffa Mon Sep 17 00:00:00 2001 From: Burki24 Date: Mon, 26 Feb 2024 06:08:18 +0100 Subject: [PATCH 10/10] FIX:Backlight_mode --- libs/Zigbee2MQTTHelper.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libs/Zigbee2MQTTHelper.php b/libs/Zigbee2MQTTHelper.php index 79c4a384..b00a685e 100644 --- a/libs/Zigbee2MQTTHelper.php +++ b/libs/Zigbee2MQTTHelper.php @@ -1328,7 +1328,21 @@ public function ReceiveData($JSONString) $this->SetValue('Z2M_TemperatureMin', $Payload['temperature_min']); } if (array_key_exists('backlight_mode', $Payload)) { - $this->SetValue('Z2M_BacklightMode', $Payload['backlight_mode']); + switch ($Payload['backlight_mode']) { + case 'ON': + $this->SetValue('Z2M_BacklightMode', true); + break; + case 'OFF': + $this->SetValue('Z2M_BacklightMode', false); + break; + case 'low': + case 'high': + $this->SetValue('Z2M_BacklightMode', $Payload['backlight_mode']); + break; + default: + $this->SendDebug('backlight mode', 'Undefined State: ' . $Payload['backlight_mode'], 0); + break; + } } if (array_key_exists('led_state', $Payload)) { $this->SetValue('Z2M_LedState', $Payload['led_state']);