Commit graph

67 commits

Author SHA1 Message Date
Paulus Schoutsen
c8f95b7dfc
Ignore loading system entity category () 2022-05-05 14:33:37 -07:00
Dave T
70e125850c
Limit autogenerated entity_id string length () 2022-04-21 22:39:51 -07:00
Raman Gupta
3bcd921a28
Add entity registry helper to update entity platform ()
* Add entity registry helper to migrate entity to new platform

* Add additional assertion

* Add more properties to migration logic

* Change logic after thinking about erik's comments

* Require new_config_entry_id if entry.config_entry_id is not None

* Create private async_update_entity function that all update functions use

* Don't have special handling for entity ID missing in async_update_entity_platform

* fix docstring
2022-04-16 16:18:52 -04:00
Paulus Schoutsen
130ca2213f
Enforce EntityCategory enum ()
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-03-31 15:04:33 -07:00
Paulus Schoutsen
5eb19b8a70
Enforce RegistryEntryDisabler enum ()
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-03-31 13:10:07 -07:00
Erik Montnemery
cd25769667
Rename async_resolve_entity_ids to async_validate_entity_ids () 2022-03-04 09:51:53 +01:00
Paulus Schoutsen
1bbc1f5f55
Validate in split_entity_id () 2022-02-18 16:11:17 -08:00
Erik Montnemery
d40a830b89
Remove entities when config entry is removed from device ()
* Remove entities when config entry is removed from device

* Update tests/helpers/test_entity_registry.py

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

* Don't remove entities not connected to a config entry

* Update homeassistant/helpers/entity_registry.py

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

Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-02-13 17:23:30 +01:00
Joakim Sørensen
7a40ae13a4
Add guard for invalid EntityCategory value () 2022-02-11 14:57:45 +01:00
Dave T
bf910229b6
Add test: warn entity_category assigned as str () 2022-01-28 21:46:57 +01:00
Erik Montnemery
a8c14835b9
Add entity options to entity registry ()
* Initial commit for entity options

* Tweak broadlink tests

* Add async_update_entity_options + test
2022-01-18 22:47:46 +01:00
Ville Skyttä
5bf67cac66
Use RegistryEntryDisabler () 2021-12-15 23:25:40 +02: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
Ville Skyttä
4107063a5a
Make entity registry disabled_by an enum () 2021-12-02 18:02:29 +01:00
Erik Montnemery
c85bb27d0d
Teach state trigger about entity registry ids ()
* Teach state trigger about entity registry ids

* Tweak

* Add tests

* Tweak tests

* Fix tests

* Resolve entity ids during config validation

* Update device_triggers

* Fix mistake

* Tweak trigger validator to ensure we don't modify the original config

* Add index from entry id to entry

* Update scaffold

* Pre-compile UUID regex

* Address review comment

* Tweak mock_registry

* Tweak

* Apply suggestion from code review
2021-12-02 14:26:45 +01:00
Ville Skyttä
9f4de8df18
Make device entry disabled by an enum () 2021-11-24 22:32:16 +01:00
Erik Montnemery
c0d2a66609
Add stable ID to entity registry entries ()
* Add UUID to entity registry entries

* Fix test
2021-11-24 09:01:35 +01:00
Erik Montnemery
49a27e12ad
Add support to entity registry for overriding device_class () 2021-11-22 08:38:06 -08:00
Erik Montnemery
0df2904b89
Improve some entity registry tests () 2021-11-22 10:24:37 +01:00
Erik Montnemery
c557da028a
Bump entity_registry store version to 1.2 ()
* Bump entity_registry store version to 1.2

* Migrate also when importing yaml

* Adjust tests

* Satisfy pylint

* Fix typing
2021-11-19 14:25:34 +01:00
Paulus Schoutsen
ee2c950716
Merge system options into pref properties ()
* Make system options future proof

* Update tests

* Add types
2021-06-01 22:34:31 +02:00
Raman Gupta
58e37435b3
Make more max lengths constants and add additional MaxLengthExceeded checks ()
* Add more MaxLengthExceeded checks

* remove some validations to reduce performance impact

* check length of generated entity ID

* dont check entity ID twice and use single context id length constant

* fix test

* add missing test
2021-05-25 19:58:01 +02: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
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
504e5b77ca
Improve behaviour when disabling or enabling config entries () 2021-03-03 10:12:37 -08:00
Erik Montnemery
5e26bda52d
Add support for disabling config entries () 2021-02-20 19:21:39 -08: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
Erik Montnemery
bfd5a62bad
Fix typo () 2021-02-10 11:31:51 +01:00
Erik Montnemery
78b7fbf7b1
Fix race in EntityRegistry.async_device_modified () 2021-02-10 10:50:44 +01:00
Franck Nijhof
65cf2fcb6f
Drop asynctest () 2021-01-01 22:31:56 +01:00
Erik Montnemery
30baf333c3
Improve handling of disabled devices () 2020-12-02 21:20:14 +01:00
Erik Montnemery
a5e5c5c7e6
Exclude disabled entities from async_entries_for_device () 2020-11-27 09:03:44 +01:00
Erik Montnemery
dc8364fd3a
Support disabling devices () 2020-11-26 16:45:02 +01:00
Robert Svensson
e06c8009e1
Add area id to entity registry ()
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-10-24 21:25:28 +02:00
Franck Nijhof
1c2ebdf307
Upgrade black to 20.8b1 () 2020-08-27 13:56:20 +02:00
J. Nick Koston
890562e3ae
Index the entity registry () 2020-07-19 22:52:41 -07:00
Paulus Schoutsen
a330eba61c
Guard bad entity ID in entity registry () 2020-05-05 15:07:54 -07:00
Paulus Schoutsen
2af984917e
Use asynctest-mock in most places ()
* Use asynctest-mock in most places

* Fix broken patch in pilight
2020-05-03 11:27:19 -07:00
Paulus Schoutsen
ec47216388
Use built-in test helpers on 3.8 () 2020-04-30 13:29:50 -07:00
J. Nick Koston
96649a7e27
Use registry to find linked batteries for homekit () 2020-04-21 17:43:49 -07:00
Paulus Schoutsen
7be3a4cd37
Fix entity registry not saving name/icon () 2020-02-18 08:32:34 -08:00
Paulus Schoutsen
51c35ab9a8
Entity Registry to store and restore name/icon ()
* Entity Registry to store and restore name/icon

* Update test_entity_registry.py

* Add original name/icon to JSON result
2020-02-11 09:40:50 -08:00
Jc2k
669c89e8c0 Fix HomeKit with entity registry restoration where supported_features is a non-None falsey ()
* Fix homekit with 

* Fix test
2020-01-10 16:33:48 -08:00
Paulus Schoutsen
bb14a083f0
Store capabilities and supported features in entity registry, restore registered entities on startup ()
* Store capabilities and supported features in entity registry

* Restore states at startup

* Restore non-disabled entities on HA start

* Fix test

* Pass device class from entity platform

* Clean up restored entities from state machine

* Fix Z-Wave test?
2019-12-31 14:29:43 +01:00
Bas Nijholt
f60125b5c9 Sort imports according to PEP8 for 'tests' () 2019-12-09 16:52:24 +01:00
Paulus Schoutsen
f704a8e90e Reload config entry when entity enabled in entity registry, remove entity if disabled. ()
* Reload config entry when disabled_by updated in entity registry

* Add types

* Remove entities that get disabled

* Remove unnecessary domain checks.

* Attach handler in async_setup

* Remove unused var

* Type

* Fix test

* Fix tests
2019-08-22 19:32:43 -05:00
Robert Svensson
a2589f56e1 Add system options to config entries ()
* Add system options to config entries

* For feedback

* Follow most of balloobs comments

* Fix balloobs comments

* Improvements

* Fix second round of Balloobs comments

* Fix third round

* Add system options to mock config entry

* Fix integration tests

* Fix the last failing tests

* Fix disabled string

* Fix failing disabled_by tests

* New tests

* Config entry WS API tests

* Fix comments
2019-08-17 21:34:11 -07:00
Paulus Schoutsen
eba6caf8a1
Entity registry api update disable ()
* Clean up entity registry WS commands

* Allow updating disabled_by in entity registry

* Allow changing disabled_by via API

* Update tests/components/config/test_entity_registry.py

Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
2019-08-16 16:22:45 -07:00
Paulus Schoutsen
6c292846be
Allow entities to indicate they should be disabled by default () 2019-08-16 16:17:16 -07:00