Add long term stats support to Withings sensors (#74829)
This commit is contained in:
parent
4453241176
commit
a38b36cf34
1 changed files with 10 additions and 1 deletions
|
@ -1,7 +1,11 @@
|
||||||
"""Sensors flow for Withings."""
|
"""Sensors flow for Withings."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN, SensorEntity
|
from homeassistant.components.sensor import (
|
||||||
|
DOMAIN as SENSOR_DOMAIN,
|
||||||
|
SensorEntity,
|
||||||
|
SensorStateClass,
|
||||||
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
@ -37,3 +41,8 @@ class WithingsHealthSensor(BaseWithingsSensor, SensorEntity):
|
||||||
def native_unit_of_measurement(self) -> str:
|
def native_unit_of_measurement(self) -> str:
|
||||||
"""Return the unit of measurement of this entity, if any."""
|
"""Return the unit of measurement of this entity, if any."""
|
||||||
return self._attribute.unit_of_measurement
|
return self._attribute.unit_of_measurement
|
||||||
|
|
||||||
|
@property
|
||||||
|
def state_class(self) -> str:
|
||||||
|
"""Return the state_class of this entity, if any."""
|
||||||
|
return SensorStateClass.MEASUREMENT
|
||||||
|
|
Loading…
Add table
Reference in a new issue