Use new EntityCategory in Tractive (#61289)

This commit is contained in:
Daniel Hjelseth Høyer 2021-12-08 22:13:01 +01:00 committed by GitHub
parent d817b4c7ea
commit d6725715a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 9 deletions

View file

@ -9,9 +9,10 @@ from homeassistant.components.binary_sensor import (
BinarySensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_BATTERY_CHARGING, ENTITY_CATEGORY_DIAGNOSTIC
from homeassistant.const import ATTR_BATTERY_CHARGING
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import Trackables
@ -77,7 +78,7 @@ SENSOR_TYPE = BinarySensorEntityDescription(
key=ATTR_BATTERY_CHARGING,
name="Battery Charging",
device_class=BinarySensorDeviceClass.BATTERY_CHARGING,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
)

View file

@ -10,14 +10,10 @@ from homeassistant.components.sensor import (
SensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_BATTERY_LEVEL,
ENTITY_CATEGORY_DIAGNOSTIC,
PERCENTAGE,
TIME_MINUTES,
)
from homeassistant.const import ATTR_BATTERY_LEVEL, PERCENTAGE, TIME_MINUTES
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import Trackables
@ -141,7 +137,7 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
native_unit_of_measurement=PERCENTAGE,
device_class=SensorDeviceClass.BATTERY,
entity_class=TractiveHardwareSensor,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
),
TractiveSensorEntityDescription(
# Currently, only state operational and not_reporting are used