mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +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 typing import Any
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
DEVICE_CLASS_BATTERY_CHARGING,
|
BinarySensorDeviceClass,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
BinarySensorEntityDescription,
|
BinarySensorEntityDescription,
|
||||||
)
|
)
|
||||||
@ -76,7 +76,7 @@ class TractiveBinarySensor(TractiveEntity, BinarySensorEntity):
|
|||||||
SENSOR_TYPE = BinarySensorEntityDescription(
|
SENSOR_TYPE = BinarySensorEntityDescription(
|
||||||
key=ATTR_BATTERY_CHARGING,
|
key=ATTR_BATTERY_CHARGING,
|
||||||
name="Battery Charging",
|
name="Battery Charging",
|
||||||
device_class=DEVICE_CLASS_BATTERY_CHARGING,
|
device_class=BinarySensorDeviceClass.BATTERY_CHARGING,
|
||||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -4,11 +4,14 @@ from __future__ import annotations
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any
|
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.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_BATTERY_LEVEL,
|
ATTR_BATTERY_LEVEL,
|
||||||
DEVICE_CLASS_BATTERY,
|
|
||||||
ENTITY_CATEGORY_DIAGNOSTIC,
|
ENTITY_CATEGORY_DIAGNOSTIC,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
TIME_MINUTES,
|
TIME_MINUTES,
|
||||||
@ -133,7 +136,7 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
|
|||||||
key=ATTR_BATTERY_LEVEL,
|
key=ATTR_BATTERY_LEVEL,
|
||||||
name="Battery Level",
|
name="Battery Level",
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
device_class=DEVICE_CLASS_BATTERY,
|
device_class=SensorDeviceClass.BATTERY,
|
||||||
entity_class=TractiveHardwareSensor,
|
entity_class=TractiveHardwareSensor,
|
||||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user