* Add yamllint (in pre-commit and CI)
* Fix linting for all YAML files
* Bump and add it to requirements
* Fix gen_requirements for pre-commit, remove 'v' from version
* 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>
Rewrote the tests a bit
the 'wait for the timer to finish' part of the test is now it's own test.
The rest is a sequence of fire/assert. Which i rewrote to a loop to
reduce the amount of duplicate code
* Restore states through a JSON store
* Accept entity_id directly in restore state helper
* Keep states stored between runs for a limited time
* Remove warning
* Lazy loading of service descriptions
* Fix tests
* Load YAML in executor
* Return a copy of available services to allow mutations
* Remove lint
* Add zha/services.yaml
* Only cache descriptions for known services
* Remove lint
* Remove description loading during service registration
* Remove description parameter from async_register
* Test async_get_all_descriptions
* Remove lint
* Fix typos from multi-edit
* Remove unused arguments
* Remove unused import os
* Remove unused import os, part 2
* Remove unneeded coroutine decorator
* Only use executor for loading files
* Cleanups suggested in review
* Increase test coverage
* Fix races in existing tests
Add the amount of remaining time before a timer is finished in its state attributes, so that it is received when fetching a timer state.
In my particular case, it allows me to correctly implement a UI for a timer when it is paused and when the UI didn't received the pause state change (which happens when the UI is started after the pause). In this case, it is impossible to show the remaining amount of time before the timer ends.
* Added timer component
* Reworked functionality a bit
* Fixed requested change
* Fixed state updates when finished
* Removing expired listeners, added events, changed services
* Added finish service
* Using timedelta parameters in start-service
* Cleanup
* Lint
* Updating state for remaining time
* Removed duration from cancel method
* Renamed service to fix disabled lint
* Some tests (incomplete)
* Relocated service descriptions
* Addressed requested changes
* Adjusted tests, added methods and events
* Added test for finish service, lint
* Code cleanp, using string states
* tzzz... one char...
* Proper usage of restore_state
* Some more cleanup