Add entity category to Neato (#58367)

This commit is contained in:
Simone Chemelli 2021-10-25 09:44:15 +02:00 committed by GitHub
parent 3abb4bd3e5
commit 34b936da98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -11,7 +11,7 @@ from pybotvac.robot import Robot
from homeassistant.components.neato import NeatoHub
from homeassistant.components.sensor import DEVICE_CLASS_BATTERY, SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import PERCENTAGE
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC, PERCENTAGE
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -83,6 +83,11 @@ class NeatoSensor(SensorEntity):
"""Return the device class."""
return DEVICE_CLASS_BATTERY
@property
def entity_category(self) -> str:
"""Device entity category."""
return ENTITY_CATEGORY_DIAGNOSTIC
@property
def available(self) -> bool:
"""Return availability."""

View file

@ -10,7 +10,7 @@ from pybotvac.robot import Robot
from homeassistant.components.neato import NeatoHub
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.const import ENTITY_CATEGORY_CONFIG, STATE_OFF, STATE_ON
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import DeviceInfo, ToggleEntity
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -106,6 +106,11 @@ class NeatoConnectedSwitch(ToggleEntity):
self.type == SWITCH_TYPE_SCHEDULE and self._schedule_state == STATE_ON
)
@property
def entity_category(self) -> str:
"""Device entity category."""
return ENTITY_CATEGORY_CONFIG
@property
def device_info(self) -> DeviceInfo:
"""Device info for neato robot."""