Use shorthand attributes in Insteon (#99392)
This commit is contained in:
parent
bbc390837e
commit
6c93865cee
3 changed files with 5 additions and 26 deletions
|
@ -76,12 +76,7 @@ class InsteonBinarySensorEntity(InsteonEntity, BinarySensorEntity):
|
|||
def __init__(self, device, group):
|
||||
"""Initialize the INSTEON binary sensor."""
|
||||
super().__init__(device, group)
|
||||
self._sensor_type = SENSOR_TYPES.get(self._insteon_device_group.name)
|
||||
|
||||
@property
|
||||
def device_class(self):
|
||||
"""Return the class of this sensor."""
|
||||
return self._sensor_type
|
||||
self._attr_device_class = SENSOR_TYPES.get(self._insteon_device_group.name)
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
|
|
|
@ -88,6 +88,9 @@ class InsteonClimateEntity(InsteonEntity, ClimateEntity):
|
|||
| ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
| ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
|
||||
)
|
||||
_attr_hvac_modes = list(HVAC_MODES.values())
|
||||
_attr_fan_modes = list(FAN_MODES.values())
|
||||
_attr_min_humidity = 1
|
||||
|
||||
@property
|
||||
def temperature_unit(self) -> str:
|
||||
|
@ -106,11 +109,6 @@ class InsteonClimateEntity(InsteonEntity, ClimateEntity):
|
|||
"""Return hvac operation ie. heat, cool mode."""
|
||||
return HVAC_MODES[self._insteon_device.groups[SYSTEM_MODE].value]
|
||||
|
||||
@property
|
||||
def hvac_modes(self) -> list[HVACMode]:
|
||||
"""Return the list of available hvac operation modes."""
|
||||
return list(HVAC_MODES.values())
|
||||
|
||||
@property
|
||||
def current_temperature(self) -> float | None:
|
||||
"""Return the current temperature."""
|
||||
|
@ -144,11 +142,6 @@ class InsteonClimateEntity(InsteonEntity, ClimateEntity):
|
|||
"""Return the fan setting."""
|
||||
return FAN_MODES[self._insteon_device.groups[FAN_MODE].value]
|
||||
|
||||
@property
|
||||
def fan_modes(self) -> list[str] | None:
|
||||
"""Return the list of available fan modes."""
|
||||
return list(FAN_MODES.values())
|
||||
|
||||
@property
|
||||
def target_humidity(self) -> int | None:
|
||||
"""Return the humidity we try to reach."""
|
||||
|
@ -157,11 +150,6 @@ class InsteonClimateEntity(InsteonEntity, ClimateEntity):
|
|||
# May not be loaded yet so return a default if required
|
||||
return (high + low) / 2 if high and low else None
|
||||
|
||||
@property
|
||||
def min_humidity(self) -> int:
|
||||
"""Return the minimum humidity."""
|
||||
return 1
|
||||
|
||||
@property
|
||||
def hvac_action(self) -> HVACAction:
|
||||
"""Return the current running hvac operation if supported.
|
||||
|
|
|
@ -50,6 +50,7 @@ class InsteonFanEntity(InsteonEntity, FanEntity):
|
|||
"""An INSTEON fan entity."""
|
||||
|
||||
_attr_supported_features = FanEntityFeature.SET_SPEED
|
||||
_attr_speed_count = 3
|
||||
|
||||
@property
|
||||
def percentage(self) -> int | None:
|
||||
|
@ -58,11 +59,6 @@ class InsteonFanEntity(InsteonEntity, FanEntity):
|
|||
return None
|
||||
return ranged_value_to_percentage(SPEED_RANGE, self._insteon_device_group.value)
|
||||
|
||||
@property
|
||||
def speed_count(self) -> int:
|
||||
"""Flag supported features."""
|
||||
return 3
|
||||
|
||||
async def async_turn_on(
|
||||
self,
|
||||
percentage: int | None = None,
|
||||
|
|
Loading…
Add table
Reference in a new issue