diff --git a/homeassistant/components/smarttub/sensor.py b/homeassistant/components/smarttub/sensor.py index be3d60c0241..44f09989a99 100644 --- a/homeassistant/components/smarttub/sensor.py +++ b/homeassistant/components/smarttub/sensor.py @@ -7,9 +7,11 @@ from .entity import SmartTubSensorBase _LOGGER = logging.getLogger(__name__) +# the desired duration, in hours, of the cycle ATTR_DURATION = "duration" -ATTR_LAST_UPDATED = "last_updated" +ATTR_CYCLE_LAST_UPDATED = "cycle_last_updated" ATTR_MODE = "mode" +# the hour of the day at which to start the cycle (0-23) ATTR_START_HOUR = "start_hour" @@ -73,7 +75,7 @@ class SmartTubPrimaryFiltrationCycle(SmartTubSensor): state = self._state return { ATTR_DURATION: state.duration, - ATTR_LAST_UPDATED: state.last_updated.isoformat(), + ATTR_CYCLE_LAST_UPDATED: state.last_updated.isoformat(), ATTR_MODE: state.mode.name.lower(), ATTR_START_HOUR: state.start_hour, } @@ -98,6 +100,6 @@ class SmartTubSecondaryFiltrationCycle(SmartTubSensor): """Return the state attributes.""" state = self._state return { - ATTR_LAST_UPDATED: state.last_updated.isoformat(), + ATTR_CYCLE_LAST_UPDATED: state.last_updated.isoformat(), ATTR_MODE: state.mode.name.lower(), } diff --git a/tests/components/smarttub/test_sensor.py b/tests/components/smarttub/test_sensor.py index 5b0163daf26..2d52d6d07a5 100644 --- a/tests/components/smarttub/test_sensor.py +++ b/tests/components/smarttub/test_sensor.py @@ -47,7 +47,7 @@ async def test_sensors(spa, setup_entry, hass): assert state is not None assert state.state == "inactive" assert state.attributes["duration"] == 4 - assert state.attributes["last_updated"] is not None + assert state.attributes["cycle_last_updated"] is not None assert state.attributes["mode"] == "normal" assert state.attributes["start_hour"] == 2 @@ -55,5 +55,5 @@ async def test_sensors(spa, setup_entry, hass): state = hass.states.get(entity_id) assert state is not None assert state.state == "inactive" - assert state.attributes["last_updated"] is not None + assert state.attributes["cycle_last_updated"] is not None assert state.attributes["mode"] == "away"