187 Commits

Author SHA1 Message Date
Erik Montnemery
4b34d1bbb5
Merge config subentry feature branch to dev (#136121)
* Reapply "Add support for subentries to config entries" (#133470) (#136061)

* Reapply "Add support for subentries to config entries" (#133470)

This reverts commit ecb3bf79f32a2e25d141ff467e5958826ed9fc3a.

* Update test snapshot

* Add config subentry support to device registry (#128157)

* Add config subentry support to device registry

* Apply suggestions from code review

* Update syrupy serializer

* Update snapshots

* Address review comments

* Allow a device to be connected to no or a single subentry of a config entry

* Update snapshots

* Revert "Allow a device to be connected to no or a single subentry of a config entry"

This reverts commit ec6f613151cb4a806b7961033c004b71b76510c2.

* Update test snapshots

* Bump release version in comments

* Rename config_subentries to config_entries_subentries

* Add config subentry support to entity registry (#128155)

* Add config subentry support to entity registry

* Update syrupy serializer

* Update snapshots

* Update snapshots

* Accept suggested changes

* Clean registries when removing subentry (#136671)

* Clean up registries when removing subentry

* Update tests

* Clean up subentries from deleted devices when removing config entry (#136669)

* Clean up subentries from deleted devices when removing config entry

* Move

* Add config subentry support to entity platform (#128161)

* Add config subentry support to entity platform

* Rename subentry_id to config_subentry_id

* Store subentry type in subentry (#136687)

* Add reconfigure support to config subentries (#133353)

* Add reconfigure support to config subentries

* Update test

* Minor adjustment

* Rename supported_subentry_flows to supported_subentry_types

* Address review comments

* Add subentry support to kitchen sink (#136755)

* Add subentry support to kitchen sink

* Add subentry reconfigure support to kitchen_sink

* Update kitchen_sink tests with subentry type stored in config entry

* Update kitchen_sink

* Update kitchen_sink

* Adjust kitchen sink tests

* Fix hassfest

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Improve docstrings and strings.json

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2025-02-10 16:40:07 +01:00
Artur Pragacz
6d6961ae6e
Clean up colliding deleted devices when updating non-deleted devices (#135592)
* Fix Schrödinger's devices

* Address feedback

* Add comment with broader context
2025-02-07 14:44:44 +01:00
epenet
a05ac6255c
Standardize util imports (#136723) 2025-01-28 15:54:06 +01:00
Ville Skyttä
40eb8b91cc
Adjust to recommended propcache.api import paths (#136150) 2025-01-21 10:58:22 +01:00
Artur Pragacz
877e44e3c9
Remove redundant device update code (#134100)
Remove redundant device update steps
2025-01-20 09:37:32 +01:00
Robert Resch
fd14add67b
Remove deprecated device registry constants (#131802) 2024-11-28 11:20:44 +01:00
Jan Bouwhuis
d26c7a0536
Log warning if via_device reference not exists when creating or updating a device registry entry (#131746) 2024-11-28 08:27:24 +01:00
epenet
b24931c775
Remove checks for DeviceEntryDisabler and DeviceEntryType enum (#130367) 2024-11-15 12:33:47 +01:00
Erik Montnemery
e682d3461f
Remove parameter add_config_entry from DeviceRegistry.async_update_device (#128139) 2024-10-11 14:01:14 +02:00
Erik Montnemery
8ba14ef113
Minor improvement of device_registry (#128075)
* Minor improvement of device_registry

* Remove uncovered line
2024-10-10 22:41:44 +02:00
J. Nick Koston
24fbc366a6
Restore __slots__ to registry entries (#127481) 2024-10-05 12:16:52 +02:00
J. Nick Koston
0f29fd3e10
Switch to using fast cached_property implementation in propcache (#127339) 2024-10-03 13:11:02 -05:00
J. Nick Koston
0e0ac3efe5
Remove uneeded isoformat calls in registry as_storage_fragment properties (#126440) 2024-09-23 14:23:43 +02:00
J. Nick Koston
e1e64be3c9
Remigrate device_registry created_at/modified_at (#122490)
* Remigrate device_registry created_at/modified_at

Nightly current does not boot up because the device registry
will have KeyError: created_at if the previous nightly was
installed.

* reduce

* split migration per discord comments
2024-07-23 15:47:27 -05:00
Erik Montnemery
d3df903d1e
Make device registry migration unconditional (#122414) 2024-07-22 21:37:47 +02:00
Robert Resch
4c853803f1
Add created_at/modified_at to device registry (#122369) 2024-07-22 19:15:23 +02:00
Joost Lekkerkerker
f8ba4d41ba
Add support for adding model_id in device info (#121989) 2024-07-16 15:12:25 +02:00
Erik Montnemery
3e9b57cc07
Don't allow updating a device to have no connections or identifiers (#120603)
* Don't allow updating a device to have no connections or identifiers

* Move check to the top of the function
2024-06-27 09:26:31 +02:00
Erik Montnemery
9bbeb5d608
Add primary_config_entry attribute to device registry entries (#119959)
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Robert Resch <robert@resch.dev>
2024-06-26 12:26:24 +02:00
Erik Montnemery
d4e93dd01d
Validate new device identifiers and connections (#120413) 2024-06-25 19:17:54 +02:00
Paulus Schoutsen
eb89ce47ea
Inline primary integration (#119860) 2024-06-18 08:08:08 +02:00
Paulus Schoutsen
836abe68c7
Track primary integration (#119741)
* Track primary integration

* Update snapshots

* More snapshots updated

* Uno mas

* Update snapshot
2024-06-16 13:26:06 -04:00
epenet
891f9c9578
Add error message to device registry helper (#118676) 2024-06-03 09:58:02 +02:00
Jan-Philipp Benecke
32b51b8792
Run ruff format for device registry (#118582) 2024-05-31 22:22:48 +02:00
epenet
41e852a01b
Add ability to replace connections in DeviceRegistry (#118555)
* Add ability to replace connections in DeviceRegistry

* Add more tests

* Improve coverage

* Apply suggestion

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

---------

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2024-05-31 15:31:44 -04:00
J. Nick Koston
6113b58e9c
Speed up registry indices (#117897)
* Use defaultdict for registry indices

defaultdict is faster and does not have to create an empty
dict that gets throw away when the key is already present

* Use defaultdict for registry indices

defaultdict is faster and does not have to create an empty
dict that gets throw away when the key is already present
2024-05-22 14:07:39 -04:00
Marc Mueller
8f0fb4db3e
Use PEP 695 for class annotations (4) (#117778) 2024-05-20 10:44:52 +02:00
Marc Mueller
87bb7ced79
Use PEP 695 for simple type aliases (#117633) 2024-05-17 14:42:21 +02:00
J. Nick Koston
7871e9279b
Adjust thread safety check messages to point to developer docs (#117392) 2024-05-14 15:20:31 +02:00
J. Nick Koston
eac4aaef10
Use a dictcomp to reconstruct DeviceInfo in the device_registry (#117286)
Use a dictcomp to reconstruct DeviceInfo

a dictcomp is faster than many sets on the dict by at least
25%

We call this for nearly every device in the registry at
startup
2024-05-12 08:07:12 +02:00
J. Nick Koston
26cc1cd3db
Use singleton helper for registries (#117027) 2024-05-07 21:04:01 +02:00
Marc Mueller
fd5885ec83
Use HassKey for registries (#117000) 2024-05-07 18:03:14 +02:00
J. Nick Koston
09ebbfa0e1
Move thread safety check in device_registry sooner (#116264)
It turns out we have custom components that are writing to the device registry using the async APIs from threads. We now catch it at the point async_fire is called. Instead we should check sooner and use async_fire_internal so we catch the unsafe operation before it can corrupt the registry.
2024-04-27 09:24:55 +02:00
Sid
e662e3b65c
Bump ruff to 0.4.2 (#116201)
* Bump ruff to 0.4.2

* review comments
2024-04-26 08:48:32 +02:00
Alberto Montes
c94b0a82ca
Make release channel a hardcoded enum rather than a free form string (#115595)
* Make release channel a hardcoded enum rather than a free form string

* Update enum comparison to remove equality and us identity comparison

* Fix comparison condition to match the previous implementation

* Update tests to use Enum instead of string
2024-04-20 20:01:49 +02:00
J. Nick Koston
bd2efffb4a
Reduce duplicate code in the device registry (#115677) 2024-04-17 15:50:39 +02:00
J. Nick Koston
8cf14c9268
Avoid linear search to clear labels and areas in the device registry (#115676) 2024-04-17 15:46:59 +02:00
J. Nick Koston
ca5ed274cb
Deprecate calling async_listen and async_listen_once with run_immediately (#115169) 2024-04-08 10:07:54 -10:00
Marc Mueller
4e94f11665
Use EventType for entity_registry_updated (#115187) 2024-04-08 08:44:59 -10:00
Marc Mueller
2fc0d8494d
Use EventType for device_registry_updated (#115188) 2024-04-08 08:25:57 -10:00
Marc Mueller
cb9352110c
Improve registry store data typing (#115066) 2024-04-06 14:34:49 -10:00
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