* DNM: Make run_immediately the default for listeners
This is a test to see how much progress we have made twords this goal
https://github.com/home-assistant/core/pull/113727#issuecomment-2004587947
* fix shutdown
* Revert "fix shutdown"
This reverts commit a8969d7db9.
* set false since it break utility meter tests
* one more
* fix rfxtrx test
* test needs to be explict now
* fix matrix
* fail sooner
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
* Add generic entity platform setup fixture
* rename fixture
* No need for passing hass
* Make function instead of fixture
* Improve typing
* Use Sequence instead
* Migrate flux to use the new helper
* Use list instead
* Use Sequence instead
* Add category registry
* Add entity registry support
* Update homeassistant/components/config/entity_registry.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Use ulid instead
* Add tests for adding same name in different scopes
* Handle keyerror on update
* Lookup tweak
* Omit categories from entity registry snapshots
* Use base registry
* Update snapshots
* Update snapshots
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Construct storage data in the executor
Constructing storage data can be expensive for large files and can block the event
loop. While ideally we optimize the construction of the data, there are some places
we cannot make it any faster. To avoid blocking the loop, the construction of
the data is now done in the executor by running the data_func in the executor.
2024-03-14 11:28:20.178 WARNING (MainThread) [asyncio] Executing <TimerHandle cancelled when=2319925.760294916 Store._async_schedule_callback_delayed_write() created at /Users/bdraco/home-assistant/homeassistant/helpers/storage.py:328> took 0.159 seconds
There is some risk that the data_func is not thread-safe and needs to be run in
the event loop, but I could not find any cases in our existing code where it
would be a problem
* Avoid scheduling registry loads as tasks in tests
Since we patch out async_load in Store, these will not yield
to the event loop so it makes sense to await them instead
of creating tasks
This reduced my local test run times ~2.5% on average
* mock out save as well so we do not schedule tasks to save empty data
* tweaks
* fix lingering files
* another one
* too much for one PR, reduce
* fix targets
* Cache construction of is_admin
This has to be checked for a lot of api calls and the websocket
every time the call is made
* Cache construction of is_admin
This has to be checked for a lot of api calls and the websocket
every time the call is made
* Cache construction of is_admin
This has to be checked for a lot of api calls and the websocket
every time the call is made
* modernize
* coverage
* coverage
* verify caching
* verify caching
* fix type
* fix mocking
* Send localization info on script errors
* Use connection exception hander
* Keep HomeAssistantError is unknown_error
* Move specific exception handling
* Add support for responses to call_service WS cmd
* Revert ServiceNotFound removal and add a parameter for return_response
* fix type
* fix tests
* remove exception handling that was added
* Revert unnecessary modifications
* Use kwargs
* Decrease event loop latency by binding time.monotonic to loop.time directly
This is a small improvment to decrease event loop latency. While the goal is
is to reduce Bluetooth connection time latency, everything using asyncio
is a bit more responsive as a result.
* relo per comments
* fix too fast by adding resolution, ensure monotonic time is patchable by freezegun
* fix test that freezes time too late and has a race loop
* Update return signature of service calls
* Add timeout error handling in websocket api for service calls
* Update recorder tests to remove assertion on service call
* Remove timeout behavior and update callers that depend on it today
* Fix tests
* Add missing else
* await coro directly
* Fix more tests
* Update the intent task to use wait instead of timeout
* Remove script service call limits and limit constants
* Update tests that depend on service call limits
* Use wait instead of wait_for and add test
* Update homeassistant/helpers/intent.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Debounce discoveries to improve event loop stability at the started event
The first one is immediate and anything that fires within the next
second will be debounced to only happen once every second
* fix mock
* 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
* Complete migration of persistent notifications
Persistent notifications are no longer stored in
the state machine and no longer fire events
* Complete migration of persistent notifications
Persistent notifications are no longer stored in
the state machine and no longer fire events
* fixes
* fixes
* fixes
* ws test
* update tests
* update tests
* fix more tests
* fix more tests
* more fixes
* fix
* fix person
* fix person
* keep whitelist
* use singleton
* Keep task references while running
* Update pilight tests pointing at correct logger call
* Fix graphite tests
* Fix profiler tests
* More graphite test fixes
* Remove extra sleep
* Fix tests
* Shutdown background tasks as part of stage 1
* Remove unnecessary sleep in test
* Remove unused method on mock hass
* Skip on cancelled too
* Remove background tasks
* Test trigger variables without actually sleeping
* Fix graphite
* One more graphite grrrrrrr