Use EntityFeature in geniushub (#69392)

* Use EntityFeature in geniushub

* Cleanup _supported_features
This commit is contained in:
epenet 2022-04-06 10:22:33 +02:00 committed by GitHub
parent 7b5dd4a623
commit 42d0a4b81e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 13 deletions

View File

@ -335,7 +335,6 @@ class GeniusHeatingZone(GeniusZone):
_max_temp: float
_min_temp: float
_supported_features: int
@property
def current_temperature(self) -> float | None:
@ -362,11 +361,6 @@ class GeniusHeatingZone(GeniusZone):
"""Return the unit of measurement."""
return TEMP_CELSIUS
@property
def supported_features(self) -> int:
"""Return the bitmask of supported features."""
return self._supported_features
async def async_set_temperature(self, **kwargs) -> None:
"""Set a new target temperature for this zone."""
await self._zone.set_override(

View File

@ -1,7 +1,7 @@
"""Support for Genius Hub climate devices."""
from __future__ import annotations
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate import ClimateEntity, ClimateEntityFeature
from homeassistant.components.climate.const import (
CURRENT_HVAC_HEAT,
CURRENT_HVAC_IDLE,
@ -10,8 +10,6 @@ from homeassistant.components.climate.const import (
HVAC_MODE_OFF,
PRESET_ACTIVITY,
PRESET_BOOST,
SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -53,13 +51,16 @@ async def async_setup_platform(
class GeniusClimateZone(GeniusHeatingZone, ClimateEntity):
"""Representation of a Genius Hub climate device."""
_attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
)
def __init__(self, broker, zone) -> None:
"""Initialize the climate device."""
super().__init__(broker, zone)
self._max_temp = 28.0
self._min_temp = 4.0
self._supported_features = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
@property
def icon(self) -> str:

View File

@ -2,9 +2,8 @@
from __future__ import annotations
from homeassistant.components.water_heater import (
SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE,
WaterHeaterEntity,
WaterHeaterEntityFeature,
)
from homeassistant.const import STATE_OFF
from homeassistant.core import HomeAssistant
@ -57,13 +56,17 @@ async def async_setup_platform(
class GeniusWaterHeater(GeniusHeatingZone, WaterHeaterEntity):
"""Representation of a Genius Hub water_heater device."""
_attr_supported_features = (
WaterHeaterEntityFeature.TARGET_TEMPERATURE
| WaterHeaterEntityFeature.OPERATION_MODE
)
def __init__(self, broker, zone) -> None:
"""Initialize the water_heater device."""
super().__init__(broker, zone)
self._max_temp = 80.0
self._min_temp = 30.0
self._supported_features = SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE
@property
def operation_list(self) -> list[str]: