* Detect lingering threads after tests
* Make sure cast is setup before checking state
* Make sure we ask executors of old hass to shutdown
We are not waiting here, just hoping for the best
* Make sure all instances of hass and executors is stopped.
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Also apply hass stopping to scripts
* Adjust to changes how we set up executor
* Add new CoreState.stopped
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Fix exceptions.Unauthorized.permission type
* Use auth.permission consts more
* Auth typing improvements
* Helpers typing improvements
* Calculate self.state only once
* Part 1 of 2 (no breaking changes in part 1).
When integrations configured via the UI block startup or fail to start,
the webserver can remain offline which make it is impossible
to recover without manually changing files in
.storage since the UI is not available.
This change is the foundation that part 2 will build on
and enable a listener to start the webserver when the frontend
is finished loading.
Frontend Changes (home-assistant/frontend#6068)
* Address review comments
* bump timeout to 1800s, adjust comment
* bump timeout to 4h
* remove timeout failsafe
* and the test
* Don't write storage to disk while stopping
* rework change
* lint
* remove delay save and schedule final write at stop
* update tests
* fix test component using private methods
* cleanup
* always listen
* use stop in restore state again
* whitelist JSON exceptions for later
* review comment
* make zwave tests use mock storage
* add third stage to hass shutdown
* use 3rd stage in storage
* update core state
* add writing data to multi stop ignore
* update core test
* review comment
* update name based on feedback
* Add limit parameter to service call methods
* Break out prep part of async_call_from_config for use elsewhere
* Minor cleanup
* Fix improper use of asyncio.wait
* Fix state update
Call change listener immediately if its a callback
* Fix exception handling and logging
* Merge Script helper if_running/run_mode parameters into script_mode
- Remove background/blocking _ScriptRun subclasses which are no longer needed.
* Add queued script mode
* Disable timeout when making fully blocking script call
* Don't call change listener when restarting script
This makes restart mode behavior consistent with parallel & queue modes.
* Changes per review
- Call all script services (except script.turn_off) with no time limit.
- Fix handling of lock in _QueuedScriptRun and add comments to make it
clearer how this code works.
* Changes per review 2
- Move cancel shielding "up" from _ScriptRun.async_run to Script.async_run
(and apply to new style scripts only.) This makes sure Script class also
properly handles cancellation which it wasn't doing before.
- In _ScriptRun._async_call_service_step, instead of using script.turn_off
service, just cancel service call and let it handle the cancellation
accordingly.
* Fix bugs
- Add missing call to change listener in Script.async_run
in cancelled path.
- Cancel service task if ServiceRegistry.async_call cancelled.
* Revert last changes to ServiceRegistry.async_call
* Minor Script helper fixes & test improvements
- Don't log asyncio.CancelledError exceptions.
- Make change_listener a public attribute.
- Test overhaul
- Parametrize tests.
- Use common test functions.
- Mock timeout so tests don't need to wait for real time to elapse.
- Add common function for waiting for script action step.
* Remove malformed pylint disable markers
* Remove some unused imports
* Remove some unneeded lint exclusions
* Remove more unneeded lint exclusions
* Add specific codes to all noqa's
* Add and improve core and config_entries type hints
* Complete and improve config_entries type hints
* More entity registry type hints
* Complete helpers.event type hints
* Refactor the Somfy auth implementation
* Typing
* Migrate Somfy to OAuth2 flow helper
* Add tests
* Add more tests
* Fix tests
* Fix type error
* More tests
* Remove side effect from constructor
* implementation -> auth_implementation
* Make get_implementation async
* Minor cleanup + Allow picking implementations.
* Add support for extra authorize data
* Type hint additions
* Remove optional from sidebar_icon comment
Co-Authored-By: Franck Nijhof <frenck@frenck.nl>
* Remove optional from sidebar_title comment
Co-Authored-By: Franck Nijhof <frenck@frenck.nl>
* Fix issues after rebase and mypy 0.730