From 4f507e7f57a06f21bcead1682eb5e53c0c008665 Mon Sep 17 00:00:00 2001 From: codyhackw <49957005+codyhackw@users.noreply.github.com> Date: Wed, 12 Apr 2023 16:09:16 -0400 Subject: [PATCH] Update Inovelli Blue Series switch support in ZHA (#91254) Co-authored-by: David F. Mulcahey --- .../zha/core/channels/manufacturerspecific.py | 10 ++++- homeassistant/components/zha/number.py | 28 ++++++++++++ homeassistant/components/zha/select.py | 41 ++++++++++++++++- homeassistant/components/zha/switch.py | 44 ++++++++++++++----- 4 files changed, 110 insertions(+), 13 deletions(-) diff --git a/homeassistant/components/zha/core/channels/manufacturerspecific.py b/homeassistant/components/zha/core/channels/manufacturerspecific.py index b880a338a42..20848453e2a 100644 --- a/homeassistant/components/zha/core/channels/manufacturerspecific.py +++ b/homeassistant/components/zha/core/channels/manufacturerspecific.py @@ -251,14 +251,20 @@ class InovelliConfigEntityChannel(ZigbeeChannel): "active_energy_reports": True, "power_type": False, "switch_type": False, + "increased_non_neutral_output": True, "button_delay": False, "smart_bulb_mode": False, - "double_tap_up_for_max_brightness": True, - "double_tap_down_for_min_brightness": True, + "double_tap_up_enabled": True, + "double_tap_down_enabled": True, + "double_tap_up_level": True, + "double_tap_down_level": True, "led_color_when_on": True, "led_color_when_off": True, "led_intensity_when_on": True, "led_intensity_when_off": True, + "led_scaling_mode": True, + "aux_switch_scenes": True, + "binding_off_to_on_sync_level": True, "local_protection": False, "output_mode": False, "on_off_led_mode": True, diff --git a/homeassistant/components/zha/number.py b/homeassistant/components/zha/number.py index d0ec62eaf61..d35f9c3afad 100644 --- a/homeassistant/components/zha/number.py +++ b/homeassistant/components/zha/number.py @@ -835,6 +835,34 @@ class InovelliDefaultAllLEDOffIntensity( _attr_name: str = "Default all LED off intensity" +@CONFIG_DIAGNOSTIC_MATCH(channel_names=CHANNEL_INOVELLI) +class InovelliDoubleTapUpLevel( + ZHANumberConfigurationEntity, id_suffix="double_tap_up_level" +): + """Inovelli double tap up level configuration entity.""" + + _attr_entity_category = EntityCategory.CONFIG + _attr_icon: str = ICONS[16] + _attr_native_min_value: float = 2 + _attr_native_max_value: float = 254 + _zcl_attribute: str = "double_tap_up_level" + _attr_name: str = "Double tap up level" + + +@CONFIG_DIAGNOSTIC_MATCH(channel_names=CHANNEL_INOVELLI) +class InovelliDoubleTapDownLevel( + ZHANumberConfigurationEntity, id_suffix="double_tap_down_level" +): + """Inovelli double tap down level configuration entity.""" + + _attr_entity_category = EntityCategory.CONFIG + _attr_icon: str = ICONS[16] + _attr_native_min_value: float = 0 + _attr_native_max_value: float = 254 + _zcl_attribute: str = "double_tap_down_level" + _attr_name: str = "Double tap down level" + + @CONFIG_DIAGNOSTIC_MATCH(channel_names="opple_cluster", models={"aqara.feeder.acn001"}) class AqaraPetFeederServingSize(ZHANumberConfigurationEntity, id_suffix="serving_size"): """Aqara pet feeder serving size configuration entity.""" diff --git a/homeassistant/components/zha/select.py b/homeassistant/components/zha/select.py index 605c7d507c6..b352176411a 100644 --- a/homeassistant/components/zha/select.py +++ b/homeassistant/components/zha/select.py @@ -472,9 +472,10 @@ class InovelliOutputModeEntity(ZCLEnumSelectEntity, id_suffix="output_mode"): class InovelliSwitchType(types.enum8): """Inovelli output mode.""" - Load_Only = 0x00 + Single_Pole = 0x00 Three_Way_Dumb = 0x01 Three_Way_AUX = 0x02 + Single_Pole_Full_Sine = 0x03 @CONFIG_DIAGNOSTIC_MATCH( @@ -488,6 +489,44 @@ class InovelliSwitchTypeEntity(ZCLEnumSelectEntity, id_suffix="switch_type"): _attr_name: str = "Switch type" +class InovelliLedScalingMode(types.enum1): + """Inovelli led mode.""" + + VZM31SN = 0x00 + LZW31SN = 0x01 + + +@CONFIG_DIAGNOSTIC_MATCH( + channel_names=CHANNEL_INOVELLI, +) +class InovelliLedScalingModeEntity(ZCLEnumSelectEntity, id_suffix="led_scaling_mode"): + """Inovelli led mode control.""" + + _select_attr = "led_scaling_mode" + _enum = InovelliLedScalingMode + _attr_name: str = "Led scaling mode" + + +class InovelliNonNeutralOutput(types.enum1): + """Inovelli non neutral output selection.""" + + Low = 0x00 + High = 0x01 + + +@CONFIG_DIAGNOSTIC_MATCH( + channel_names=CHANNEL_INOVELLI, +) +class InovelliNonNeutralOutputEntity( + ZCLEnumSelectEntity, id_suffix="increased_non_neutral_output" +): + """Inovelli non neutral output control.""" + + _select_attr = "increased_non_neutral_output" + _enum = InovelliNonNeutralOutput + _attr_name: str = "Non neutral output" + + class AqaraFeedingMode(types.enum8): """Feeding mode.""" diff --git a/homeassistant/components/zha/switch.py b/homeassistant/components/zha/switch.py index f0e36750798..c57075a15ca 100644 --- a/homeassistant/components/zha/switch.py +++ b/homeassistant/components/zha/switch.py @@ -367,25 +367,49 @@ class InovelliSmartBulbMode(ZHASwitchConfigurationEntity, id_suffix="smart_bulb_ @CONFIG_DIAGNOSTIC_MATCH( channel_names=CHANNEL_INOVELLI, ) -class InovelliDoubleTapForFullBrightness( - ZHASwitchConfigurationEntity, id_suffix="double_tap_up_for_max_brightness" +class InovelliDoubleTapUpEnabled( + ZHASwitchConfigurationEntity, id_suffix="double_tap_up_enabled" ): - """Inovelli double tap for full brightness control.""" + """Inovelli double tap up enabled.""" - _zcl_attribute: str = "double_tap_up_for_max_brightness" - _attr_name: str = "Double tap full brightness" + _zcl_attribute: str = "double_tap_up_enabled" + _attr_name: str = "Double tap up enabled" @CONFIG_DIAGNOSTIC_MATCH( channel_names=CHANNEL_INOVELLI, ) -class InovelliDoubleTapForMinBrightness( - ZHASwitchConfigurationEntity, id_suffix="double_tap_down_for_min_brightness" +class InovelliDoubleTapDownEnabled( + ZHASwitchConfigurationEntity, id_suffix="double_tap_down_enabled" ): - """Inovelli double tap down for minimum brightness control.""" + """Inovelli double tap down enabled.""" - _zcl_attribute: str = "double_tap_down_for_min_brightness" - _attr_name: str = "Double tap minimum brightness" + _zcl_attribute: str = "double_tap_down_enabled" + _attr_name: str = "Double tap down enabled" + + +@CONFIG_DIAGNOSTIC_MATCH( + channel_names=CHANNEL_INOVELLI, +) +class InovelliAuxSwitchScenes( + ZHASwitchConfigurationEntity, id_suffix="aux_switch_scenes" +): + """Inovelli unique aux switch scenes.""" + + _zcl_attribute: str = "aux_switch_scenes" + _attr_name: str = "Aux switch scenes" + + +@CONFIG_DIAGNOSTIC_MATCH( + channel_names=CHANNEL_INOVELLI, +) +class InovelliBindingOffToOnSyncLevel( + ZHASwitchConfigurationEntity, id_suffix="binding_off_to_on_sync_level" +): + """Inovelli send move to level with on/off to bound devices.""" + + _zcl_attribute: str = "binding_off_to_on_sync_level" + _attr_name: str = "Binding off to on sync level" @CONFIG_DIAGNOSTIC_MATCH(