mirror of
https://github.com/home-assistant/core.git
synced 2025-11-13 13:00:11 +00:00
Use new DeviceClass and EntityCategory enums in august (#61288)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
@@ -12,17 +12,13 @@ from yalexs.lock import LockDetail
|
||||
|
||||
from homeassistant.components.august import AugustData
|
||||
from homeassistant.components.sensor import (
|
||||
DEVICE_CLASS_BATTERY,
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
SensorEntityDescription,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_PICTURE,
|
||||
ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
PERCENTAGE,
|
||||
STATE_UNAVAILABLE,
|
||||
)
|
||||
from homeassistant.const import ATTR_ENTITY_PICTURE, PERCENTAGE, STATE_UNAVAILABLE
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
from homeassistant.helpers.entity_registry import async_get_registry
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
|
||||
@@ -73,14 +69,14 @@ class AugustSensorEntityDescription(
|
||||
SENSOR_TYPE_DEVICE_BATTERY = AugustSensorEntityDescription[LockDetail](
|
||||
key="device_battery",
|
||||
name="Battery",
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=_retrieve_device_battery_state,
|
||||
)
|
||||
|
||||
SENSOR_TYPE_KEYPAD_BATTERY = AugustSensorEntityDescription[KeypadDetail](
|
||||
key="linked_keypad_battery",
|
||||
name="Battery",
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=_retrieve_linked_keypad_battery_state,
|
||||
)
|
||||
|
||||
@@ -254,7 +250,7 @@ class AugustBatterySensor(AugustEntityMixin, SensorEntity, Generic[T]):
|
||||
"""Representation of an August sensor."""
|
||||
|
||||
entity_description: AugustSensorEntityDescription[T]
|
||||
_attr_device_class = DEVICE_CLASS_BATTERY
|
||||
_attr_device_class = SensorDeviceClass.BATTERY
|
||||
_attr_native_unit_of_measurement = PERCENTAGE
|
||||
|
||||
def __init__(
|
||||
|
||||
Reference in New Issue
Block a user