mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Add base class to Smarty (#129112)
This commit is contained in:
parent
97eb768748
commit
61e2283146
@ -15,9 +15,9 @@ from homeassistant.components.binary_sensor import (
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .coordinator import SmartyConfigEntry, SmartyCoordinator
|
||||
from .entity import SmartyEntity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -64,7 +64,7 @@ async def async_setup_entry(
|
||||
)
|
||||
|
||||
|
||||
class SmartyBinarySensor(CoordinatorEntity[SmartyCoordinator], BinarySensorEntity):
|
||||
class SmartyBinarySensor(SmartyEntity, BinarySensorEntity):
|
||||
"""Representation of a Smarty Binary Sensor."""
|
||||
|
||||
entity_description: SmartyBinarySensorEntityDescription
|
||||
|
9
homeassistant/components/smarty/entity.py
Normal file
9
homeassistant/components/smarty/entity.py
Normal file
@ -0,0 +1,9 @@
|
||||
"""Smarty Entity class."""
|
||||
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .coordinator import SmartyCoordinator
|
||||
|
||||
|
||||
class SmartyEntity(CoordinatorEntity[SmartyCoordinator]):
|
||||
"""Representation of a Smarty Entity."""
|
@ -10,7 +10,6 @@ from homeassistant.components.fan import FanEntity, FanEntityFeature
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
from homeassistant.util.percentage import (
|
||||
percentage_to_ranged_value,
|
||||
ranged_value_to_percentage,
|
||||
@ -19,6 +18,7 @@ from homeassistant.util.scaling import int_states_in_range
|
||||
|
||||
from . import SmartyConfigEntry
|
||||
from .coordinator import SmartyCoordinator
|
||||
from .entity import SmartyEntity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -38,7 +38,7 @@ async def async_setup_entry(
|
||||
async_add_entities([SmartyFan(coordinator)])
|
||||
|
||||
|
||||
class SmartyFan(CoordinatorEntity[SmartyCoordinator], FanEntity):
|
||||
class SmartyFan(SmartyEntity, FanEntity):
|
||||
"""Representation of a Smarty Fan."""
|
||||
|
||||
_attr_icon = "mdi:air-conditioner"
|
||||
|
@ -17,10 +17,10 @@ from homeassistant.components.sensor import (
|
||||
from homeassistant.const import UnitOfTemperature
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from .coordinator import SmartyConfigEntry, SmartyCoordinator
|
||||
from .entity import SmartyEntity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -94,7 +94,7 @@ async def async_setup_entry(
|
||||
)
|
||||
|
||||
|
||||
class SmartySensor(CoordinatorEntity[SmartyCoordinator], SensorEntity):
|
||||
class SmartySensor(SmartyEntity, SensorEntity):
|
||||
"""Representation of a Smarty Sensor."""
|
||||
|
||||
entity_description: SmartySensorDescription
|
||||
|
Loading…
x
Reference in New Issue
Block a user