mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
Clean up SmartTub reminders (#48033)
* remove "date" state attribute * remove unused constant
This commit is contained in:
parent
879c82ebf8
commit
5265aabf92
@ -1,5 +1,4 @@
|
||||
"""Platform for binary sensor integration."""
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
|
||||
from smarttub import SpaReminder
|
||||
@ -17,8 +16,6 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
# whether the reminder has been snoozed (bool)
|
||||
ATTR_REMINDER_SNOOZED = "snoozed"
|
||||
# the date at which the reminder will be activated
|
||||
ATTR_REMINDER_DATE = "date"
|
||||
|
||||
|
||||
async def async_setup_entry(hass, entry, async_add_entities):
|
||||
@ -83,12 +80,10 @@ class SmartTubReminder(SmartTubEntity, BinarySensorEntity):
|
||||
return self.reminder.remaining_days == 0
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
when = datetime.now() + timedelta(days=self.reminder.remaining_days)
|
||||
return {
|
||||
ATTR_REMINDER_SNOOZED: self.reminder.snoozed,
|
||||
ATTR_REMINDER_DATE: when.date().isoformat(),
|
||||
}
|
||||
|
||||
@property
|
||||
|
@ -1,6 +1,4 @@
|
||||
"""Test the SmartTub binary sensor platform."""
|
||||
from datetime import date, timedelta
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
DEVICE_CLASS_CONNECTIVITY,
|
||||
STATE_OFF,
|
||||
@ -25,7 +23,4 @@ async def test_reminders(spa, setup_entry, hass):
|
||||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.state == STATE_OFF
|
||||
assert date.fromisoformat(state.attributes["date"]) <= date.today() + timedelta(
|
||||
days=2
|
||||
)
|
||||
assert state.attributes["snoozed"] is False
|
||||
|
Loading…
x
Reference in New Issue
Block a user