Use new enums in neato (#61939)

pull/62091/head
epenet 2021-12-16 15:49:11 +01:00 committed by GitHub
parent 2cc343bb7f
commit 599c8f4757
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -8,11 +8,11 @@ from typing import Any
from pybotvac.exceptions import NeatoRobotException
from pybotvac.robot import Robot
from homeassistant.components.sensor import DEVICE_CLASS_BATTERY, SensorEntity
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC, PERCENTAGE
from homeassistant.const import PERCENTAGE
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import NeatoHub
@ -81,12 +81,12 @@ class NeatoSensor(SensorEntity):
@property
def device_class(self) -> str:
"""Return the device class."""
return DEVICE_CLASS_BATTERY
return SensorDeviceClass.BATTERY
@property
def entity_category(self) -> str:
"""Device entity category."""
return ENTITY_CATEGORY_DIAGNOSTIC
return EntityCategory.DIAGNOSTIC
@property
def available(self) -> bool:

View File

@ -9,9 +9,9 @@ from pybotvac.exceptions import NeatoRobotException
from pybotvac.robot import Robot
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_CONFIG, STATE_OFF, STATE_ON
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import DeviceInfo, ToggleEntity
from homeassistant.helpers.entity import DeviceInfo, EntityCategory, ToggleEntity
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import NeatoHub
@ -109,7 +109,7 @@ class NeatoConnectedSwitch(ToggleEntity):
@property
def entity_category(self) -> str:
"""Device entity category."""
return ENTITY_CATEGORY_CONFIG
return EntityCategory.CONFIG
@property
def device_info(self) -> DeviceInfo: