Add force_update to timer integration (#31646)

* force_update added

As per this discussion we need to update last_changed when active timer restarted.
One way to do that is to force HA update the state on each request even if it remains the same.
More details here - https://github.com/home-assistant/architecture/issues/345

* add test for force_update

make sure state_change event fired every time timer (re)started

* remove whitespaces

* remove whitespace

* Update tests/components/timer/test_init.py

Co-Authored-By: Alexei Chetroi <lexoid@gmail.com>

* fix lint

* fix isort

Co-authored-by: Alexei Chetroi <lexoid@gmail.com>
This commit is contained in:
akasma74andAlexei Chetroi authored and GitHub committed 2020-04-02 23:48:41 -07:00
1 parent d2cd557523
commit 83cc871edf
2 files changed
+47

No files matched your search

@@ -201,6 +201,11 @@ class Timer(RestoreEntity):
"""If entity should be polled."""
return False
@property
def force_update(self) -> bool:
"""Return True to fix restart issues."""
return True
@property
def name(self):
"""Return name of the timer."""