Commit Graph

241 Commits

Author SHA1 Message Date
Jan Bouwhuis
1536375e82 Fix update of the entity ID does not clean up an old restored state (#151696)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2025-09-08 12:48:23 +02:00
Erik Montnemery
da2f154111 Improve migration to entity registry version 1.18 (#151570) 2025-09-03 10:08:59 +02:00
Erik Montnemery
8e1ee32190 Revert "Improve migration to entity registry version 1.18" (#151561) 2025-09-02 11:54:37 +02:00
Erik Montnemery
d72b35a0cd Improve comment on disabled_by + hidden_by flag in registries (#151290)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2025-08-29 17:27:39 +02:00
Erik Montnemery
4130f3db2f Improve migration to entity registry version 1.18 (#151308)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2025-08-28 18:52:51 +02:00
Erik Montnemery
3a48c9569c Fix stale comment in entity registry (#151226) 2025-08-27 10:43:59 +02:00
Erik Montnemery
1d2599184b Adjust entity disabled_by flag when moving entity to another config entry (#151151)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-08-25 23:35:28 +02:00
Erik Montnemery
58339d79d3 Revert "Fix entities/devices stuck in disabled state after config entry re-add" (#151158) 2025-08-25 22:48:30 +02:00
Erik Montnemery
05c8e8b4fd Adjust entity disabled_by flag when restoring a deleted entity (#151150) 2025-08-25 22:47:55 +02:00
J. Nick Koston
bc6f261105 Fix entities/devices stuck in disabled state after config entry re-add (#151075) 2025-08-24 15:55:58 +02:00
Erik Montnemery
3d744f032f Make _EventDeviceRegistryUpdatedData_Remove JSON serializable (#149734) 2025-07-31 12:35:13 +02:00
Erik Montnemery
d22dd68119 Fix exception in EntityRegistry.async_device_modified (#148645) 2025-07-13 10:37:48 +02:00
Erik Montnemery
2dca78efbb Improve entity registry handling of device changes (#148425) 2025-07-11 20:56:50 +02:00
Marc Mueller
2c13c70e12 Update ruff to 0.12.0 (#147106) 2025-06-19 20:39:09 +02:00
Erik Montnemery
167e688139 Allow removing entity registry items twice (#146519) 2025-06-11 12:42:09 +02:00
Erik Montnemery
ce739fd9b6 Restore entity ID and user customizations of deleted entities (#145278)
* Restore entity ID and user customizations of deleted entities

* Clear removed areas, categories and labels from deleted entities

* Correct test

* Fix logic for disabled_by and hidden_by

* Improve test coverage

* Fix sorting

* Always restore disabled_by and hidden_by

* Update mqtt test

* Update pglab tests
2025-06-10 11:47:54 +02:00
Erik Montnemery
4e1d5fbeb0 Add WS command to help reset custom entity_id (#145504)
* Add WS command to help reset custom entity_id

* Calculate suggested object id from entity properties

* Fix logic and add additional tests

* Adjust test

* Update folder_watcher test

* Handle current entity id matches the automatic entity id

* Don't store calculated_object_id

* Update snapshots

* Update snapshots

* Update test

* Tweak logic for reusing current entity_id

* Improve test

* Don't assign same entity_id to several entities

* Prioritize custom entity name

* Update snapshots

* Update snapshots
2025-05-26 19:28:27 +02:00
Erik Montnemery
e868b3e8ff Sort and simplify DeletedRegistryEntry (#145207) 2025-05-19 14:13:57 +02:00
Erik Montnemery
cec8db173b Remove redundant entity_id collision check in entity registry (#143660)
* Remove redundant entity_id collision check in entity registry

* Update test
2025-04-28 07:50:26 +02:00
Erik Montnemery
dc8e1773f1 Remove unused defaults from entity_registry.RegistryEntry (#143655) 2025-04-25 12:41:58 +02:00
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 ecb3bf79f3.

* 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
Marc Mueller
a4fe0cbe7a Update mypy-dev to 1.16.0a2 (#137542) 2025-02-06 13:43:53 +01:00
Ville Skyttä
40eb8b91cc Adjust to recommended propcache.api import paths (#136150) 2025-01-21 10:58:22 +01:00
Erik Montnemery
235fda55fe Validate config entry when adding or updating entity registry entry (#135067) 2025-01-17 19:18:13 +01:00
epenet
5df7092f41 Improve formatting in core files (#135256)
* Adjust core files formatting

* Adjust translations script
2025-01-10 09:08:37 +01:00
Erik Montnemery
5888b83f22 Validate device id when adding or updating entity registry entry (#134982) 2025-01-07 16:10:51 +00: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
Paul Bottein
b471a6e519 Add has_entity_name to entity display dict and fix name (#125832)
* Add has_entity_name to entity display dict and fix name

* Fix tests
2024-09-19 11:35:44 +02:00
Robert Resch
e00f159ebe Fix loading created_at/modified_at from entity registry store (#122486) 2024-07-23 21:15:12 +02:00
Robert Resch
0d765a27c9 Add created_at/modified_at to entity registry (#122444) 2024-07-23 13:12:29 +02:00
Erik Montnemery
7abffd7cc8 Don't report entities with invalid unique id when loading the entity registry (#118290) 2024-05-29 08:32:39 +02: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
900b6211ef Use PEP 695 for function annotations (2) (#117659) 2024-05-18 11:44:39 +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
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
G Johansson
822646749d Remove entity category "system" check from entity registry (#116412) 2024-04-30 04:01:12 +02:00
J. Nick Koston
244433aeca Move thread safety check in entity_registry sooner (#116263)
* Move thread safety check in entity_registry sooner

It turns out we have a lot of custom components that are writing
to the entity registry using the async APIs from threads. We now
catch it at the point async_fire is called. Instread we should check
sooner and use async_fire_internal so we catch the unsafe operation
before it can corrupt the registry.

* coverage

* Apply suggestions from code review
2024-04-27 09:25:19 +02:00
Erik Montnemery
623d34e1e0 Remove early return when validating entity registry items (#116160) 2024-04-26 08:38:24 +02:00
J. Nick Koston
45f025480e Avoid linear search to remove a label from the entity registry (#115674)
* Avoid linear search to remove a label from the entity registry

* simplify
2024-04-17 15:47:56 +02:00
J. Nick Koston
bbecb98927 Fix type on known_object_ids in _entity_id_available and async_generate_entity_id (#115378) 2024-04-10 11:44:25 -10: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
Erik Montnemery
7c95ecff20 Validate unique_id in entity registry (#114648)
Co-authored-by: Shay Levy <levyshay1@gmail.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-04-04 09:51:44 -10:00
Marc Mueller
816ce116bf Remove unnecessary functools.cached_property backport (#114239) 2024-04-04 11:24:26 +02:00
J. Nick Koston
e86fec310b Improve performance of extracting entities by label (#114720) 2024-04-03 10:24:44 -10:00