Skip to content

Commit

Permalink
Add more Inovelli blue switch entities
Browse files Browse the repository at this point in the history
  • Loading branch information
tleydxdy committed Sep 15, 2024
1 parent 2ca4115 commit fa5c229
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 2 deletions.
36 changes: 36 additions & 0 deletions zha/application/platforms/number/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,42 @@ class InovelliAutoShutoffTimer(NumberConfigurationEntity):
_attr_translation_key: str = "auto_off_timer"


@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLUSTER_HANDLER_INOVELLI)
class InovelliLocalDefaultLevel(NumberConfigurationEntity):
"""Inovelli local default dimming/fan level configuration entity."""

_unique_id_suffix = "default_level_local"
_attr_entity_category = EntityCategory.CONFIG
_attr_native_min_value: float = 0
_attr_native_max_value: float = 255
_attribute_name = "default_level_local"
_attr_translation_key: str = "default_level_local"


@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLUSTER_HANDLER_INOVELLI)
class InovelliRemoteDefaultLevel(NumberConfigurationEntity):
"""Inovelli remote default dimming/fan level configuration entity."""

_unique_id_suffix = "default_level_remote"
_attr_entity_category = EntityCategory.CONFIG
_attr_native_min_value: float = 0
_attr_native_max_value: float = 255
_attribute_name = "default_level_remote"
_attr_translation_key: str = "default_level_remote"


@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLUSTER_HANDLER_INOVELLI)
class InovelliStartupDefaultLevel(NumberConfigurationEntity):
"""Inovelli start-up default dimming/fan level configuration entity."""

_unique_id_suffix = "state_after_power_restored"
_attr_entity_category = EntityCategory.CONFIG
_attr_native_min_value: float = 0
_attr_native_max_value: float = 255
_attribute_name = "state_after_power_restored"
_attr_translation_key: str = "state_after_power_restored"


@CONFIG_DIAGNOSTIC_MATCH(
cluster_handler_names=CLUSTER_HANDLER_INOVELLI, models={"VZM35-SN"}
)
Expand Down
19 changes: 19 additions & 0 deletions zha/application/platforms/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,25 @@ class InovelliNonNeutralOutputEntity(ZCLEnumSelectEntity):
_attr_translation_key: str = "increased_non_neutral_output"


class InovelliDimmingMode(types.enum1):
"""Inovelli dimming mode selection."""

LeadingEdge = 0x00
TrailingEdge = 0x01


@CONFIG_DIAGNOSTIC_MATCH(
cluster_handler_names=CLUSTER_HANDLER_INOVELLI, models={"VZM31-SN", "VZM36"}
)
class InovelliDimmingModeEntity(ZCLEnumSelectEntity):
"""Inovelli dimming mode control."""

_unique_id_suffix = "leading_or_trailing_edge"
_attribute_name = "leading_or_trailing_edge"
_enum = InovelliDimmingMode
_attr_translation_key: str = "leading_or_trailing_edge"


class AqaraFeedingMode(types.enum8):
"""Feeding mode."""

Expand Down
31 changes: 31 additions & 0 deletions zha/application/platforms/sensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
CLUSTER_HANDLER_ELECTRICAL_MEASUREMENT,
CLUSTER_HANDLER_HUMIDITY,
CLUSTER_HANDLER_ILLUMINANCE,
CLUSTER_HANDLER_INOVELLI,
CLUSTER_HANDLER_LEAF_WETNESS,
CLUSTER_HANDLER_POWER_CONFIGURATION,
CLUSTER_HANDLER_PRESSURE,
Expand Down Expand Up @@ -1140,6 +1141,36 @@ class DeviceTemperature(Sensor):
_attr_entity_category = EntityCategory.DIAGNOSTIC


@MULTI_MATCH(cluster_handler_names=CLUSTER_HANDLER_INOVELLI)
class InovelliInternalTemperature(Sensor):
"""Switch Internal Temperature Sensor."""

_attribute_name = "internal_temp_monitor"
_attr_device_class: SensorDeviceClass = SensorDeviceClass.TEMPERATURE
_attr_state_class: SensorStateClass = SensorStateClass.MEASUREMENT
_attr_translation_key: str = "internal_temp_monitor"
_attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS
_attr_entity_category = EntityCategory.DIAGNOSTIC


class InovelliOverheatedState(types.enum8):
"""Inovelli overheat protection state."""

Normal = 0x00
Overheated = 0x01


@MULTI_MATCH(cluster_handler_names=CLUSTER_HANDLER_INOVELLI)
class InovelliOverheated(EnumSensor):
"""Sensor that displays the overheat protection state."""

_attribute_name = "overheated"
_unique_id_suffix = "overheated"
_attr_translation_key: str = "overheated"
_enum = InovelliOverheatedState
_attr_entity_category = EntityCategory.DIAGNOSTIC


@MULTI_MATCH(cluster_handler_names="carbon_dioxide_concentration")
class CarbonDioxideConcentration(Sensor):
"""Carbon Dioxide Concentration sensor."""
Expand Down
7 changes: 5 additions & 2 deletions zha/zigbee/cluster_handlers/manufacturerspecific.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,12 @@ def __init__(self, cluster: zigpy.zcl.Cluster, endpoint: Endpoint) -> None:
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,
"ramp_rate_off_to_on_local": 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,
"ramp_rate_on_to_off_local": True,
"minimum_level": True,
"maximum_level": True,
"invert_switch": True,
Expand All @@ -281,6 +281,9 @@ def __init__(self, cluster: zigpy.zcl.Cluster, endpoint: Endpoint) -> None:
"power_type": False,
"switch_type": False,
"increased_non_neutral_output": True,
"leading_or_trailing_edge": True,
"internal_temp_monitor": True,
"overheated": True,
"button_delay": False,
"smart_bulb_mode": False,
"double_tap_up_enabled": True,
Expand Down

0 comments on commit fa5c229

Please sign in to comment.