mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Use device class enum in Tractive (#60700)
This commit is contained in:
parent
06f12fc583
commit
ca55216d67
@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
DEVICE_CLASS_BATTERY_CHARGING,
|
||||
BinarySensorDeviceClass,
|
||||
BinarySensorEntity,
|
||||
BinarySensorEntityDescription,
|
||||
)
|
||||
@ -76,7 +76,7 @@ class TractiveBinarySensor(TractiveEntity, BinarySensorEntity):
|
||||
SENSOR_TYPE = BinarySensorEntityDescription(
|
||||
key=ATTR_BATTERY_CHARGING,
|
||||
name="Battery Charging",
|
||||
device_class=DEVICE_CLASS_BATTERY_CHARGING,
|
||||
device_class=BinarySensorDeviceClass.BATTERY_CHARGING,
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
)
|
||||
|
||||
|
@ -4,11 +4,14 @@ from __future__ import annotations
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
|
||||
from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
SensorEntityDescription,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
ATTR_BATTERY_LEVEL,
|
||||
DEVICE_CLASS_BATTERY,
|
||||
ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
PERCENTAGE,
|
||||
TIME_MINUTES,
|
||||
@ -133,7 +136,7 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
|
||||
key=ATTR_BATTERY_LEVEL,
|
||||
name="Battery Level",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
device_class=DEVICE_CLASS_BATTERY,
|
||||
device_class=SensorDeviceClass.BATTERY,
|
||||
entity_class=TractiveHardwareSensor,
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
),
|
||||
|
Loading…
x
Reference in New Issue
Block a user