Commit Graph

82 Commits (0f80d0625afae93228e9e25e686a9d89c52be2e4)

Author SHA1 Message Date
Erik Montnemery e22618a555
Write protect entity options (#90185) 2023-03-28 22:56:51 +02:00
epenet 5f25b71df7
Add type hints to core tests (#88478) 2023-02-20 11:42:56 +01:00
Erik Montnemery cc564026fa
Move EntityCategory to homeassistant.const (#87792)
* Move EntityCategory to homeassistant.const

* Fix more imports
2023-02-09 20:15:37 +01:00
Franck Nijhof 80bf632e2d
Clean up unnecessary registry mocks from helpers (#87734) 2023-02-08 20:15:29 -05:00
epenet c98b4e3204
Add typing to tests with single hass argument (2) (#87675)
* Add typing to tests with single hass argument (2)

* a few more
2023-02-08 08:51:43 +01:00
epenet 4142f0d15d
Add return type to tests without arguments (#87613)
* Add return type to tests without arguments

* Black

* Cancel fixture amends
2023-02-07 14:20:06 +01:00
Erik Montnemery 1f3da9cf1a
Add aliases to entity registry items (#84239) 2022-12-20 12:10:46 +01:00
Erik Montnemery 8e617bbc1d
Add `translation_key` property to entites (#82701)
* Add translation_key attribute to entity state

* Update accuweather test

* Index entity translation keys by platform

* Store translation key in entity registry
2022-12-01 09:34:09 +01:00
Erik Montnemery c38b1e7727
Improve check of new_entity_id in entity_registry.async_update_entity (#78276)
* Improve check of new_entity_id in entity_registry.async_update_entity

* Fix race in rfxtrx config flow

* Make sure Event is created on time

* Rename poorly named variable

* Fix typing

* Correct typing of _handle_state_change
2022-09-28 08:43:58 +02:00
Erik Montnemery 4e32bf2ac9
Drop old migration code from entity registry (#78278) 2022-09-12 22:28:05 -04:00
Erik Montnemery 1bc8770b51
Remove area_id from entity_registry.async_get_or_create (#77700)
* Remove area_id from entity_registry.async_get_or_create

* Adjust tests

* Fix lying comment in test
2022-09-02 13:31:05 +02:00
Erik Montnemery cd2045b66d
Clean up user overridden device class in entity registry (#77662) 2022-09-01 11:45:19 -04:00
Erik Montnemery 4655ed995e
Fix resetting of attributes in EntityRegistry.async_get_or_create (#77516)
* Fix resetting of attributes in EntityRegistry.async_get_or_create

* Fix typing

* Fix resetting config entry

* Improve test

* Update tests
2022-08-30 21:07:50 +02:00
Erik Montnemery 26a85c6644
Add Entity.has_entity_name attribute (#73217) 2022-06-28 09:38:05 -07:00
Erik Montnemery 4435c641de
Enforce RegistryEntryHider in entity registry (#73219) 2022-06-08 12:36:43 -07:00
Paulus Schoutsen c8f95b7dfc
Ignore loading system entity category (#71361) 2022-05-05 14:33:37 -07:00
Dave T 70e125850c
Limit autogenerated entity_id string length (#69739) 2022-04-21 22:39:51 -07:00
Raman Gupta 3bcd921a28
Add entity registry helper to update entity platform (#69162)
* 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 (#69015)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-03-31 15:04:33 -07:00
Paulus Schoutsen 5eb19b8a70
Enforce RegistryEntryDisabler enum (#69017)
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 (#67603) 2022-03-04 09:51:53 +01:00
Paulus Schoutsen 1bbc1f5f55
Validate in split_entity_id (#66835) 2022-02-18 16:11:17 -08:00
Erik Montnemery d40a830b89
Remove entities when config entry is removed from device (#66385)
* 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 (#66316) 2022-02-11 14:57:45 +01:00
Dave T bf910229b6
Add test: warn entity_category assigned as str (#65142) 2022-01-28 21:46:57 +01:00
Erik Montnemery a8c14835b9
Add entity options to entity registry (#64350)
* 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 (#60436) 2021-12-15 23:25:40 +02:00
Ville Skyttä 7db3246de4
Make config entry disabled_by an enum (#60445)
* 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 (#60424) 2021-12-02 18:02:29 +01:00
Erik Montnemery c85bb27d0d
Teach state trigger about entity registry ids (#60271)
* 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 (#60239) 2021-11-24 22:32:16 +01:00
Erik Montnemery c0d2a66609
Add stable ID to entity registry entries (#60218)
* 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 (#59985) 2021-11-22 08:38:06 -08:00
Erik Montnemery 0df2904b89
Improve some entity registry tests (#59902) 2021-11-22 10:24:37 +01:00
Erik Montnemery c557da028a
Bump entity_registry store version to 1.2 (#59912)
* 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 (#51347)
* 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 (#50337)
* 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 (#49923) 2021-04-30 23:58:50 +02:00
Ville Skyttä a396619251
Use disabled_by constants (#49584)
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() (#47655) 2021-03-09 14:25:03 +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
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
Erik Montnemery bfd5a62bad
Fix typo (#46321) 2021-02-10 11:31:51 +01:00
Erik Montnemery 78b7fbf7b1
Fix race in EntityRegistry.async_device_modified (#46319) 2021-02-10 10:50:44 +01:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Erik Montnemery 30baf333c3
Improve handling of disabled devices (#43864) 2020-12-02 21:20:14 +01:00
Erik Montnemery a5e5c5c7e6
Exclude disabled entities from async_entries_for_device (#43665) 2020-11-27 09:03:44 +01:00
Erik Montnemery dc8364fd3a
Support disabling devices (#43293) 2020-11-26 16:45:02 +01:00
Robert Svensson e06c8009e1
Add area id to entity registry (#42221)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-10-24 21:25:28 +02:00