Commit Graph

121 Commits

Author SHA1 Message Date
Erik Montnemery
480527eb68 Call DeviceRegistry._async_update_device from device registry (#151295) 2025-09-10 13:14:03 +02:00
Erik Montnemery
9ee9e1775d Bump device registry version to 1.12 (#151616) 2025-09-03 13:12:49 +02:00
Erik Montnemery
078425918e Improve migration to device registry version 1.10 (#151571) 2025-09-03 10:22:29 +02:00
Erik Montnemery
10baae92a0 Revert "Improve migration to device registry version 1.11" (#151563) 2025-09-02 11:58:27 +02:00
Erik Montnemery
8f04f22c65 Improve migration to device registry version 1.11 (#151315)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2025-08-29 16:48:29 +02:00
Erik Montnemery
b01f93119f Fix restoring disabled_by flag of deleted devices (#151313) 2025-08-28 20:10:10 +02:00
Erik Montnemery
5bb96f7f06 Adjust device disabled_by flag when changing config entry (#151155) 2025-08-26 12:37:56 +02:00
Erik Montnemery
50108e23ed Adjust device disabled_by flag when restoring a deleted device (#151154) 2025-08-25 22:49:47 +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
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
f538807d6e Make device suggested_area only influence new devices (#149758)
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
2025-08-01 14:54:58 +02:00
Erik Montnemery
0d7608f7c5 Deprecate DeviceEntry.suggested_area (#149730) 2025-08-01 10:34:34 +02:00
Erik Montnemery
3d744f032f Make _EventDeviceRegistryUpdatedData_Remove JSON serializable (#149734) 2025-07-31 12:35:13 +02:00
Erik Montnemery
2dca78efbb Improve entity registry handling of device changes (#148425) 2025-07-11 20:56:50 +02:00
Artur Pragacz
40f553a007 Migrate device connections to a normalized form (#140383)
* Normalize device connections migration

* Update version

* Slightly improve tests

* Update homeassistant/helpers/device_registry.py

* Add validators

* Fix validator

* Move format mac function too

* Add validator test

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2025-06-26 15:33:34 +02:00
Erik Montnemery
11d9014be0 Restore user customizations of deleted devices (#145191)
* Restore user customizations of deleted devices

* Apply suggestions from code review

* Improve test coverage

* Always restore disabled_by
2025-06-10 11:47:39 +02:00
Erik Montnemery
f27b2c4df1 Improve device registry restore tests (#145186) 2025-05-19 11:06:16 +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
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
Erik Montnemery
5888b83f22 Validate device id when adding or updating entity registry entry (#134982) 2025-01-07 16:10:51 +00: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
Erik Montnemery
5b7bd6a52f Minor improvement of device registry tests (#128095) 2024-10-10 17:28:57 +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
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
eb6af2238c Improve type hints in registry helper tests (#119302) 2024-06-10 20:25:34 +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
7871e9279b Adjust thread safety check messages to point to developer docs (#117392) 2024-05-14 15:20:31 +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
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
Joost Lekkerkerker
6bb4e7d62c Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
Sid
00ec7f11f0 Enable Ruff rule PT007 (#113764)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2024-03-19 09:01:07 +01:00
Marc Mueller
19ab3d6daf Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -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
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
Franck Nijhof
0fbadc274a Cleanups in device registry tests (#110786) 2024-02-17 14:06:53 +01:00
J. Nick Koston
c399cab427 Small speed up to checking core state (#107845) 2024-01-18 08:41:32 -10: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
Franck Nijhof
70ad5ab3e4 Update helper tests to use device & entity registry fixtures (#103710) 2023-11-10 09:32:19 +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
Erik Montnemery
4e8b81370e Adjust device_registry tests which create devices (#98215) 2023-08-10 19:28:33 +02:00
Franck Nijhof
af5fc7e759 Ensure load the device registry if it contains invalid configuration URLs (#97589) 2023-08-01 23:15:31 +02:00