Commit graph

87 commits

Author SHA1 Message Date
J. Nick Koston
09ebbfa0e1
Move thread safety check in device_registry sooner ()
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 ()
* 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 ()
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 ()
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] () 2024-03-08 10:36:11 -05:00
Erik Montnemery
b336095239
Allow translating device names ()
* 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 ()
* 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 () 2024-02-19 11:59:08 +01:00
Franck Nijhof
0fbadc274a
Cleanups in device registry tests () 2024-02-17 14:06:53 +01:00
J. Nick Koston
c399cab427
Small speed up to checking core state () 2024-01-18 08:41:32 -10:00
Erik Montnemery
c805ea7b4f
Include deprecated constants in wildcard imports () 2024-01-05 11:46:45 +01:00
Robert Resch
e18d2b8873
Deprecate deprecated device_registry helper constants () 2023-12-22 11:21:45 +01:00
Franck Nijhof
70ad5ab3e4
Update helper tests to use device & entity registry fixtures () 2023-11-10 09:32:19 +01:00
Erik Montnemery
1621310ba7
Add serial_number to device registry entries ()
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 () 2023-08-10 19:28:33 +02:00
Franck Nijhof
af5fc7e759
Ensure load the device registry if it contains invalid configuration URLs () 2023-08-01 23:15:31 +02:00
Franck Nijhof
737ac8c600
Fix DeviceInfo configuration_url validation () 2023-07-27 18:57:01 +02:00
Erik Montnemery
614f3c6a15
Move device info validation to device registry ()
* 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 ()
* 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
epenet
5f25b71df7
Add type hints to core tests () 2023-02-20 11:42:56 +01:00
Franck Nijhof
80bf632e2d
Clean up unnecessary registry mocks from helpers () 2023-02-08 20:15:29 -05:00
epenet
c98b4e3204
Add typing to tests with single hass argument (2) ()
* Add typing to tests with single hass argument (2)

* a few more
2023-02-08 08:51:43 +01:00
Franck Nijhof
5e81d28116
Update black to 23.1.0 () 2023-02-02 18:35:24 +01:00
Erik Montnemery
11c174aca3
Revert "Add aliases to device registry items" () 2023-01-02 12:30:25 +01:00
Erik Montnemery
057bb6ea0a
Add aliases to device registry items () 2022-12-20 23:43:31 +01:00
Erik Montnemery
53263ea9bc
Revert "Add serial_number to device registry entries" () 2022-09-27 16:36:38 +02:00
Erik Montnemery
cba3b6ad94
Add serial_number to device registry entries () 2022-09-27 09:08:54 +02:00
Erik Montnemery
51c5f1d16a
Remove useless device_registry test () 2022-09-02 20:44:42 +00:00
Erik Montnemery
8924725d69
Improve some device registry tests () 2022-09-02 08:54:02 +02:00
J. Nick Koston
c2c6d12d73
Only fire device_registry_updated for suggested_area if the suggestion results in an area change () 2022-04-04 09:51:39 +02:00
Erik Montnemery
dcb3fc49c9
Include changes in EVENT_DEVICE_REGISTRY_UPDATED () 2022-02-16 12:29:08 +01:00
Stefan Agner
42706f780c
Convert disabled_by to DeviceEntryDisabler on load ()
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-01-11 20:50:32 -08:00
J. Nick Koston
04153c0075
Add hardware version to the device registry () 2021-12-16 05:16:19 -06:00
Ville Skyttä
7db3246de4
Make config entry disabled_by an enum ()
* Make config entry disabled_by an enum

* Update homeassistant/config_entries.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-12-15 20:53:21 +01:00
Paulus Schoutsen
a59ec9ca5e
Handle invalid device registry entry type ()
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-12-04 09:20:12 +01:00
Ville Skyttä
9f4de8df18
Make device entry disabled by an enum () 2021-11-24 22:32:16 +01:00
Erik Montnemery
24779dea3b
Bump device registry version to 1.2 () 2021-11-23 22:22:15 +01:00
Ville Skyttä
39691faccc
Use DeviceEntryType in non-typechecked code too () 2021-11-23 10:04:33 +01:00
Erik Montnemery
ca20fc857f
Remove via_device links when a device is removed ()
* Remove via_device links when a device is removed

* Update test
2021-11-23 09:36:03 +01:00
Ville Skyttä
053c456199
Change device entry type to an StrEnum ()
Co-authored-by: Ville Skyttä <ville.skytta@iki.fi>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-11-22 18:14:15 +01:00
Robert Svensson
c6213b36ad
Only disable a device if all associated config entries are disabled () 2021-07-29 12:08:53 -07:00
Ville Skyttä
77d5244577
Use device registry CONNECTION_* constants () 2021-04-30 23:58:50 +02:00
Ville Skyttä
a396619251
Use disabled_by constants ()
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-04-23 09:56:42 +02:00
Raman Gupta
769923e8dd
Raise exception for invalid call to DeviceRegistry.async_get_or_create ()
* Raise exception instead of returning None for DeviceRegistry.async_get_or_create

* fix entity_platform logic
2021-04-13 14:18:51 +02:00
Franck Nijhof
08870690a6
Fix a collection of tests with missing asserts ()
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-03-20 17:23:55 +01:00
Erik Montnemery
b3fecb1c95
Update tests t-z to use async_get() instead of async_get_registry() () 2021-03-09 14:25:03 +01:00
Erik Montnemery
5e26bda52d
Add support for disabling config entries () 2021-02-20 19:21:39 -08:00
J. Nick Koston
bb7e4d7daa
Implement suggested_area in the device registry ()
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-02-19 19:34:33 -10:00
Erik Montnemery
ed31cc363b
Wait for registries to load at startup ()
* Wait for registries to load at startup

* Don't decorate new functions with @bind_hass

* Fix typing errors in zwave_js

* Load registries in async_test_home_assistant

* Tweak

* Typo

* Tweak

* Explicitly silence mypy errors

* Fix tests

* Fix more tests

* Fix test

* Improve docstring

* Wait for registries to load
2021-02-11 17:36:19 +01:00
J. Nick Koston
a1662b3bb9
Restore the device id after deleting and re-adding an integration () 2021-01-27 17:10:57 +01:00