Use new enums in litterrobot (#61884)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-15 15:02:42 +01:00 committed by GitHub
parent ef15b159c1
commit 6c4f335650
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 8 deletions

View file

@ -3,8 +3,8 @@ from __future__ import annotations
from homeassistant.components.button import ButtonEntity from homeassistant.components.button import ButtonEntity
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_CONFIG
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import DOMAIN from .const import DOMAIN
@ -35,7 +35,7 @@ class LitterRobotResetWasteDrawerButton(LitterRobotEntity, ButtonEntity):
"""Litter-Robot reset waste drawer button.""" """Litter-Robot reset waste drawer button."""
_attr_icon = "mdi:delete-variant" _attr_icon = "mdi:delete-variant"
_attr_entity_category = ENTITY_CATEGORY_CONFIG _attr_entity_category = EntityCategory.CONFIG
async def async_press(self) -> None: async def async_press(self) -> None:
"""Press the button.""" """Press the button."""

View file

@ -9,9 +9,8 @@ from typing import Any
from pylitterbot import Robot from pylitterbot import Robot
from pylitterbot.exceptions import InvalidCommandException from pylitterbot.exceptions import InvalidCommandException
from homeassistant.const import ENTITY_CATEGORY_CONFIG
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity import DeviceInfo, EntityCategory
from homeassistant.helpers.event import async_call_later from homeassistant.helpers.event import async_call_later
from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.helpers.update_coordinator import CoordinatorEntity
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
@ -119,7 +118,7 @@ class LitterRobotControlEntity(LitterRobotEntity):
class LitterRobotConfigEntity(LitterRobotControlEntity): class LitterRobotConfigEntity(LitterRobotControlEntity):
"""A Litter-Robot entity that can control configuration of the unit.""" """A Litter-Robot entity that can control configuration of the unit."""
_attr_entity_category = ENTITY_CATEGORY_CONFIG _attr_entity_category = EntityCategory.CONFIG
def __init__(self, robot: Robot, entity_type: str, hub: LitterRobotHub) -> None: def __init__(self, robot: Robot, entity_type: str, hub: LitterRobotHub) -> None:
"""Init a Litter-Robot control entity.""" """Init a Litter-Robot control entity."""

View file

@ -5,9 +5,9 @@ from datetime import datetime
from pylitterbot.robot import Robot from pylitterbot.robot import Robot
from homeassistant.components.sensor import SensorEntity, StateType from homeassistant.components.sensor import SensorDeviceClass, SensorEntity, StateType
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import DEVICE_CLASS_TIMESTAMP, PERCENTAGE from homeassistant.const import PERCENTAGE
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -70,7 +70,7 @@ class LitterRobotSleepTimeSensor(LitterRobotPropertySensor):
@property @property
def device_class(self) -> str: def device_class(self) -> str:
"""Return the device class, if any.""" """Return the device class, if any."""
return DEVICE_CLASS_TIMESTAMP return SensorDeviceClass.TIMESTAMP
ROBOT_SENSORS: list[tuple[type[LitterRobotPropertySensor], str, str]] = [ ROBOT_SENSORS: list[tuple[type[LitterRobotPropertySensor], str, str]] = [