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

@ -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."""