mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Use enums in roomba (#62045)
This commit is contained in:
parent
a16f963605
commit
0ee5691f77
@ -1,11 +1,8 @@
|
|||||||
"""Sensor for checking the battery level of Roomba."""
|
"""Sensor for checking the battery level of Roomba."""
|
||||||
from homeassistant.components.sensor import SensorEntity
|
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
||||||
from homeassistant.components.vacuum import STATE_DOCKED
|
from homeassistant.components.vacuum import STATE_DOCKED
|
||||||
from homeassistant.const import (
|
from homeassistant.const import PERCENTAGE
|
||||||
DEVICE_CLASS_BATTERY,
|
from homeassistant.helpers.entity import EntityCategory
|
||||||
ENTITY_CATEGORY_DIAGNOSTIC,
|
|
||||||
PERCENTAGE,
|
|
||||||
)
|
|
||||||
from homeassistant.helpers.icon import icon_for_battery_level
|
from homeassistant.helpers.icon import icon_for_battery_level
|
||||||
|
|
||||||
from .const import BLID, DOMAIN, ROOMBA_SESSION
|
from .const import BLID, DOMAIN, ROOMBA_SESSION
|
||||||
@ -24,7 +21,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||||||
class RoombaBattery(IRobotEntity, SensorEntity):
|
class RoombaBattery(IRobotEntity, SensorEntity):
|
||||||
"""Class to hold Roomba Sensor basic info."""
|
"""Class to hold Roomba Sensor basic info."""
|
||||||
|
|
||||||
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC
|
_attr_entity_category = EntityCategory.DIAGNOSTIC
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
@ -39,7 +36,7 @@ class RoombaBattery(IRobotEntity, SensorEntity):
|
|||||||
@property
|
@property
|
||||||
def device_class(self):
|
def device_class(self):
|
||||||
"""Return the device class of the sensor."""
|
"""Return the device class of the sensor."""
|
||||||
return DEVICE_CLASS_BATTERY
|
return SensorDeviceClass.BATTERY
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_unit_of_measurement(self):
|
def native_unit_of_measurement(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user