Add last_reset for Sense trend sensors (#63490)

This commit is contained in:
Keilin Bickar 2022-01-20 15:41:07 -05:00 committed by GitHub
parent 9c11b0aa89
commit fe17f97543
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 4 deletions

View file

@ -2,7 +2,7 @@
"domain": "emulated_kasa",
"name": "Emulated Kasa",
"documentation": "https://www.home-assistant.io/integrations/emulated_kasa",
"requirements": ["sense_energy==0.9.3"],
"requirements": ["sense_energy==0.9.6"],
"codeowners": ["@kbickar"],
"quality_scale": "internal",
"iot_class": "local_push"

View file

@ -2,7 +2,7 @@
"domain": "sense",
"name": "Sense",
"documentation": "https://www.home-assistant.io/integrations/sense",
"requirements": ["sense_energy==0.9.3"],
"requirements": ["sense_energy==0.9.6"],
"codeowners": ["@kbickar"],
"config_flow": true,
"dhcp": [

View file

@ -1,4 +1,5 @@
"""Support for monitoring a Sense energy sensor."""
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
@ -297,6 +298,11 @@ class SenseTrendsSensor(CoordinatorEntity, SensorEntity):
"""Return the state of the sensor."""
return round(self._data.get_trend(self._sensor_type, self._variant_id), 1)
@property
def last_reset(self):
"""Return the time when the sensor was last reset, if any."""
return self._data.trend_start(self._sensor_type)
class SenseEnergyDevice(SensorEntity):
"""Implementation of a Sense energy device."""

View file

@ -2166,7 +2166,7 @@ sense-hat==2.2.0
# homeassistant.components.emulated_kasa
# homeassistant.components.sense
sense_energy==0.9.3
sense_energy==0.9.6
# homeassistant.components.sentry
sentry-sdk==1.5.2

View file

@ -1322,7 +1322,7 @@ screenlogicpy==0.5.4
# homeassistant.components.emulated_kasa
# homeassistant.components.sense
sense_energy==0.9.3
sense_energy==0.9.6
# homeassistant.components.sentry
sentry-sdk==1.5.2