* Migrate restore_state helper to use registry loading pattern
As more entities have started using restore_state over time, it
has become a startup bottleneck as each entity being added is
creating a task to load restore state data that is already loaded
since it is a singleton
We now use the same pattern as the registry helpers
* fix refactoring error -- guess I am tired
* fixes
* fix tests
* fix more
* fix more
* fix zha tests
* fix zha tests
* comments
* fix error
* add missing coverage
* s/DATA_RESTORE_STATE_TASK/DATA_RESTORE_STATE/g
The default behavior of these warnings is to go to stderr, which in
some setups goes easily unnoticed. For example in Docker based ones,
they end up only in the container logs, and not e.g. in the HA log.
Capture these to make them available in logs where other such messages
are, and to make them subject to filtering as usual.
https://docs.python.org/3/library/logging.html#logging.captureWarnings
* Do not wait
* Correct tests
* Manage after dependencies stage 1
* test bootstrap dependencies
* Assert log the dependenciy is waited for
* Improve docstrings
* Assert outside callback
* Patch async_get_integrations
* Revert changes made to snips integration
* Undo changes to mqtt_statestream
* Fix memory churn in state templates
The LRU for state templates was limited to 512 states. As soon
as it was exaused, system performance would tank as each template
that iterated all states would have to create and GC any state
> 512
* does it scale?
* avoid copy on all
* comment
* preen
* cover
* cover
* comments
* comments
* comments
* preen
* preen
* Adds a loader to enable jinja imports.
* Switch to in-memory
* Move loading custom_jinja off of the event loop
* Raise TemplateNotFound if template doesn't exist
* Fix docstring
* Adds a service to reload custom jinja
* Remove IO from test setup
* Improve coverage and small refactor
* Incorporate feedback and use .jinja extension
* Check the loaded sources in test.
* Incorporate PR feedback.
* Update homeassistant/helpers/template.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Allow configuring country and language in core config
* Add script for updating list of countries
* Use black for formatting
* Fix quoting
* Move country codes to a separate file
* Address review comments
* Add generated/countries.py
* Get default language from owner account
* Remove unused variable
* Add script to generate list of supported languages
* Add tests
* Fix stale docsring
* Use format_python_namespace
* Correct async_user_store
* Improve typing
* Fix with_store decorator
* Initialize language in core store migration
* Fix startup
* Tweak
* Apply suggestions from code review
Co-authored-by: Franck Nijhof <git@frenck.dev>
* Update storage.py
Co-authored-by: Franck Nijhof <git@frenck.dev>
Prime platform.uname cache at startup to fix blocking subprocess
- Multiple modules check platform.uname()[0] at startup which
does a blocking subprocess call. We can avoid this happening
in the eventloop and distrupting startup stability by priming
the cache ahead of time in the executor