mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 13:57:10 +00:00
Use EntityFeature in geniushub (#69392)
* Use EntityFeature in geniushub * Cleanup _supported_features
This commit is contained in:
parent
7b5dd4a623
commit
42d0a4b81e
@ -335,7 +335,6 @@ class GeniusHeatingZone(GeniusZone):
|
|||||||
|
|
||||||
_max_temp: float
|
_max_temp: float
|
||||||
_min_temp: float
|
_min_temp: float
|
||||||
_supported_features: int
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_temperature(self) -> float | None:
|
def current_temperature(self) -> float | None:
|
||||||
@ -362,11 +361,6 @@ class GeniusHeatingZone(GeniusZone):
|
|||||||
"""Return the unit of measurement."""
|
"""Return the unit of measurement."""
|
||||||
return TEMP_CELSIUS
|
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:
|
async def async_set_temperature(self, **kwargs) -> None:
|
||||||
"""Set a new target temperature for this zone."""
|
"""Set a new target temperature for this zone."""
|
||||||
await self._zone.set_override(
|
await self._zone.set_override(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Support for Genius Hub climate devices."""
|
"""Support for Genius Hub climate devices."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.climate import ClimateEntity
|
from homeassistant.components.climate import ClimateEntity, ClimateEntityFeature
|
||||||
from homeassistant.components.climate.const import (
|
from homeassistant.components.climate.const import (
|
||||||
CURRENT_HVAC_HEAT,
|
CURRENT_HVAC_HEAT,
|
||||||
CURRENT_HVAC_IDLE,
|
CURRENT_HVAC_IDLE,
|
||||||
@ -10,8 +10,6 @@ from homeassistant.components.climate.const import (
|
|||||||
HVAC_MODE_OFF,
|
HVAC_MODE_OFF,
|
||||||
PRESET_ACTIVITY,
|
PRESET_ACTIVITY,
|
||||||
PRESET_BOOST,
|
PRESET_BOOST,
|
||||||
SUPPORT_PRESET_MODE,
|
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -53,13 +51,16 @@ async def async_setup_platform(
|
|||||||
class GeniusClimateZone(GeniusHeatingZone, ClimateEntity):
|
class GeniusClimateZone(GeniusHeatingZone, ClimateEntity):
|
||||||
"""Representation of a Genius Hub climate device."""
|
"""Representation of a Genius Hub climate device."""
|
||||||
|
|
||||||
|
_attr_supported_features = (
|
||||||
|
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, broker, zone) -> None:
|
def __init__(self, broker, zone) -> None:
|
||||||
"""Initialize the climate device."""
|
"""Initialize the climate device."""
|
||||||
super().__init__(broker, zone)
|
super().__init__(broker, zone)
|
||||||
|
|
||||||
self._max_temp = 28.0
|
self._max_temp = 28.0
|
||||||
self._min_temp = 4.0
|
self._min_temp = 4.0
|
||||||
self._supported_features = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def icon(self) -> str:
|
def icon(self) -> str:
|
||||||
|
@ -2,9 +2,8 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.water_heater import (
|
from homeassistant.components.water_heater import (
|
||||||
SUPPORT_OPERATION_MODE,
|
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
|
||||||
WaterHeaterEntity,
|
WaterHeaterEntity,
|
||||||
|
WaterHeaterEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.const import STATE_OFF
|
from homeassistant.const import STATE_OFF
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -57,13 +56,17 @@ async def async_setup_platform(
|
|||||||
class GeniusWaterHeater(GeniusHeatingZone, WaterHeaterEntity):
|
class GeniusWaterHeater(GeniusHeatingZone, WaterHeaterEntity):
|
||||||
"""Representation of a Genius Hub water_heater device."""
|
"""Representation of a Genius Hub water_heater device."""
|
||||||
|
|
||||||
|
_attr_supported_features = (
|
||||||
|
WaterHeaterEntityFeature.TARGET_TEMPERATURE
|
||||||
|
| WaterHeaterEntityFeature.OPERATION_MODE
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, broker, zone) -> None:
|
def __init__(self, broker, zone) -> None:
|
||||||
"""Initialize the water_heater device."""
|
"""Initialize the water_heater device."""
|
||||||
super().__init__(broker, zone)
|
super().__init__(broker, zone)
|
||||||
|
|
||||||
self._max_temp = 80.0
|
self._max_temp = 80.0
|
||||||
self._min_temp = 30.0
|
self._min_temp = 30.0
|
||||||
self._supported_features = SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def operation_list(self) -> list[str]:
|
def operation_list(self) -> list[str]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user