mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Add state class to hunterdouglas_powerview (#64936)
This commit is contained in:
parent
8593d07883
commit
5cc5813bd6
@ -1,7 +1,11 @@
|
||||
"""Support for hunterdouglass_powerview sensors."""
|
||||
from aiopvapi.resources.shade import factory as PvShade
|
||||
|
||||
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
||||
from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import PERCENTAGE
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
@ -55,22 +59,15 @@ class PowerViewShadeBatterySensor(ShadeEntity, SensorEntity):
|
||||
"""Representation of an shade battery charge sensor."""
|
||||
|
||||
_attr_entity_category = EntityCategory.DIAGNOSTIC
|
||||
|
||||
@property
|
||||
def native_unit_of_measurement(self):
|
||||
"""Return the unit of measurement."""
|
||||
return PERCENTAGE
|
||||
_attr_native_unit_of_measurement = PERCENTAGE
|
||||
_attr_device_class = SensorDeviceClass.BATTERY
|
||||
_attr_state_class = SensorStateClass.MEASUREMENT
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Name of the shade battery."""
|
||||
return f"{self._shade_name} Battery"
|
||||
|
||||
@property
|
||||
def device_class(self):
|
||||
"""Shade battery Class."""
|
||||
return SensorDeviceClass.BATTERY
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Shade battery Uniqueid."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user