Commit Graph

66 Commits (1c98df5d18e6051cd097dfc1765c8a442cc53cae)

Author SHA1 Message Date
Ville Skyttä ddd7e79ee9
Improve device registry internal typing (#49924) 2021-05-01 12:33:31 -10:00
Ville Skyttä a19f757120
Allow str 1..n-tuples in device registry identifier type hints (#49864)
This reflects current practice, but the intent has been to have them as
2-tuples, and a future change is likely to start enforcing that (again).

Refs https://github.com/home-assistant/core/pull/49670#discussion_r622344872
2021-04-30 08:56:55 +02:00
Raman Gupta 769923e8dd
Raise exception for invalid call to DeviceRegistry.async_get_or_create (#49038)
* 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 38d14702fa
Remove HomeAssistantType alias from helpers (#48400) 2021-03-27 12:55:24 +01:00
Franck Nijhof dc15f243e6
Upgrade pyupgrade to v2.11.0 (#48220) 2021-03-22 13:29:39 +01:00
Marc Mueller 4cb7718192
Update typing 16 (#48087) 2021-03-18 22:58:19 +01:00
Marc Mueller 6fb2e63e49
Update typing 02 (#48014) 2021-03-17 18:34:19 +01:00
Erik Montnemery 504e5b77ca
Improve behaviour when disabling or enabling config entries (#47301) 2021-03-03 10:12:37 -08:00
Erik Montnemery 5e26bda52d
Add support for disabling config entries (#46779) 2021-02-20 19:21:39 -08:00
J. Nick Koston bb7e4d7daa
Implement suggested_area in the device registry (#45940)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-02-19 19:34:33 -10:00
J. Nick Koston c9df42b69a
Add support for pre-filtering events to the event bus (#46371) 2021-02-14 09:42:55 -10:00
Erik Montnemery ed31cc363b
Wait for registries to load at startup (#46265)
* 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 (#45348) 2021-01-27 17:10:57 +01:00
Ville Skyttä 20e2493f68
Improve device registry type hints (#44919)
* Fix async_get_or_create via_device type hint

* Specify collection element types
2021-01-08 02:38:57 +01:00
Ville Skyttä 2fb3be50ab
Make DeviceRegistry.async_get_device connections arg optional (#44897)
* Make async_get_device connections Optional, default None

* Remove unnecessary async_get_device connections arg usages

Some of these were using an incorrect collection type, which didn't
cause issues mostly just due to luck.
2021-01-07 13:49:45 +01:00
Ville Skyttä 65e56d03bf
Complete device and entity registry type hints (#44406) 2021-01-05 02:03:16 +01:00
Ville Skyttä 317ed418dd
Use singleton enum for "not set" sentinels (#41990)
* Use singleton enum for "not set" sentinel

https://www.python.org/dev/peps/pep-0484/#support-for-singleton-types-in-unions

* Remove unused variable
2020-12-19 12:46:27 +01:00
Erik Montnemery dc8364fd3a
Support disabling devices (#43293) 2020-11-26 16:45:02 +01:00
Erik Montnemery 8a7febcfbe
Improve restore of deleted devices (#42703)
* Improve restore of deleted devices

* Simplify
2020-11-10 22:14:39 +01:00
J. Nick Koston 8d5c124deb
Improve performance of generating non-cryptographically secure uuids (#41314) 2020-10-07 16:37:01 +02:00
Erik Montnemery 863b63d75e
Fix handling of device registry defaults (#39688) 2020-09-06 21:08:50 -05:00
J. Nick Koston bee6d87e7a
Standardize uuid generation for events/storage/registry (#39184) 2020-08-24 17:21:30 +02:00
Paulus Schoutsen b3571602bb
Add default_* to device registry (#38829) 2020-08-13 10:38:56 +02:00
J. Nick Koston 6ea5c8aed9
Index the device registry (#37990) 2020-07-19 23:32:05 -07:00
Ville Skyttä ac0dbb17af
Attrs cleanups (#37849) 2020-07-14 10:30:30 -07:00
Erik Montnemery 7722e417ad
Stable device id when a deleted device is restored (#36309)
* Stable device id when a deleted device is restored.

* Tweak

* Store only basic data for deleted devices

* Simplify code

* Simplify code

* Address review comments.

* Improve test

* Fix missing save
2020-06-02 21:22:08 +02:00
Andre Lengwenus 919f3243de
Fix device_registry cleanup behavior (#35977)
* Fix: Only decives which are not referenced by an entity or a config_entry are removed

* Adapted test for async_cleanup

* Changed variable names
2020-05-23 09:46:03 +02:00
Paulus Schoutsen 4ae31bc938
Clean up device registry if entity registry updates (#35106) 2020-05-05 10:53:46 -07:00
Paulus Schoutsen e54e9279e3
Extract instance ID helper from updater (#35043) 2020-05-04 11:23:12 -07:00
Paulus Schoutsen b90cb09fd1
Add type to device registry (#35095) 2020-05-03 13:56:58 -07:00
Paulus Schoutsen 6056753a9c
Introduce a singleton decorator (#34803) 2020-04-30 16:47:14 -07:00
Martin Hjelmare fbde040f59
Complete device registry update (#34500)
* Add manufacturer and model parameters to device registry update
  method.
2020-04-21 19:40:16 +02:00
Alexei Chetroi 440c837eb6
Allow sw_version update of a device registry entry. (#32630) 2020-03-11 09:31:02 -07:00
Paulus Schoutsen e9e44dbd97
Fix callback and async (#31281)
* Fix callback and async

* Fix a return

* Fix test

* Fix mqtt tests

* Fix some more callbacks
2020-01-29 13:59:45 -08:00
Paulus Schoutsen 3348f4f6d1
Add search integration (#30511)
* Add search integration

* Add scenes and config entry support

* Update comments

* Add support for groups

* Allow querying config entry

* Update manifest

* Fix scene tests
2020-01-10 19:57:37 +01:00
Ville Skyttä 868eb3c735 More helpers type improvements (#30145) 2019-12-22 19:51:39 +01:00
Ville Skyttä 6604680793
Helpers type hint improvements (#30106) 2019-12-21 09:23:48 +02:00
Bas Nijholt 67c56c860d Sort imports according to PEP8 for 'homeassistant' folder (#29789)
Components are already done
2019-12-09 16:42:10 +01:00
Bram Kragten b75639d9d1 Remove lamps and groups from ha when removed from Hue (#26881)
* Remove light when removed from hue

* add remove_config_entry_id

* Review + bump aiohue

* lint

* Add tests
2019-09-25 14:00:18 -07:00
Ville Skyttä aa508b5106 Complete some incomplete type hints in helpers (#25953) 2019-08-15 08:53:25 -07:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Ville Skyttä d64f1e767c Type check all helpers (#25373)
* Type check all helpers, add inline exclusions for work in progress

* Remove unused Script._template_cache

* Add some missing type hints

* Remove unneeded type: ignore

* Type hint fixes

* Mypy assistance tweaks

* Don't look for None in deprecated config "at most once" check

* Avoid None name slugify attempt when generating entity id

* Avoid None state store attempt on entity remove
2019-07-21 09:59:02 -07:00
Aaron Bach a491f97eb9 Allow updating of via_device in device registry (#24921)
* Allow updating of via_device in device registry

* Added test
2019-07-04 19:10:23 -04:00
Penny Wood 23dd644f4a Update IDs for rename node/value (#24646)
* Update IDs for rename node/value

* Rename devices and entities

* Improved coverage
2019-07-01 15:54:19 -07:00
David F. Mulcahey d9420c1f73 Remove device and entity registry entries when removing a ZHA device (#24369)
* cleanup when device is removed

fixes

* cleanup
2019-06-24 11:26:44 -07:00
Penny Wood 84e6813779 Rename via_hub to via_device (#24360)
* Rename via_hub to via_device

* Fixed registry interactions
2019-06-10 09:10:44 -07:00
Penny Wood f991ec15f2 Delete devices / entities when we remove a config entry. (#23983)
* Remove device when last config entry removed

* Remove entities when config entry removed

* Update tests to use new behaviour
2019-05-19 11:41:39 +02:00
Paulus Schoutsen 07ee3b2eb9
Add update events to registries (#23746)
* Add update events to registries

* Add to websocket
2019-05-07 20:04:57 -07:00
Andrew Sayre cfaaae661a Add core APIs to migrate device identifiers and entity unique_id (#23481)
* Add device identifiers migration

* Add entity unique_id migration

* Update per arch issue

* Move to existing update methods
2019-04-30 10:04:37 -07:00
Penny Wood 646c4a7137
Bootstrap to start registry loading early (#22321)
* Registries store directly in data on loading.

* Loading registries concurent with stage 1.

* Removed comments
2019-03-27 22:06:20 +08:00