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
Ruslan Sayfutdinov
391b2f8ccd
Add missing return type in Core constructors ( #50884 )
2021-05-20 18:53:29 +03:00
Ruslan Sayfutdinov
0cb08f9516
Add missing type hints in entity_platform ( #50453 )
2021-05-12 16:28:44 +02:00
Marc Mueller
c07646db5d
Update typing syntax ( #49480 )
...
* Update typing syntax
* Replace typing imports with ones from collections where possible
* Changes after review
2021-04-20 17:40:41 +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
Ville Skyttä
dc880118a4
Lint suppression cleanups ( #47248 )
...
* Unused pylint suppression cleanups
* Remove outdated pylint bug references
* Add flake8-noqa config and note to run it every now and then
* Add codes to noqa's
* Unused noqa cleanups
2021-03-02 09:02:04 +01:00
Erik Montnemery
5e26bda52d
Add support for disabling config entries ( #46779 )
2021-02-20 19:21:39 -08: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
f1714dd541
Make some Area and EntityRegistry member functions callbacks ( #46433 )
2021-02-12 17:00:35 +01: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
78b7fbf7b1
Fix race in EntityRegistry.async_device_modified ( #46319 )
2021-02-10 10:50:44 +01:00
Paulus Schoutsen
9e07910ab0
Mark entities as unavailable when they are removed but are still registered ( #45528 )
...
* Mark entities as unavailable when they are removed but are still registered
* Add sync_entity_lifecycle to collection helper
* Remove debug print
* Lint
* Fix tests
* Fix tests
* Update zha
* Update zone
* Fix tests
* Update hyperion
* Update rfxtrx
* Fix tests
* Pass force_remove=True from integrations
Co-authored-by: Erik <erik@montnemery.com>
2021-02-08 10:45:46 +01:00
Philip Allgaier
89fc92f68a
Slightly improve error message in case of duplicate entity IDs ( #45424 )
2021-01-22 09:16:13 -05: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
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
J. Nick Koston
df2ede6522
Fix state overwrite race condition where two platforms request the same entity_id ( #42151 )
...
* Fix state overwrite race condition where two platforms request the same entity id
* fix test
* create reservations instead
* revert
* cannot use __slots__ because we patch async_all
2020-10-21 17:01:51 +02:00
J. Nick Koston
890562e3ae
Index the entity registry ( #37994 )
2020-07-19 22:52:41 -07:00
Ville Skyttä
ac0dbb17af
Attrs cleanups ( #37849 )
2020-07-14 10:30:30 -07:00
Paulus Schoutsen
a330eba61c
Guard bad entity ID in entity registry ( #35271 )
2020-05-05 15:07:54 -07:00
Paulus Schoutsen
e54e9279e3
Extract instance ID helper from updater ( #35043 )
2020-05-04 11:23:12 -07:00
Paulus Schoutsen
6056753a9c
Introduce a singleton decorator ( #34803 )
2020-04-30 16:47:14 -07:00
Paulus Schoutsen
d3bbd9ec65
Delay sync for Google and limit updates to relevant info ( #34622 )
2020-04-24 10:49:11 +02:00
J. Nick Koston
96649a7e27
Use registry to find linked batteries for homekit ( #33519 )
2020-04-21 17:43:49 -07:00
J. Nick Koston
0abcf2d176
Optimize async_generate_entity_id ( #34440 )
2020-04-19 18:19:11 -05:00
springstan
fca90a8ddc
Improve string formatting v5 ( #33697 )
...
* Improve string formatting v5
* Address review comments
2020-04-05 17:48:55 +02:00
Eugenio Panadero
fb22f6c301
Add Context support for async_entity removal ( #33209 )
...
* Add Context for async_remove
* Check context in state automation on entity removal
2020-03-24 09:59:17 -07:00
Paulus Schoutsen
fcbea47c74
Coronavirus updates ( #32417 )
...
* Sort countries alphabetically
* Update sensor name
* Add migration to stable unique IDs
* Update sensor.py
2020-03-02 17:59:32 -08:00
Paulus Schoutsen
7be3a4cd37
Fix entity registry not saving name/icon ( #31932 )
2020-02-18 08:32:34 -08:00
Paulus Schoutsen
51c35ab9a8
Entity Registry to store and restore name/icon ( #31714 )
...
* 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
de26108b23
Restore unit_of_measurement from entity registry ( #30780 )
...
* Restore unit_of_measurement from entity registry
* Lint fix
2020-01-15 08:09:05 -08:00
Jc2k
669c89e8c0
Fix HomeKit with entity registry restoration where supported_features is a non-None falsey ( #30657 )
...
* Fix homekit with #30094
* Fix test
2020-01-10 16:33:48 -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ä
fa4fa30461
Various string cleanups ( #30435 )
...
* Remove some unnecessary string concatenations
* Replace some simple str.formats with f-strings
* Replace some string concatenations with f-strings
2020-01-03 14:47:06 +01:00
Paulus Schoutsen
bb14a083f0
Store capabilities and supported features in entity registry, restore registered entities on startup ( #30094 )
...
* 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
Ville Skyttä
868eb3c735
More helpers type improvements ( #30145 )
2019-12-22 19:51:39 +01: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
Ville Skyttä
f88ead597a
Type hint improvements ( #28260 )
...
* Add and improve core and config_entries type hints
* Complete and improve config_entries type hints
* More entity registry type hints
* Complete helpers.event type hints
2019-10-28 13:36:26 -07:00
Ville Skyttä
33e1b44b3a
Use PEP 526 type annotations, add some type hints ( #26464 )
...
* Add some more type hints to helpers.event
* Change most type comments to variable types
* Remove some superfluous type hints
2019-09-07 09:48:58 +03:00
Penny Wood
4004879ae0
Entity registry doesn't overwrite with None ( #24275 )
2019-09-04 09:49:22 -07:00
Franck Nijhof
decf13b948
Use literal string interpolation in core (f-strings) ( #26166 )
2019-08-23 09:53:33 -07:00
Paulus Schoutsen
f704a8e90e
Reload config entry when entity enabled in entity registry, remove entity if disabled. ( #26120 )
...
* 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 ( #25926 )
...
* 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 ( #26015 )
...
* 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 ( #26011 )
2019-08-16 16:17:16 -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
Paulus Schoutsen
06af6f19a3
Entity to handle updates via events ( #24733 )
...
* Entity to handle updates via events
* Fix a bug
* Update entity.py
2019-06-26 09:22:51 -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
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
Paulus Schoutsen
8213016eaf
Allow targeting areas in service calls ( #21472 )
...
* Allow targeting areas in service calls
* Lint + Type
* Address comments
2019-03-04 09:51:12 -08:00
Paulus Schoutsen
8062f48973
Add remove commmand to entity registry ( #20597 )
2019-01-30 09:50:32 -08:00
Paulus Schoutsen
0300ef2040
Fix entity registry comments ( #20357 )
2019-01-23 16:33:21 -08:00
Paulus Schoutsen
e964750ac1
Fix invalid entity ID in entity registry ( #20328 )
2019-01-22 14:07:17 -08:00
emontnemery
7a7c2ad416
Fix race in entity_platform.async_add_entities ( #19222 )
2018-12-14 10:33:37 +01:00
Paulus Schoutsen
3928d034a3
Allow checking entity permissions based on devices ( #19007 )
...
* Allow checking entity permissions based on devices
* Fix tests
2018-12-05 11:41:00 +01:00
emontnemery
f241becf7f
Avoid race in entity_platform.async_add_entities() ( #18445 )
...
This avoids a race between multiple concurrent calls to
entity_platform.async_add_entities() which may cause
entities to be created with non-unique entity_id
2018-11-19 10:13:50 +01:00
Aaron Bach
bd23145331
Fixed an incorrect reference in the entity registry ( #17775 )
2018-10-24 21:53:18 -06:00
Charles Garwood
da882672bd
Save disabled_by in entity registry ( #16699 )
...
* Save disabled_by in entity registry
* Add trailing comma
2018-09-20 00:52:10 +02:00
Paulus Schoutsen
b8257866f5
Clean up device update, add via-hub ( #16659 )
...
* Clean up device update, add via-hub
* Test loading/saving data
* Lint
* Add to Hue"
* Lint + tests
2018-09-17 13:39:30 +02:00
Robert Svensson
7a6facc875
Device and entity registry remove config entry on unload ( #16247 )
...
* Test
* Ability to remove device
* Don't remove devices, instead remove config entry from device and entity registries
* Remove print
* Remove is not the same as unload
* Add tests
* Fix hound comment
2018-09-04 09:00:14 +02:00
Ville Skyttä
dd9d53c83e
Update pydocstyle to 2.1.1 and flake8-docstrings to 1.3.0 ( #14557 )
...
* Update pydocstyle to 2.1.1 and flake8-docstrings to 1.3.0
* Pydocstyle D401 fixes
2018-08-24 10:28:43 +02:00
Robert Svensson
0009be595c
Device Registry ( #15980 )
...
* First draft
* Generate device id
* No obscure registry
* Dont store config_entry_id in device
* Storage
* Small mistake on rebase
* Do storage more like entity registry
* Improve device identification
* Add tests
* Remove deconz device support from PR
* Fix hound comments, voff!
* Fix comments and clean up
* Fix proper indentation
* Fix pydoc issues
* Fix mochad component to not use self.device
* Fix mochad light platform to not use self.device
* Fix TankUtilitySensor to not use self.device
* Fix Soundtouch to not use self.device
* Fix Plex to not use self.device
* Fix Emby to not use self.device
* Fix Heatmiser to not use self.device
* Fix Wemo lights to not use self.device
* Fix Lifx to not use self.device
* Fix Radiotherm to not use self.device
* Fix Juicenet to not use self.device
* Fix Qwikswitch to not use self.device
* Fix Xiaomi miio to not use self.device
* Fix Nest to not use self.device
* Fix Tellduslive to not use self.device
* Fix Knx to not use self.device
* Clean up a small mistake in soundtouch
* Fix comment from Ballob
* Fix bad indentation
* Fix indentatin
* Lint
* Remove unused variable
* Lint
2018-08-22 10:46:37 +02:00
Paulus Schoutsen
8ec550d6e0
Storage entity registry ( #16018 )
...
* Split out storage delayed write
* Update code using delayed save
* Fix tests
* Fix typing test
* Add callback decorator
* Migrate entity registry to storage helper
* Make double loading protection easier
* Lint
* Fix tests
* Ordered Dict
2018-08-18 13:34:33 +02:00
Paulus Schoutsen
d9cf8fcfe8
Allow changing entity ID ( #15637 )
...
* Allow changing entity ID
* Add support to websocket command
* Address comments
* Error handling
2018-07-24 14:12:53 +02:00
Paulus Schoutsen
8b04d48ffd
Update config entry id in entity registry ( #15531 )
2018-07-19 08:37:13 +02:00
Ville Skyttä
b92350fb55
Lint cleanup ( #15103 )
...
* Remove unneeded inline pylint disables
* Remove unneeded noqa's
* Use symbol names instead of message ids in inline pylint disables
2018-06-25 13:05:07 -04:00
Paulus Schoutsen
67d137cfd5
Store config entry id in entity registry ( #14851 )
...
* Store config entry id in entity registry
* Lint
2018-06-07 20:23:09 +02:00
Andrey
d1228d5cf4
Look at registry before pulling zwave config values ( #14408 )
...
* Look at registry before deciding on ID for zwave values
* Reuse the new function
2018-05-12 17:45:36 -04:00
Julius Mittenzwei
16cb7388ee
Removing asyncio.coroutine syntax from HASS core ( #12509 )
...
* changed asyncio.coroutine syntax to new async def/await
* removed py34 from tox environment
* reverted some changes within entity.py
* -
* reverted changes within bootstrap.py
* reverted changes within discovery.py
* switched decorators
* Reverted change within aiohttp_client.py
* reverted change within logging.py
* switched decorators
* Await lock properly
* removed asyncio.coroutine from test
2018-02-25 03:38:46 -08:00
Paulus Schoutsen
6d431c3fc3
Allow renaming entities in entity registry ( #12636 )
...
* Allow renaming entities in entity registry
* Lint
2018-02-24 10:53:59 -08:00
Paulus Schoutsen
d2cea84254
Allow disabling entities in the registry ( #12360 )
2018-02-13 13:33:15 +01:00
Paulus Schoutsen
17e5740a0c
Allow overriding name via entity registry ( #12292 )
...
* Allow overriding name via entity registry
* Update requirements
2018-02-11 09:16:01 -08:00
Paulus Schoutsen
e51427b284
Entity registry ( #11979 )
...
* Entity#unique_id defaults to None
* Initial commit entity registry
* Clean up unique_id property
* Lint
* Add tests to entity component
* Lint
* Restore some unique ids
* Spelling
* Remove use of IP address for unique ID
* Add tests
* Add tests
* Fix tests
* Add some docs
* Add one more test
* Fix new test…
2018-01-30 10:39:39 +01:00