Add devices class to better categorisation in HA
This commit is contained in:
@@ -5,8 +5,7 @@ from typing import Any, Mapping
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.components.sensor import ENTITY_ID_FORMAT
|
||||
from homeassistant.components.sensor import SensorEntity, SensorDeviceClass, ENTITY_ID_FORMAT
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
@@ -245,6 +244,11 @@ class GeoRideInternalBatterySensorEntity(CoordinatorEntity, SensorEntity):
|
||||
"""icon getter"""
|
||||
return "mdi:battery"
|
||||
|
||||
@property
|
||||
def device_class(self) -> str:
|
||||
"""device class"""
|
||||
return SensorDeviceClass.VOLTAGE
|
||||
|
||||
@property
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device info."""
|
||||
@@ -302,6 +306,11 @@ class GeoRideExternalBatterySensorEntity(CoordinatorEntity, SensorEntity):
|
||||
"""icon getter"""
|
||||
return "mdi:battery"
|
||||
|
||||
@property
|
||||
def device_class(self) -> str:
|
||||
"""device class"""
|
||||
return SensorDeviceClass.VOLTAGE
|
||||
|
||||
@property
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device info."""
|
||||
@@ -391,6 +400,11 @@ class GeoRideBeaconBatterySensorEntity(CoordinatorEntity, SensorEntity):
|
||||
"""icon getter"""
|
||||
return "mdi:battery"
|
||||
|
||||
@property
|
||||
def device_class(self) -> str:
|
||||
"""device class"""
|
||||
return SensorDeviceClass.BATTERY
|
||||
|
||||
@property
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device info."""
|
||||
|
||||
Reference in New Issue
Block a user