mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Use shorthand attributes in Insteon (#99392)
This commit is contained in:
parent
bbc390837e
commit
6c93865cee
@ -76,12 +76,7 @@ class InsteonBinarySensorEntity(InsteonEntity, BinarySensorEntity):
|
|||||||
def __init__(self, device, group):
|
def __init__(self, device, group):
|
||||||
"""Initialize the INSTEON binary sensor."""
|
"""Initialize the INSTEON binary sensor."""
|
||||||
super().__init__(device, group)
|
super().__init__(device, group)
|
||||||
self._sensor_type = SENSOR_TYPES.get(self._insteon_device_group.name)
|
self._attr_device_class = SENSOR_TYPES.get(self._insteon_device_group.name)
|
||||||
|
|
||||||
@property
|
|
||||||
def device_class(self):
|
|
||||||
"""Return the class of this sensor."""
|
|
||||||
return self._sensor_type
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
|
@ -88,6 +88,9 @@ class InsteonClimateEntity(InsteonEntity, ClimateEntity):
|
|||||||
| ClimateEntityFeature.TARGET_TEMPERATURE
|
| ClimateEntityFeature.TARGET_TEMPERATURE
|
||||||
| ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
|
| ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
|
||||||
)
|
)
|
||||||
|
_attr_hvac_modes = list(HVAC_MODES.values())
|
||||||
|
_attr_fan_modes = list(FAN_MODES.values())
|
||||||
|
_attr_min_humidity = 1
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def temperature_unit(self) -> str:
|
def temperature_unit(self) -> str:
|
||||||
@ -106,11 +109,6 @@ class InsteonClimateEntity(InsteonEntity, ClimateEntity):
|
|||||||
"""Return hvac operation ie. heat, cool mode."""
|
"""Return hvac operation ie. heat, cool mode."""
|
||||||
return HVAC_MODES[self._insteon_device.groups[SYSTEM_MODE].value]
|
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
|
@property
|
||||||
def current_temperature(self) -> float | None:
|
def current_temperature(self) -> float | None:
|
||||||
"""Return the current temperature."""
|
"""Return the current temperature."""
|
||||||
@ -144,11 +142,6 @@ class InsteonClimateEntity(InsteonEntity, ClimateEntity):
|
|||||||
"""Return the fan setting."""
|
"""Return the fan setting."""
|
||||||
return FAN_MODES[self._insteon_device.groups[FAN_MODE].value]
|
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
|
@property
|
||||||
def target_humidity(self) -> int | None:
|
def target_humidity(self) -> int | None:
|
||||||
"""Return the humidity we try to reach."""
|
"""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
|
# May not be loaded yet so return a default if required
|
||||||
return (high + low) / 2 if high and low else None
|
return (high + low) / 2 if high and low else None
|
||||||
|
|
||||||
@property
|
|
||||||
def min_humidity(self) -> int:
|
|
||||||
"""Return the minimum humidity."""
|
|
||||||
return 1
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hvac_action(self) -> HVACAction:
|
def hvac_action(self) -> HVACAction:
|
||||||
"""Return the current running hvac operation if supported.
|
"""Return the current running hvac operation if supported.
|
||||||
|
@ -50,6 +50,7 @@ class InsteonFanEntity(InsteonEntity, FanEntity):
|
|||||||
"""An INSTEON fan entity."""
|
"""An INSTEON fan entity."""
|
||||||
|
|
||||||
_attr_supported_features = FanEntityFeature.SET_SPEED
|
_attr_supported_features = FanEntityFeature.SET_SPEED
|
||||||
|
_attr_speed_count = 3
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def percentage(self) -> int | None:
|
def percentage(self) -> int | None:
|
||||||
@ -58,11 +59,6 @@ class InsteonFanEntity(InsteonEntity, FanEntity):
|
|||||||
return None
|
return None
|
||||||
return ranged_value_to_percentage(SPEED_RANGE, self._insteon_device_group.value)
|
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(
|
async def async_turn_on(
|
||||||
self,
|
self,
|
||||||
percentage: int | None = None,
|
percentage: int | None = None,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user