Commit Graph

164 Commits (2e56d7d04847e811fc864ef0813b46271b085dac)

Author SHA1 Message Date
J. Nick Koston 19258cb3df
Fix benign typo in entity registry (#108270) 2024-01-18 07:45:44 +01:00
J. Nick Koston 60ab360fe7
Avoid bytes to string to bytes conversion in websocket api (#108139) 2024-01-16 21:37:34 +01:00
J. Nick Koston d7910841ef
Add an index for devices and config entries to the entity registry (#107516)
* Add an index for devices and config entries to the entity registry

* fixes

* tweak

* use a list for now since the tests check order
2024-01-13 14:49:41 -05:00
Marc Mueller 66d1a7f1dd
Update ReadOnlyEntityOptions typing (#103813) 2023-11-11 22:30:55 +01:00
J. Nick Koston 433c022687
Save previous unique id in entity registry when it changes (#102093) 2023-10-16 21:26:19 -10:00
J. Nick Koston 7b2aa3a369
Improve performance of config/entity_registry/get* calls (#101984) 2023-10-14 08:40:16 -10:00
Erik Montnemery 47ecce4873
Allow deleting entity entries from entity_registry.async_migrate_entries (#101094)
* Allow deleting entity entries from entity_registry.async_migrate_entries

* Explicitly return None in tests
2023-09-30 10:23:10 +02:00
J. Nick Koston 877eedf6d7
Use cached_property in entity_registry (#100302) 2023-09-13 14:38:40 -05:00
Erik Montnemery c3d1cdd0e9
Improve UserDict in device and entity registries (#100307) 2023-09-13 11:09:34 -05:00
Erik Montnemery 684b2d4537
Improve type hint in entity_registry (#100278) 2023-09-13 12:42:06 +02:00
Marc Mueller 4d9b73033d
Update python-typing-update to 0.6.0 (#97531) 2023-07-31 17:59:40 +02:00
Marc Mueller 0624345322
Improve `async_track_entity_registry_updated_event` callback typing (#97124) 2023-07-24 09:14:10 +02:00
Marc Mueller 69d7b035e0
Use EventType for more helper methods (#97107) 2023-07-23 23:22:04 +02:00
Franck Nijhof 30058297cf
Migrate backported StrEnum to built-in StrEnum (#97101) 2023-07-23 23:19:24 +02:00
Erik Montnemery 8fda56d2c9
Stable entity registry id when a deleted entity is restored (#77710)
* Stable entity_id and registry id when a deleted entity is restored

* Don't restore area_id

* Don't restore entity_id

* Address review comments
2023-06-26 15:54:35 +02:00
Erik Montnemery 4a8adae146
Teach alarm_control_panel device trigger about entity registry ids (#60977)
* Teach alarm_control_panel device trigger about entity registry ids

* Lint code

* Address review comment
2023-06-20 08:27:31 -04:00
J. Nick Koston a0c023d5cb
Reduce overhead to lookup items in the entity and device registry (#94568) 2023-06-14 20:47:18 +02:00
J. Nick Koston 9f0d3bfce8
Use ReadOnlyDict for entity registry options (#93824)
* Use ReadOnlyDict for entity registry options

While reviewing #93601 it was noticed this was slow at startup
https://github.com/home-assistant/core/pull/93601#issuecomment-1568958280

This is a first pass attempt to improve the performance

* fix tests
2023-05-30 20:11:39 -04:00
Erik Montnemery 0126cfa9d9
Allow exposing any entity to the default conversation agent (#92398)
* Allow exposing any entity to the default conversation agent

* Tweak

* Fix race, update tests

* Update tests
2023-05-03 09:45:54 -04:00
J. Nick Koston fba7c6cacd
Remove deprecated async_get_registry (#91928)
Deprecated in 2021 via #46265, report was added a year ago in #72088
2023-04-23 23:02:21 -04:00
Erik Montnemery 2c9e9d0fde
Allow UI configuration of entities exposed to voice_assistant (#91233)
* Allow UI configuration of entities exposed to voice_assistant

* Invalidate cache when settings change

* Add tests

* Expose entities to conversation by default

* Update tests
2023-04-11 22:39:40 -04:00
Erik Montnemery e22618a555
Write protect entity options (#90185) 2023-03-28 22:56:51 +02:00
Erik Montnemery 1f34fa63ab
Always include platform in `config/entity_registry/list_for_display` (#88601)
Always include platform in config/entity_registry/list_for_display
2023-02-22 17:59:52 +01:00
Erik Montnemery 0c4c95394e
Add WS command config/entity_registry/list_for_display (#87787)
* Add WS command config/entity_registry/list_for_display

* Make more keys in the display dict optional

* Move disabled_by check to ws command handler

* Hide hidden_by if not hidden

* Use send_json_auto_id in the new test

* Don't include entities which have no data needed for display

* Include platform for entries with translation_key
2023-02-21 20:40:39 +01:00
epenet ba23816a0c
Inverse json import logic (#88099)
* Fix helpers and util

* Adjust components

* Move back errors

* Add report

* mypy

* mypy

* Assert deprecation messages

* Move test_json_loads_object

* Adjust tests

* Fix rebase

* Adjust pylint plugin

* Fix plugin

* Adjust references

* Adjust backup tests
2023-02-16 11:37:57 +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
Erik Montnemery 93dafefd96
Include entity options in RegistryEntry.as_partial_dict (#87539) 2023-02-08 08:32:46 -05:00
Erik Montnemery 4d4fb2477d
Optionally update sensor units when unit system is changed (#83851) 2023-02-03 16:30:50 +01:00
Erik Montnemery 788edc21fb
Deduplicate some entity registry code (#85541) 2023-01-16 22:06:52 +01:00
Erik Montnemery b933a53aa3
Refactor entity registry JSON cache (#85085)
* Refactor entity registry JSON cache

* Fix generator

* Tweak

* Improve string building

* Improve test coverage

* Override EntityRegistryItems.values to avoid __iter__ overhead
2023-01-09 16:52:52 +01:00
Franck Nijhof 06a35fb7db
Code styling tweaks to core helpers (#85441) 2023-01-08 13:44:09 -10:00
Franck Nijhof d4f69a3652
String formatting and max line length - Part 7 (#84532)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-12-27 11:18:56 +01:00
Erik Montnemery 1f3da9cf1a
Add aliases to entity registry items (#84239) 2022-12-20 12:10:46 +01:00
Erik Montnemery f88ed6b69e
Use dict.setdefault in registry migration code (#84277) 2022-12-20 11:31:31 +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 6979cd95b0
Add suggested_unit_of_measurement attribute to sensors (#80638)
* Add suggested_unit_of_measurement attribute to sensors

* Lazy calculation of initial entity options

* Add type alias for entity options

* Small tweak

* Add tests

* Store suggested_unit_of_measurement in its own option key

* Adapt to renaming of IMPERIAL_SYSTEM

* Fix rebase mistakes

* Apply suggestions from code review

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2022-10-24 16:08:02 +02: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 3a86209dec
Remove unnecessary use of dunder methods from entity registry (#77716) 2022-09-02 17:02:14 +00: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
epenet 99941b1c32
Warn on use of deprecated async_get_registry (#72088)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-05-18 12:04:06 -07:00
epenet 50ca14538a
Cleanup deprecated async_get_registry in core (#72087) 2022-05-18 17:58:28 +02: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