Add state attribute to SmartTub reminders for days remaining (#51825)

This commit is contained in:
Matt Zimmerman 2021-06-27 09:39:40 -07:00 committed by GitHub
parent a9bd7da79d
commit fad7e43c4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -29,9 +29,11 @@ ATTR_CREATED_AT = "created_at"
ATTR_UPDATED_AT = "updated_at"
# how many days to snooze the reminder for
ATTR_SNOOZE_DAYS = "days"
ATTR_REMINDER_DAYS = "days"
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 {
ATTR_REMINDER_SNOOZED: self.reminder.snoozed,
ATTR_REMINDER_DAYS: self.reminder.remaining_days,
}
async def async_snooze(self, days):

View File

@ -30,6 +30,7 @@ async def test_reminders(spa, setup_entry, hass):
assert state is not None
assert state.state == STATE_OFF
assert state.attributes["snoozed"] is False
assert state.attributes["days"] == 2
@pytest.fixture