|
39 | 39 | from homeassistant.util import dt as dt_util
|
40 | 40 |
|
41 | 41 | from .const import (
|
42 |
| - ATTR_LAST_CHANGED_VALUE, |
| 42 | + ATTR_LAST_MODIFIED, |
43 | 43 | CONF_ENTITY_ID,
|
44 | 44 | DOMAIN,
|
45 | 45 | LOGGER,
|
@@ -197,7 +197,7 @@ class PeriodicMinMaxSensor(SensorEntity, RestoreEntity):
|
197 | 197 | _attr_should_poll = False
|
198 | 198 | _attr_state_class = SensorStateClass.MEASUREMENT
|
199 | 199 | _state_had_real_change = False
|
200 |
| - _attr_last_changed_value: datetime = dt_util.utcnow().isoformat() |
| 200 | + _attr_last_modified: datetime = dt_util.utcnow().isoformat() |
201 | 201 |
|
202 | 202 | def __init__(
|
203 | 203 | self,
|
@@ -237,8 +237,8 @@ async def async_added_to_hass(self) -> None:
|
237 | 237 | last_state = await self.async_get_last_state()
|
238 | 238 | if last_state:
|
239 | 239 | last_attrs = last_state.attributes
|
240 |
| - if last_attrs and ATTR_LAST_CHANGED_VALUE in last_attrs: |
241 |
| - self._attr_last_changed_value = last_attrs[ATTR_LAST_CHANGED_VALUE] |
| 240 | + if last_attrs and ATTR_LAST_MODIFIED in last_attrs: |
| 241 | + self._attr_last_modified = last_attrs[ATTR_LAST_MODIFIED] |
242 | 242 |
|
243 | 243 | self.async_on_remove(
|
244 | 244 | async_track_state_change_event(
|
@@ -313,7 +313,7 @@ def extra_state_attributes(self) -> dict[str, Any]:
|
313 | 313 | """Return the device specific state attributes."""
|
314 | 314 | attributes: dict[str, Any] = {}
|
315 | 315 |
|
316 |
| - attributes[ATTR_LAST_CHANGED_VALUE] = self._attr_last_changed_value |
| 316 | + attributes[ATTR_LAST_MODIFIED] = self._attr_last_modified |
317 | 317 |
|
318 | 318 | return attributes
|
319 | 319 |
|
@@ -365,7 +365,7 @@ def _async_min_max_sensor_state_listener(
|
365 | 365 | self._calc_values()
|
366 | 366 |
|
367 | 367 | if self._state_had_real_change:
|
368 |
| - self._attr_last_changed_value = dt_util.utcnow().isoformat(sep=" ") |
| 368 | + self._attr_last_modified = dt_util.utcnow().isoformat(sep=" ") |
369 | 369 |
|
370 | 370 | self.async_write_ha_state()
|
371 | 371 |
|
|
0 commit comments