mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 13:47:35 +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."""
|
"""Support for hunterdouglass_powerview sensors."""
|
||||||
from aiopvapi.resources.shade import factory as PvShade
|
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.config_entries import ConfigEntry
|
||||||
from homeassistant.const import PERCENTAGE
|
from homeassistant.const import PERCENTAGE
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
@ -55,22 +59,15 @@ class PowerViewShadeBatterySensor(ShadeEntity, SensorEntity):
|
|||||||
"""Representation of an shade battery charge sensor."""
|
"""Representation of an shade battery charge sensor."""
|
||||||
|
|
||||||
_attr_entity_category = EntityCategory.DIAGNOSTIC
|
_attr_entity_category = EntityCategory.DIAGNOSTIC
|
||||||
|
_attr_native_unit_of_measurement = PERCENTAGE
|
||||||
@property
|
_attr_device_class = SensorDeviceClass.BATTERY
|
||||||
def native_unit_of_measurement(self):
|
_attr_state_class = SensorStateClass.MEASUREMENT
|
||||||
"""Return the unit of measurement."""
|
|
||||||
return PERCENTAGE
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
"""Name of the shade battery."""
|
"""Name of the shade battery."""
|
||||||
return f"{self._shade_name} Battery"
|
return f"{self._shade_name} Battery"
|
||||||
|
|
||||||
@property
|
|
||||||
def device_class(self):
|
|
||||||
"""Shade battery Class."""
|
|
||||||
return SensorDeviceClass.BATTERY
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self):
|
def unique_id(self):
|
||||||
"""Shade battery Uniqueid."""
|
"""Shade battery Uniqueid."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user