Migrate integrations i-m to extend SensorEntity (#48213)
This commit is contained in:
parent
64bc9a8196
commit
fdf97eaca3
62 changed files with 152 additions and 157 deletions
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||
|
||||
from pylitterbot.robot import Robot
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DEVICE_CLASS_TIMESTAMP, PERCENTAGE
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import DOMAIN
|
||||
from .hub import LitterRobotEntity, LitterRobotHub
|
||||
|
@ -21,7 +21,7 @@ def icon_for_gauge_level(gauge_level: int | None = None, offset: int = 0) -> str
|
|||
return "mdi:gauge-low"
|
||||
|
||||
|
||||
class LitterRobotPropertySensor(LitterRobotEntity, Entity):
|
||||
class LitterRobotPropertySensor(LitterRobotEntity, SensorEntity):
|
||||
"""Litter-Robot property sensors."""
|
||||
|
||||
def __init__(
|
||||
|
@ -37,7 +37,7 @@ class LitterRobotPropertySensor(LitterRobotEntity, Entity):
|
|||
return getattr(self.robot, self.sensor_attribute)
|
||||
|
||||
|
||||
class LitterRobotWasteSensor(LitterRobotPropertySensor, Entity):
|
||||
class LitterRobotWasteSensor(LitterRobotPropertySensor):
|
||||
"""Litter-Robot sensors."""
|
||||
|
||||
@property
|
||||
|
@ -51,7 +51,7 @@ class LitterRobotWasteSensor(LitterRobotPropertySensor, Entity):
|
|||
return icon_for_gauge_level(self.state, 10)
|
||||
|
||||
|
||||
class LitterRobotSleepTimeSensor(LitterRobotPropertySensor, Entity):
|
||||
class LitterRobotSleepTimeSensor(LitterRobotPropertySensor):
|
||||
"""Litter-Robot sleep time sensors."""
|
||||
|
||||
@property
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue