Fix ZHA VZM35-SN attributes (#102924)

* Fixes for VZM35-SN Attributes

* Fixes

* Update strings.json

Was missing translation keys from strings.json

* Minor Tweak to switch_type entity

Editing main switch_type entity to ensure it doesn't cause an error for the VZM35-SN

* Fix for Button Delay Entity
pull/104150/head
codyhackw 2023-11-17 12:38:58 -05:00 committed by GitHub
parent e755dd83b6
commit 483e0c9a85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 174 additions and 46 deletions

View File

@ -224,49 +224,94 @@ class InovelliConfigEntityClusterHandler(ClusterHandler):
"""Inovelli Configuration Entity cluster handler.""" """Inovelli Configuration Entity cluster handler."""
REPORT_CONFIG = () REPORT_CONFIG = ()
ZCL_INIT_ATTRS = {
"dimming_speed_up_remote": True, def __init__(self, cluster: zigpy.zcl.Cluster, endpoint: Endpoint) -> None:
"dimming_speed_up_local": True, """Initialize Inovelli cluster handler."""
"ramp_rate_off_to_on_local": True, super().__init__(cluster, endpoint)
"ramp_rate_off_to_on_remote": True, if self.cluster.endpoint.model == "VZM31-SN":
"dimming_speed_down_remote": True, self.ZCL_INIT_ATTRS = {
"dimming_speed_down_local": True, "dimming_speed_up_remote": True,
"ramp_rate_on_to_off_local": True, "dimming_speed_up_local": True,
"ramp_rate_on_to_off_remote": True, "ramp_rate_off_to_on_local": True,
"minimum_level": True, "ramp_rate_off_to_on_remote": True,
"maximum_level": True, "dimming_speed_down_remote": True,
"invert_switch": True, "dimming_speed_down_local": True,
"auto_off_timer": True, "ramp_rate_on_to_off_local": True,
"default_level_local": True, "ramp_rate_on_to_off_remote": True,
"default_level_remote": True, "minimum_level": True,
"state_after_power_restored": True, "maximum_level": True,
"load_level_indicator_timeout": True, "invert_switch": True,
"active_power_reports": True, "auto_off_timer": True,
"periodic_power_and_energy_reports": True, "default_level_local": True,
"active_energy_reports": True, "default_level_remote": True,
"power_type": False, "state_after_power_restored": True,
"switch_type": False, "load_level_indicator_timeout": True,
"increased_non_neutral_output": True, "active_power_reports": True,
"button_delay": False, "periodic_power_and_energy_reports": True,
"smart_bulb_mode": False, "active_energy_reports": True,
"double_tap_up_enabled": True, "power_type": False,
"double_tap_down_enabled": True, "switch_type": False,
"double_tap_up_level": True, "increased_non_neutral_output": True,
"double_tap_down_level": True, "button_delay": False,
"led_color_when_on": True, "smart_bulb_mode": False,
"led_color_when_off": True, "double_tap_up_enabled": True,
"led_intensity_when_on": True, "double_tap_down_enabled": True,
"led_intensity_when_off": True, "double_tap_up_level": True,
"led_scaling_mode": True, "double_tap_down_level": True,
"aux_switch_scenes": True, "led_color_when_on": True,
"binding_off_to_on_sync_level": True, "led_color_when_off": True,
"local_protection": False, "led_intensity_when_on": True,
"output_mode": False, "led_intensity_when_off": True,
"on_off_led_mode": True, "led_scaling_mode": True,
"firmware_progress_led": True, "aux_switch_scenes": True,
"relay_click_in_on_off_mode": True, "binding_off_to_on_sync_level": True,
"disable_clear_notifications_double_tap": True, "local_protection": False,
} "output_mode": False,
"on_off_led_mode": True,
"firmware_progress_led": True,
"relay_click_in_on_off_mode": True,
"disable_clear_notifications_double_tap": True,
}
elif self.cluster.endpoint.model == "VZM35-SN":
self.ZCL_INIT_ATTRS = {
"dimming_speed_up_remote": True,
"dimming_speed_up_local": True,
"ramp_rate_off_to_on_local": True,
"ramp_rate_off_to_on_remote": True,
"dimming_speed_down_remote": True,
"dimming_speed_down_local": True,
"ramp_rate_on_to_off_local": True,
"ramp_rate_on_to_off_remote": True,
"minimum_level": True,
"maximum_level": True,
"invert_switch": True,
"auto_off_timer": True,
"default_level_local": True,
"default_level_remote": True,
"state_after_power_restored": True,
"load_level_indicator_timeout": True,
"power_type": False,
"switch_type": False,
"non_neutral_aux_med_gear_learn_value": True,
"non_neutral_aux_low_gear_learn_value": True,
"quick_start_time": False,
"button_delay": False,
"smart_fan_mode": False,
"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,
"aux_switch_scenes": True,
"local_protection": False,
"output_mode": False,
"on_off_led_mode": True,
"firmware_progress_led": True,
"smart_fan_led_display_levels": True,
}
async def issue_all_led_effect( async def issue_all_led_effect(
self, self,

View File

@ -629,7 +629,7 @@ class InovelliRemoteDimmingUpSpeed(ZHANumberConfigurationEntity):
class InovelliButtonDelay(ZHANumberConfigurationEntity): class InovelliButtonDelay(ZHANumberConfigurationEntity):
"""Inovelli button delay configuration entity.""" """Inovelli button delay configuration entity."""
_unique_id_suffix = "dimming_speed_up_local" _unique_id_suffix = "button_delay"
_attr_entity_category = EntityCategory.CONFIG _attr_entity_category = EntityCategory.CONFIG
_attr_icon: str = ICONS[3] _attr_icon: str = ICONS[3]
_attr_native_min_value: float = 0 _attr_native_min_value: float = 0
@ -778,6 +778,22 @@ class InovelliAutoShutoffTimer(ZHANumberConfigurationEntity):
_attr_translation_key: str = "auto_off_timer" _attr_translation_key: str = "auto_off_timer"
@CONFIG_DIAGNOSTIC_MATCH(
cluster_handler_names=CLUSTER_HANDLER_INOVELLI, models={"VZM35-SN"}
)
# pylint: disable-next=hass-invalid-inheritance # needs fixing
class InovelliQuickStartTime(ZHANumberConfigurationEntity):
"""Inovelli fan quick start time configuration entity."""
_unique_id_suffix = "quick_start_time"
_attr_entity_category = EntityCategory.CONFIG
_attr_icon: str = ICONS[3]
_attr_native_min_value: float = 0
_attr_native_max_value: float = 10
_attribute_name = "quick_start_time"
_attr_translation_key: str = "quick_start_time"
@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLUSTER_HANDLER_INOVELLI) @CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLUSTER_HANDLER_INOVELLI)
# pylint: disable-next=hass-invalid-inheritance # needs fixing # pylint: disable-next=hass-invalid-inheritance # needs fixing
class InovelliLoadLevelIndicatorTimeout(ZHANumberConfigurationEntity): class InovelliLoadLevelIndicatorTimeout(ZHANumberConfigurationEntity):

View File

@ -447,7 +447,7 @@ class InovelliOutputModeEntity(ZCLEnumSelectEntity):
class InovelliSwitchType(types.enum8): class InovelliSwitchType(types.enum8):
"""Inovelli output mode.""" """Inovelli switch mode."""
Single_Pole = 0x00 Single_Pole = 0x00
Three_Way_Dumb = 0x01 Three_Way_Dumb = 0x01
@ -456,7 +456,7 @@ class InovelliSwitchType(types.enum8):
@CONFIG_DIAGNOSTIC_MATCH( @CONFIG_DIAGNOSTIC_MATCH(
cluster_handler_names=CLUSTER_HANDLER_INOVELLI, cluster_handler_names=CLUSTER_HANDLER_INOVELLI, models={"VZM31-SN"}
) )
class InovelliSwitchTypeEntity(ZCLEnumSelectEntity): class InovelliSwitchTypeEntity(ZCLEnumSelectEntity):
"""Inovelli switch type control.""" """Inovelli switch type control."""
@ -467,6 +467,25 @@ class InovelliSwitchTypeEntity(ZCLEnumSelectEntity):
_attr_translation_key: str = "switch_type" _attr_translation_key: str = "switch_type"
class InovelliFanSwitchType(types.enum1):
"""Inovelli fan switch mode."""
Load_Only = 0x00
Three_Way_AUX = 0x01
@CONFIG_DIAGNOSTIC_MATCH(
cluster_handler_names=CLUSTER_HANDLER_INOVELLI, models={"VZM35-SN"}
)
class InovelliFanSwitchTypeEntity(ZCLEnumSelectEntity):
"""Inovelli fan switch type control."""
_unique_id_suffix = "switch_type"
_attribute_name = "switch_type"
_enum = InovelliFanSwitchType
_attr_translation_key: str = "switch_type"
class InovelliLedScalingMode(types.enum1): class InovelliLedScalingMode(types.enum1):
"""Inovelli led mode.""" """Inovelli led mode."""
@ -486,6 +505,34 @@ class InovelliLedScalingModeEntity(ZCLEnumSelectEntity):
_attr_translation_key: str = "led_scaling_mode" _attr_translation_key: str = "led_scaling_mode"
class InovelliFanLedScalingMode(types.enum8):
"""Inovelli fan led mode."""
VZM31SN = 0x00
Grade_1 = 0x01
Grade_2 = 0x02
Grade_3 = 0x03
Grade_4 = 0x04
Grade_5 = 0x05
Grade_6 = 0x06
Grade_7 = 0x07
Grade_8 = 0x08
Grade_9 = 0x09
Adaptive = 0x0A
@CONFIG_DIAGNOSTIC_MATCH(
cluster_handler_names=CLUSTER_HANDLER_INOVELLI, models={"VZM35-SN"}
)
class InovelliFanLedScalingModeEntity(ZCLEnumSelectEntity):
"""Inovelli fan switch led mode control."""
_unique_id_suffix = "smart_fan_led_display_levels"
_attribute_name = "smart_fan_led_display_levels"
_enum = InovelliFanLedScalingMode
_attr_translation_key: str = "smart_fan_led_display_levels"
class InovelliNonNeutralOutput(types.enum1): class InovelliNonNeutralOutput(types.enum1):
"""Inovelli non neutral output selection.""" """Inovelli non neutral output selection."""

View File

@ -721,6 +721,9 @@
}, },
"away_preset_temperature": { "away_preset_temperature": {
"name": "Away preset temperature" "name": "Away preset temperature"
},
"quick_start_time": {
"name": "Quick start time"
} }
}, },
"select": { "select": {
@ -766,6 +769,9 @@
"led_scaling_mode": { "led_scaling_mode": {
"name": "Led scaling mode" "name": "Led scaling mode"
}, },
"smart_fan_led_display_levels": {
"name": "Smart fan led display levels"
},
"increased_non_neutral_output": { "increased_non_neutral_output": {
"name": "Non neutral output" "name": "Non neutral output"
}, },
@ -878,6 +884,9 @@
"smart_bulb_mode": { "smart_bulb_mode": {
"name": "Smart bulb mode" "name": "Smart bulb mode"
}, },
"smart_fan_mode": {
"name": "Smart fan mode"
},
"double_tap_up_enabled": { "double_tap_up_enabled": {
"name": "Double tap up enabled" "name": "Double tap up enabled"
}, },

View File

@ -364,6 +364,17 @@ class InovelliSmartBulbMode(ZHASwitchConfigurationEntity):
_attr_translation_key = "smart_bulb_mode" _attr_translation_key = "smart_bulb_mode"
@CONFIG_DIAGNOSTIC_MATCH(
cluster_handler_names=CLUSTER_HANDLER_INOVELLI, models={"VZM35-SN"}
)
class InovelliSmartFanMode(ZHASwitchConfigurationEntity):
"""Inovelli smart fan mode control."""
_unique_id_suffix = "smart_fan_mode"
_attribute_name = "smart_fan_mode"
_attr_translation_key = "smart_fan_mode"
@CONFIG_DIAGNOSTIC_MATCH( @CONFIG_DIAGNOSTIC_MATCH(
cluster_handler_names=CLUSTER_HANDLER_INOVELLI, cluster_handler_names=CLUSTER_HANDLER_INOVELLI,
) )