Marc Mueller
c72477811e
Fix event typing ( #93859 )
2023-05-31 12:33:56 +02:00
Erik Montnemery
59c6220b7c
Subscribe to device registry changes from entities ( #93601 )
...
* Subscribe to device registry changes from entities
* Use async_track_device_registry_updated_event
* Fix unsubscribe
* Fix logic, add tests
2023-05-31 11:01:55 +02:00
J. Nick Koston
fba826ae9e
Migrate restore_state helper to use registry loading pattern ( #93773 )
...
* 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
2023-05-30 20:48:17 -05:00
J. Nick Koston
3186ddb095
Speed up setting up event trackers ( #93823 )
...
noticed in https://github.com/home-assistant/core/pull/93601 that
the cost of creating the function in the closure was a bit expensive
since we do it once per entity
2023-05-30 20:12:52 -04:00
J. Nick Koston
9f0d3bfce8
Use ReadOnlyDict for entity registry options ( #93824 )
...
* Use ReadOnlyDict for entity registry options
While reviewing #93601 it was noticed this was slow at startup
https://github.com/home-assistant/core/pull/93601#issuecomment-1568958280
This is a first pass attempt to improve the performance
* fix tests
2023-05-30 20:11:39 -04:00
Erik Montnemery
8b662dc94f
Detect attempt to setup config entry integration via YAML ( #93589 )
2023-05-29 21:01:47 +02:00
G Johansson
c6feb30c31
Raise issue "does not support platform setup" ( #93585 )
...
* Raise issue on platform missing
* Modify issue
* Remove deprecation
* Fix strings
* Strings
* Last strings
* strings to common
2023-05-28 21:53:32 +02:00
J. Nick Koston
083cf7a38b
Fix refactoring error with updating polling entities in sequence ( #93693 )
...
* Fix refactoring error with updating in sequence
see #93649
* coverage
* make sure entities are being updated in parallel
* make sure entities are being updated in sequence
2023-05-28 16:20:48 +02:00
Erik Montnemery
49c3a8886f
Make cv.empty_config_schema log an error instead of raise ( #93646 )
...
* Make cv.empty_config_schema log an error instead of raise
* Add test
* Update homeassistant/helpers/config_validation.py
Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
---------
Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
2023-05-28 15:54:22 +02:00
J. Nick Koston
0a9c4f15c4
Add event helper to dispatch device registry updates by device_id ( #93602 )
...
* Add event helper to dispatch device registry updates by device_id
* Update homeassistant/helpers/event.py
* dry
* dry
* reduce
* reduce
* reorder
* reduce
* cleanup stack depth
* dry
* fix double lookup
* remove unused
* collapse
2023-05-27 20:04:09 -04:00
J. Nick Koston
b966ff7a3d
Await in sequence when we know we will be blocked by the entity platform semaphore ( #93649 )
...
* Defer creating tasks we know are going to wait on the entity platform semaphore
When looking at whats going on with aiomonitor-ng, I noticed
we end up creating a lot of tasks that block waiting for the
executor because of the entity platform parallel_updates semaphore.
When we know the tasks are going to block we now await them
in sequence to avoid feeding the loop a herd of tasks that
will block on the semaphore
* change during iteration fix
* change during iteration fix
* cleanup
* cleanup
* fix vizio test
2023-05-27 19:58:02 -04:00
J. Nick Koston
5feceee588
Improve performance when serializing small bits of JSON ( #93653 )
...
* Improve performance when serializing small bits of JSON
Making json_bytes a partial reduced the run time to
build the small JSON messages by ~18.75%
We serialize a lot of small messages over the websocket
* typing
2023-05-27 19:53:52 -04:00
J. Nick Koston
560e744f1e
Reduce overhead to filter entities in the recorder ( #93656 )
...
* Reduce overhead to filter entities in the recorder
* fix type
2023-05-27 19:52:42 -04:00
J. Nick Koston
3a1389c3b4
Switch some frequently called call_laters to call_at ( #93659 )
...
* Switch some frequently called call_laters to call_at
call_at is a bit faster than call_later since call_later
is a wrapper around call_at.
We call at lot of these at startup so it helps a bit when
we are resource constrained
* update test
* update test
2023-05-27 19:45:35 -04:00
Erik Montnemery
d4462829f5
Add CONFIG_SCHEMA to analytics ( #93598 )
2023-05-26 16:29:32 +02:00
Erik Montnemery
a71c097aeb
Revert "Allow setting an entity's name by its device class" ( #93539 )
2023-05-25 17:20:54 +02:00
J. Nick Koston
5c6ed8f6d5
Use call_at for events instead call_later ( #93431 )
...
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2023-05-24 21:04:07 +02:00
Mike Degatano
08a719e09e
Add backup location and mount failed repair ( #93126 )
...
* Add backup location and mount failed repair
* Fix coverage
* Change storage_location to backup_location
* Use backticks
* Update homeassistant/helpers/selector.py
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-05-24 10:33:41 +02:00
J. Nick Koston
aa937b1640
Use slots for template RenderInfo ( #93337 )
2023-05-22 08:52:49 +02:00
J. Nick Koston
b993fe1c9d
Cache generation of the service descriptions ( #93131 )
2023-05-16 21:42:37 -05:00
J. Nick Koston
32b70ea133
Bump PyJWT to 2.7.0 ( #93128 )
2023-05-16 10:26:04 +02:00
J. Nick Koston
99265a983a
Speed up reconnects by caching state serialize ( #93050 )
2023-05-16 02:33:12 -05:00
J. Nick Koston
72a6d3a748
Re-enable cleanup_closed on cpython >= 3.11.4 ( #93120 )
2023-05-15 21:29:41 +02:00
J. Nick Koston
3314eed8d1
Switch to using a ContextVar for template RenderInfo ( #93016 )
...
The ContextVar is about 40% faster than the attr
and dict lookups
2023-05-14 12:23:31 -04:00
J. Nick Koston
7d371a33bb
Disable cleanup_closed for aiohttp.TCPConnector with cpython 3.11.1+ ( #93013 )
...
* Disable cleanup_closed for aiohttp.TCPConnector with cpython 3.11.2+
There is currently a relatively fast memory leak when using
cpython 3.11.2+ and cleanup_closed with aiohttp
For my production instance it was leaking ~450MiB per day
of `MemoryBIO`, `SSLProtocol`, `SSLObject`, `_SSLProtocolTransport`
`memoryview`, and `managedbuffer` objects
see https://github.com/aio-libs/aiohttp/issues/7252
see https://github.com/python/cpython/pull/98540
* Update homeassistant/helpers/aiohttp_client.py
2023-05-13 20:15:02 -04:00
Erik Montnemery
30f52b8d96
Minor typing adjustment in entity_platform ( #92978 )
2023-05-12 15:17:01 +02:00
J. Nick Koston
93bfd7d8d0
Small speed up to validating entity ids ( #92970 )
2023-05-12 15:04:09 +02:00
J. Nick Koston
24284fe379
Speed up validating domains in templates ( #92975 )
...
This path gets called quite a bit since most templates
access the state via states.DOMAIN...
2023-05-12 14:57:51 +02:00
J. Nick Koston
3c8659d5d7
Fix missing f-string in async_track_utc_time_change ( #92916 )
2023-05-11 08:37:15 +02:00
Erik Montnemery
67c1051305
Allow setting an entity's name by its device class ( #90767 )
...
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-05-09 18:55:55 +02:00
G Johansson
6ad4e13b38
Manual trigger entity and refactor command_line switch ( #91506 )
...
* TriggerEntity to CoordinatorTriggerEntity
* _render_templates
* split manual vs coordinator
* name
* ManualTriggerEntity
* value
* Remove ManualTriggerEntity
* ManualTriggerEntity
* process_manual_data
* Add test
* imports
* Move ManualTriggerEntity
* cmd_line switch
* Review comments
* Fix templating
* Review comments
* Remove unneeded logging
2023-05-08 10:19:37 +02:00
J. Nick Koston
4c3e98b77c
Fix parallel_updates being acquired too late for entity executor jobs ( #92681 )
...
* Fix parallel_updates being acquired too late for entity executor jobs
* tweak
2023-05-06 16:46:00 +02:00
epenet
70bfbde8aa
Add ability to shutdown a coordinator on STOP ( #92611 )
2023-05-05 16:05:03 +02:00
Michael Hansen
74560ab139
Skip unexposed entities in intent handlers ( #92415 )
...
* Filter intent handler entities by exposure
* Add test for skipping unexposed entities
2023-05-03 12:18:31 -04:00
Erik Montnemery
0126cfa9d9
Allow exposing any entity to the default conversation agent ( #92398 )
...
* Allow exposing any entity to the default conversation agent
* Tweak
* Fix race, update tests
* Update tests
2023-05-03 09:45:54 -04:00
Bram Kragten
aa4544accb
Add assist pipeline and language selectors ( #92030 )
2023-04-26 18:39:02 +02:00
G Johansson
1fa82fa886
Move TriggerBaseEntity into helpers ( #91945 )
...
* Move TriggerBaseEntity
* mypy
2023-04-25 09:56:40 +02:00
J. Nick Koston
fba7c6cacd
Remove deprecated async_get_registry ( #91928 )
...
Deprecated in 2021 via #46265 , report was added a year ago in #72088
2023-04-23 23:02:21 -04:00
epenet
79ad9a3646
Shutdown coordinator on entry unload ( #91748 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-04-21 10:07:31 +02:00
Erik Montnemery
03dcb915e3
Add missing callback decorator on StorageCollectionWebsocket.ws_list_item ( #91727 )
2023-04-20 07:58:11 -04:00
epenet
ae0cbffdd8
Add ability to shutdown update coordinator ( #91456 )
...
* Add ability to shutdown update coordinator
* Adjust nibe_heatpump
* Add tests
* Use async
* Remove duplicate code in update coordinator
* Adjust
* Revert nibe changes - it can now be done in a follow-up PR
* Adjust
* Fix incorrect merge
* async_fire_time_changed
2023-04-18 18:56:43 +02:00
epenet
28652345bd
Remove duplicate code in update coordinator ( #91573 )
2023-04-17 13:07:58 -10:00
epenet
81f018b7e5
Make Debouncer shutdown async ( #91542 )
...
* Make shutdown async in Debouncer
* Adjust test
2023-04-17 23:31:30 +02:00
Paulus Schoutsen
bd22e0bd43
Allow picking a pipeline for voip devices ( #91524 )
...
* Allow picking a pipeline for voip device
* Add tests
* Fix test
* Adjust on new pipeline data
2023-04-17 12:09:11 -05:00
Michael
67c4de90f3
Add option to select list of accepted ssl ciphers in httpx client ( #91389 )
2023-04-15 09:32:30 -10:00
epenet
a018ba0696
Improve async_track_point_in_time ( #91451 )
...
* Adjust async_track_point_in_time
* Adjust name
2023-04-15 20:28:08 +02:00
Erik Montnemery
8f8a398631
Support marking an assist pipeline as preferred ( #91418 )
...
* Support marking an assist pipeline as preferred
* Adjust
* Revert unneeded change
* Send preferred pipeline id in pipeline list
* Don't use property functions for the preferred pipeline
2023-04-15 10:05:46 -04:00
J. Nick Koston
56cc6633f5
Use fast path for track_time_change that fires every second ( #91432 )
...
We were missing a check for `*` and were only checking
`None`. Automations use `*`, python code uses `None`.
2023-04-14 21:02:54 -04:00
J. Nick Koston
5ffd833fdf
Improve performance of tracking time changes ( #91433 )
...
* Improve performance of async_track_time_interval
Uses HassJob internally to avoid looking up the function
target type every time it fires
* name
2023-04-14 21:02:13 -04:00
epenet
19a6530c3c
Add ability to shutdown a Debouncer ( #91439 )
...
* Add ability to shutdown a Debouncer
* Use async_create_task
2023-04-14 21:01:21 -04:00