Commit Graph

1962 Commits (e2fb1de0d916f3c752874edb39e40bd8f5ad45cf)

Author SHA1 Message Date
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
Franck Nijhof 32344a8488
Fix incorrect warn of async_update_ha_state use (#91387) 2023-04-13 22:39:03 +02:00
epenet 9744e72d5a
Add ability to auto-cancel track_time_interval (#91381) 2023-04-13 21:31:16 +02:00
Franck Nijhof 22a1a6846d
Warn for unneeded use of async_update_ha_state (#91372) 2023-04-13 13:49:56 -04:00
Franck Nijhof 445b823232
Avoid task creation when calling schedule_update_ha_state without force update (#91352) 2023-04-13 18:39:03 +02:00
epenet 4a0988eb5d
Adjust shutdown registration in EntityComponent (#90938)
* Adjust shutdown registration in EntityComponent

* Adjust

* Make it more explicit

* docstring
2023-04-13 08:47:04 +02:00
David Poll ea12d7a86f
Add pretty printing, key sorting, and better performance to to_json in Jinja (#91253)
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-04-13 00:32:13 +02:00
Erik Montnemery 2c9e9d0fde
Allow UI configuration of entities exposed to voice_assistant (#91233)
* Allow UI configuration of entities exposed to voice_assistant

* Invalidate cache when settings change

* Add tests

* Expose entities to conversation by default

* Update tests
2023-04-11 22:39:40 -04:00
rlippmann 3a72054f93
Make dataclasses in HA core slotted (#91208) 2023-04-11 07:58:28 -10:00
J. Nick Koston 3d1556a4a2
Switch back to using call_later for the slow entity update warning (#91067)
* Switch back to using call_later for the slow entity update warning

I had originally changed this to create a task and wait
in #41184 but that does not make sense anymore with newer
cpython as the profile now shows the original method is cheaper
(or I did it wrong the first time)

* fix missing block till done since there is no longer a task being created which would run the event loop once
2023-04-08 22:22:56 -04:00
Marc Mueller b2bcdf7c19
Update mypy to 1.2.0 (#90947)
* Update mypy to 1.2.0

* Add type ignore
2023-04-06 12:51:16 -04:00
Erik Montnemery 59a02cd08c
Allow storing other items than untyped `dict` in `StorageCollection` (#90932)
Allow storing other items than untyped dict in StorageCollection
2023-04-06 10:57:00 -04:00
Erik Montnemery fa308d8e10
Drop unused logger argument for StorageCollection() (#90913) 2023-04-06 13:28:34 +02:00
epenet c01b1eb013
Adjust async_track_time_interval name argument (#90838)
Adjust async_track_time_interval naming
2023-04-05 10:58:02 -04:00
J. Nick Koston 5eb0c35a97
Add names to common helper tasks (#90803) 2023-04-05 08:41:15 +02:00
Erik Montnemery 37661fe79f
Update template environment from the event loop (#90758) 2023-04-04 09:52:47 +02:00
J. Nick Koston edd93e989e
Add render count to templates repr (#90753) 2023-04-03 19:38:15 -10:00
J. Nick Koston 17719663f0
Fix memory churn in state templates (#90685)
* 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
2023-04-02 20:51:25 -04:00
J. Nick Koston 44b35fea47
Speed up entity filter when there are many glob matchers (#90615)
* Speed up entity filter when there are many glob matchers

Since we do no care about which glob matches we can
combine all the translated globs into a single regex
which reduces the overhead

* delete unused code

* preen
2023-03-31 21:18:29 -04:00