Skip to content

Commit afa6046

Browse files
authored
Add more Inovelli blue switch entities (#203)
Co-authored-by: shironeko <[email protected]>
1 parent db34923 commit afa6046

File tree

4 files changed

+91
-2
lines changed

4 files changed

+91
-2
lines changed

zha/application/platforms/number/__init__.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,42 @@ class InovelliAutoShutoffTimer(NumberConfigurationEntity):
650650
_attr_translation_key: str = "auto_off_timer"
651651

652652

653+
@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLUSTER_HANDLER_INOVELLI)
654+
class InovelliLocalDefaultLevel(NumberConfigurationEntity):
655+
"""Inovelli local default dimming/fan level configuration entity."""
656+
657+
_unique_id_suffix = "default_level_local"
658+
_attr_entity_category = EntityCategory.CONFIG
659+
_attr_native_min_value: float = 0
660+
_attr_native_max_value: float = 255
661+
_attribute_name = "default_level_local"
662+
_attr_translation_key: str = "default_level_local"
663+
664+
665+
@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLUSTER_HANDLER_INOVELLI)
666+
class InovelliRemoteDefaultLevel(NumberConfigurationEntity):
667+
"""Inovelli remote default dimming/fan level configuration entity."""
668+
669+
_unique_id_suffix = "default_level_remote"
670+
_attr_entity_category = EntityCategory.CONFIG
671+
_attr_native_min_value: float = 0
672+
_attr_native_max_value: float = 255
673+
_attribute_name = "default_level_remote"
674+
_attr_translation_key: str = "default_level_remote"
675+
676+
677+
@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLUSTER_HANDLER_INOVELLI)
678+
class InovelliStartupDefaultLevel(NumberConfigurationEntity):
679+
"""Inovelli start-up default dimming/fan level configuration entity."""
680+
681+
_unique_id_suffix = "state_after_power_restored"
682+
_attr_entity_category = EntityCategory.CONFIG
683+
_attr_native_min_value: float = 0
684+
_attr_native_max_value: float = 255
685+
_attribute_name = "state_after_power_restored"
686+
_attr_translation_key: str = "state_after_power_restored"
687+
688+
653689
@CONFIG_DIAGNOSTIC_MATCH(
654690
cluster_handler_names=CLUSTER_HANDLER_INOVELLI, models={"VZM35-SN"}
655691
)

zha/application/platforms/select.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,25 @@ class InovelliNonNeutralOutputEntity(ZCLEnumSelectEntity):
637637
_attr_translation_key: str = "increased_non_neutral_output"
638638

639639

640+
class InovelliDimmingMode(types.enum1):
641+
"""Inovelli dimming mode selection."""
642+
643+
LeadingEdge = 0x00
644+
TrailingEdge = 0x01
645+
646+
647+
@CONFIG_DIAGNOSTIC_MATCH(
648+
cluster_handler_names=CLUSTER_HANDLER_INOVELLI, models={"VZM31-SN", "VZM36"}
649+
)
650+
class InovelliDimmingModeEntity(ZCLEnumSelectEntity):
651+
"""Inovelli dimming mode control."""
652+
653+
_unique_id_suffix = "leading_or_trailing_edge"
654+
_attribute_name = "leading_or_trailing_edge"
655+
_enum = InovelliDimmingMode
656+
_attr_translation_key: str = "leading_or_trailing_edge"
657+
658+
640659
class AqaraFeedingMode(types.enum8):
641660
"""Feeding mode."""
642661

zha/application/platforms/sensor/__init__.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
CLUSTER_HANDLER_ELECTRICAL_MEASUREMENT,
6565
CLUSTER_HANDLER_HUMIDITY,
6666
CLUSTER_HANDLER_ILLUMINANCE,
67+
CLUSTER_HANDLER_INOVELLI,
6768
CLUSTER_HANDLER_LEAF_WETNESS,
6869
CLUSTER_HANDLER_POWER_CONFIGURATION,
6970
CLUSTER_HANDLER_PRESSURE,
@@ -1140,6 +1141,36 @@ class DeviceTemperature(Sensor):
11401141
_attr_entity_category = EntityCategory.DIAGNOSTIC
11411142

11421143

1144+
@MULTI_MATCH(cluster_handler_names=CLUSTER_HANDLER_INOVELLI)
1145+
class InovelliInternalTemperature(Sensor):
1146+
"""Switch Internal Temperature Sensor."""
1147+
1148+
_attribute_name = "internal_temp_monitor"
1149+
_attr_device_class: SensorDeviceClass = SensorDeviceClass.TEMPERATURE
1150+
_attr_state_class: SensorStateClass = SensorStateClass.MEASUREMENT
1151+
_attr_translation_key: str = "internal_temp_monitor"
1152+
_attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS
1153+
_attr_entity_category = EntityCategory.DIAGNOSTIC
1154+
1155+
1156+
class InovelliOverheatedState(types.enum8):
1157+
"""Inovelli overheat protection state."""
1158+
1159+
Normal = 0x00
1160+
Overheated = 0x01
1161+
1162+
1163+
@MULTI_MATCH(cluster_handler_names=CLUSTER_HANDLER_INOVELLI)
1164+
class InovelliOverheated(EnumSensor):
1165+
"""Sensor that displays the overheat protection state."""
1166+
1167+
_attribute_name = "overheated"
1168+
_unique_id_suffix = "overheated"
1169+
_attr_translation_key: str = "overheated"
1170+
_enum = InovelliOverheatedState
1171+
_attr_entity_category = EntityCategory.DIAGNOSTIC
1172+
1173+
11431174
@MULTI_MATCH(cluster_handler_names="carbon_dioxide_concentration")
11441175
class CarbonDioxideConcentration(Sensor):
11451176
"""Carbon Dioxide Concentration sensor."""

zha/zigbee/cluster_handlers/manufacturerspecific.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,12 @@ def __init__(self, cluster: zigpy.zcl.Cluster, endpoint: Endpoint) -> None:
261261
self.ZCL_INIT_ATTRS = {
262262
"dimming_speed_up_remote": True,
263263
"dimming_speed_up_local": True,
264-
"ramp_rate_off_to_on_local": True,
265264
"ramp_rate_off_to_on_remote": True,
265+
"ramp_rate_off_to_on_local": True,
266266
"dimming_speed_down_remote": True,
267267
"dimming_speed_down_local": True,
268-
"ramp_rate_on_to_off_local": True,
269268
"ramp_rate_on_to_off_remote": True,
269+
"ramp_rate_on_to_off_local": True,
270270
"minimum_level": True,
271271
"maximum_level": True,
272272
"invert_switch": True,
@@ -281,6 +281,9 @@ def __init__(self, cluster: zigpy.zcl.Cluster, endpoint: Endpoint) -> None:
281281
"power_type": False,
282282
"switch_type": False,
283283
"increased_non_neutral_output": True,
284+
"leading_or_trailing_edge": True,
285+
"internal_temp_monitor": True,
286+
"overheated": True,
284287
"button_delay": False,
285288
"smart_bulb_mode": False,
286289
"double_tap_up_enabled": True,

0 commit comments

Comments
 (0)