J. Nick Koston
00db97a765
Run device_registry stop listener immediately ( #114978 )
2024-04-05 21:59:27 -04:00
J. Nick Koston
a9d43db315
Avoid linear search to clear a config entry in the device registry ( #114802 )
2024-04-04 08:35:07 -10:00
Marc Mueller
816ce116bf
Remove unnecessary functools.cached_property backport ( #114239 )
2024-04-04 11:24:26 +02:00
J. Nick Koston
3f76d1f056
Add index for area/config_entry/label to the device registry ( #114776 )
...
* Add index for area/config_entry/label to the device registry
* use it for services
* naming
* naming
* tweak
2024-04-03 22:52:17 -04:00
J. Nick Koston
adbaed2c6d
Reduce code for registry items with a base class ( #114689 )
2024-04-03 09:02:32 +02:00
J. Nick Koston
e9c1753f3a
Cache parsing the url for the device registry ( #113910 )
...
* Cache parsing the url for the device registry
There are lots of hub integrations that use the same url for every
sub-device which results in a lot of url parsing at startup. The
logic can be simplified quite a bit here by only using yarl
for URLs
* fix onvif
2024-03-20 19:35:01 -04:00
Erik Montnemery
d31124d5d4
Avoid creating unneeded Context and Event objects when firing events ( #113798 )
...
* Avoid creating unneeded Context and Event objects when firing events
* Add test
---------
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-20 09:40:06 +01:00
Franck Nijhof
51b8ffc69d
Add WebSocket support for handling labels on device registry ( #113758 )
2024-03-18 21:19:27 +01:00
Sid
82a60fe8ad
Enable Ruff RSE ( #113695 )
2024-03-18 00:40:38 +01:00
J. Nick Koston
68320b1278
Migrate registry for labels and categories to run_immediately ( #113645 )
2024-03-17 08:16:11 -10:00
J. Nick Koston
93497dde8b
Run registry cleanup listeners immediately ( #113646 )
2024-03-17 08:15:55 -10:00
J. Nick Koston
5b80eb4c3d
Reduce overhead to save the larger registries ( #113462 )
...
We save the device and entity registry to disk quite often, and
the cost of serializing them to the storage can block the event
loop for >100ms. Add a cache to reduce the change the loop is blocked
at an inopportune time at run time. The first write after startup
will still be a little slow but we do have to serialize the
bulk of it at least once as there is no way to avoid this
```
2024-03-14 11:28:19.765 WARNING (MainThread) [homeassistant.helpers.storage] Writing data with data_func: core.device_registry
2024-03-14 11:28:20.020 WARNING (MainThread) [homeassistant.helpers.storage] Writing data with data_func: core.entity_registry
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
```
2024-03-14 19:54:43 -04:00
J. Nick Koston
b3dedb3efb
Convert sets to list before passing to the JSON serializer in the registries ( #113133 )
...
There were a few places we were missing the set to list
conversions in the registries. We do this before its
cached to avoid the JSON serializer having to fallback
to the default method every time since its expensive
to switch back from the native code into python context
for every set.
2024-03-12 08:38:21 -04:00
Marc Mueller
de886d8c49
Update EventBus listen type signatures ( #112760 )
2024-03-08 21:57:23 +01:00
Marc Mueller
19ab3d6daf
Add empty line after module docstring [helpers + other] ( #112707 )
2024-03-08 10:36:11 -05:00
J. Nick Koston
caefdc6192
Avoid writing registries to disk during startup ( #112662 )
2024-03-07 19:14:42 -10:00
J. Nick Koston
2c179dc5fb
Reduce some linear searches to cleanup the device registry ( #112277 )
...
Some of the data we had to search for was already available
in a dict or underlying data structure. Make it available
instead of having to build it every time.
There are more places these can be used, but I only did
the device registry cleanup for now
2024-03-04 20:59:12 -05:00
Erik Montnemery
b336095239
Allow translating device names ( #110711 )
...
* Allow translating device names
* Don't keep a reference to translations in config entry
* Update kitchen_sink tests
* Add tests
2024-02-28 15:59:59 +01:00
J. Nick Koston
5bf8086a2b
Cache formatting of mac addresses ( #111140 )
2024-02-22 07:09:56 -10:00
J. Nick Koston
7bf0fb9e48
Avoid late import of area registry in device registry if its not used ( #111081 )
2024-02-21 12:45:00 -06:00
J. Nick Koston
776a9b8691
Make device registry cleanup a callback function ( #111052 )
...
* Add async_schedule_call to the Debouncer
async_schedule_call allows the Debouncer to schedule a call
from a callback without having to create tasks to run
async_call
* Update homeassistant/helpers/debounce.py
* Make device registry cleanup all callback function
* fix typing, code supported callback functions, but typing did not
* fixes
* fixes
* fix
* we had no coverage for other job types
* we had no coverage for other job types
2024-02-21 09:34:49 +01:00
Franck Nijhof
e0a9dcd996
Add label registry ( #110821 )
2024-02-19 11:59:08 +01:00
J. Nick Koston
60ab360fe7
Avoid bytes to string to bytes conversion in websocket api ( #108139 )
2024-01-16 21:37:34 +01:00
Erik Montnemery
c805ea7b4f
Include deprecated constants in wildcard imports ( #107114 )
2024-01-05 11:46:45 +01:00
Robert Resch
e18d2b8873
Deprecate deprecated device_registry helper constants ( #106227 )
2023-12-22 11:21:45 +01:00
Marc Mueller
a70ec64408
Update mypy to 1.7.0 ( #103800 )
2023-11-11 23:31:04 +01:00
Erik Montnemery
1621310ba7
Add serial_number to device registry entries ( #102334 )
...
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2023-10-22 15:14:44 +02:00
J. Nick Koston
fe5eba9b31
Use cached_property in device registry ( #100309 )
2023-09-13 15:36:07 -05:00
Erik Montnemery
c3d1cdd0e9
Improve UserDict in device and entity registries ( #100307 )
2023-09-13 11:09:34 -05:00
Erik Montnemery
2e1a5ddf2b
Don't allow creating device if config entry does not exist ( #98157 )
...
* Don't allow creating device if config entry does not exist
* Fix test
* Update test
2023-08-10 22:09:13 -04:00
Erik Montnemery
045c327928
Move DeviceInfo from entity to device registry ( #98149 )
...
* Move DeviceInfo from entity to device registry
* Update integrations
2023-08-10 22:04:26 -04:00
Franck Nijhof
af5fc7e759
Ensure load the device registry if it contains invalid configuration URLs ( #97589 )
2023-08-01 23:15:31 +02:00
Franck Nijhof
737ac8c600
Fix DeviceInfo configuration_url validation ( #97319 )
2023-07-27 18:57:01 +02:00
Marc Mueller
3371c41bda
Improve `async_track_device_registry_updated_event` callback typing ( #97125 )
2023-07-24 09:42:01 +02:00
Marc Mueller
69d7b035e0
Use EventType for more helper methods ( #97107 )
2023-07-23 23:22:04 +02:00
Franck Nijhof
30058297cf
Migrate backported StrEnum to built-in StrEnum ( #97101 )
2023-07-23 23:19:24 +02:00
Erik Montnemery
614f3c6a15
Move device info validation to device registry ( #96465 )
...
* Move device info validation to device registry
* Don't move DeviceInfo
* Fix type annotation
* Don't block adding device for unknown config entry
* Fix test
* Remove use of locals()
* Improve error message
2023-07-14 08:55:17 -04:00
Erik Montnemery
7539cf25be
Don't require passing identifiers to DeviceRegistry.async_get_device ( #96479 )
...
* Require keyword arguments to DeviceRegistry.async_get_device
* Update tests
* Update tests
* Don't enforce keyword arguments
2023-07-13 13:39:25 -04:00
J. Nick Koston
a0c023d5cb
Reduce overhead to lookup items in the entity and device registry ( #94568 )
2023-06-14 20:47:18 +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
029093d0b2
Fix lingering timer in device registry ( #89422 )
2023-03-10 09:48:58 -05:00
epenet
ba23816a0c
Inverse json import logic ( #88099 )
...
* Fix helpers and util
* Adjust components
* Move back errors
* Add report
* mypy
* mypy
* Assert deprecation messages
* Move test_json_loads_object
* Adjust tests
* Fix rebase
* Adjust pylint plugin
* Fix plugin
* Adjust references
* Adjust backup tests
2023-02-16 11:37:57 +01:00
Franck Nijhof
79b52a2b41
Stricter pylint message control ( #86154 )
2023-01-20 13:47:55 +01:00
Erik Montnemery
8983f665cf
Refactor device registry JSON cache ( #85539 )
2023-01-09 09:50:27 -10:00
Franck Nijhof
06a35fb7db
Code styling tweaks to core helpers ( #85441 )
2023-01-08 13:44:09 -10:00
Erik Montnemery
11c174aca3
Revert "Add aliases to device registry items" ( #84976 )
2023-01-02 12:30:25 +01:00
Franck Nijhof
d4f69a3652
String formatting and max line length - Part 7 ( #84532 )
...
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-12-27 11:18:56 +01:00
Erik Montnemery
057bb6ea0a
Add aliases to device registry items ( #84246 )
2022-12-20 23:43:31 +01:00
Erik Montnemery
f88ed6b69e
Use dict.setdefault in registry migration code ( #84277 )
2022-12-20 11:31:31 +01:00
Erik Montnemery
53263ea9bc
Revert "Add serial_number to device registry entries" ( #79139 )
2022-09-27 16:36:38 +02:00