dismiss service for persistent notifications (#7996)

* dismiss service for persistent notifications

Unnecessary notifications can now be removed automatically. Added a
dismiss service to remove persistent notifications via script and/or
automation.

* removed unnecessary loop

loop removed
This commit is contained in:
tedstriker 2017-06-11 22:54:10 +02:00 committed by Fabian Affolter
parent 314bce1073
commit de0f6b781e
3 changed files with 52 additions and 0 deletions

View file

@ -64,3 +64,16 @@ class TestPersistentNotification:
state = self.hass.states.get(entity_ids[0])
assert state.state == '{{ message + 1 }}'
assert state.attributes.get('title') == '{{ title + 1 }}'
def test_dismiss_notification(self):
"""Ensure removal of specific notification."""
assert len(self.hass.states.entity_ids(pn.DOMAIN)) == 0
pn.create(self.hass, 'test', notification_id='Beer 2')
self.hass.block_till_done()
assert len(self.hass.states.entity_ids(pn.DOMAIN)) == 1
pn.dismiss(self.hass, notification_id='Beer 2')
self.hass.block_till_done()
assert len(self.hass.states.entity_ids(pn.DOMAIN)) == 0