mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add state attribute to SmartTub reminders for days remaining (#51825)
This commit is contained in:
parent
a9bd7da79d
commit
fad7e43c4f
@ -29,9 +29,11 @@ ATTR_CREATED_AT = "created_at"
|
|||||||
ATTR_UPDATED_AT = "updated_at"
|
ATTR_UPDATED_AT = "updated_at"
|
||||||
|
|
||||||
# how many days to snooze the reminder for
|
# how many days to snooze the reminder for
|
||||||
ATTR_SNOOZE_DAYS = "days"
|
ATTR_REMINDER_DAYS = "days"
|
||||||
SNOOZE_REMINDER_SCHEMA = {
|
SNOOZE_REMINDER_SCHEMA = {
|
||||||
vol.Required(ATTR_SNOOZE_DAYS): vol.All(vol.Coerce(int), vol.Range(min=10, max=120))
|
vol.Required(ATTR_REMINDER_DAYS): vol.All(
|
||||||
|
vol.Coerce(int), vol.Range(min=10, max=120)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -117,6 +119,7 @@ class SmartTubReminder(SmartTubEntity, BinarySensorEntity):
|
|||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return {
|
return {
|
||||||
ATTR_REMINDER_SNOOZED: self.reminder.snoozed,
|
ATTR_REMINDER_SNOOZED: self.reminder.snoozed,
|
||||||
|
ATTR_REMINDER_DAYS: self.reminder.remaining_days,
|
||||||
}
|
}
|
||||||
|
|
||||||
async def async_snooze(self, days):
|
async def async_snooze(self, days):
|
||||||
|
@ -30,6 +30,7 @@ async def test_reminders(spa, setup_entry, hass):
|
|||||||
assert state is not None
|
assert state is not None
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
assert state.attributes["snoozed"] is False
|
assert state.attributes["snoozed"] is False
|
||||||
|
assert state.attributes["days"] == 2
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
Loading…
x
Reference in New Issue
Block a user