Open gtdiehl opened 3 years ago
Note that this warning will not show if last_reset returns None for the measurements sensor.
The pull request I've pushed for updating for 2021.9 will not show this warning, even though last_reset still exists.
fairly sure it will be re-added.
I missed this during the code review! 🥲 Is this still needed in sensor.py
? I don't see a need for it as this code is has a minimum HA version of 2021.9.0 and the last_reset
property is not needed for that HA version.
@property
def last_reset(self):
"""Return the time when the sensor was last reset, if any."""
if self.state_class == STATE_CLASS_MEASUREMENT:
return None
if self._accumulating:
return datetime.min # an accumulating sensor never reset.
last_reset = self._sensor_data.getBegin()
if last_reset is None:
return None
return dt.parse_datetime(last_reset)
Note that this has been reintroduced and is to be used with state class TOTAL. I believe the sensors should be changed to state class TOTAL to fix this issue https://github.com/gtdiehl/iotawatt_ha/issues/33
Note that this has been reintroduced and is to be used with state class TOTAL. I believe the sensors should be changed to state class TOTAL to fix this issue #33
I have already pushed a change and landed the code in HA upstream.
I will backport those changes here
Any updates?
I have a suggested PR https://github.com/gtdiehl/iotawatt_ha/pull/37
Starting in Home Assistant Core 2021.11 the
last_attribute
will be deprecated. Need to remove this attribute to avoid users seeing the below message for each entity that is using the attribute.2021-08-27 21:57:49 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.iotawatt_output_subpaneltotal_wh (<class 'homeassistant.components.iotawatt.sensor.IotaWattSensor'>) with state_class measurement has set last_reset. Setting last_reset is deprecated and will be unsupported from Home Assistant Core 2021.11. Please update your configuration if state_class is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+iotawatt%22