Commit graph

59 commits

Author SHA1 Message Date
Paulus Schoutsen
a330eba61c
Guard bad entity ID in entity registry () 2020-05-05 15:07:54 -07:00
Paulus Schoutsen
e54e9279e3
Extract instance ID helper from updater () 2020-05-04 11:23:12 -07:00
Paulus Schoutsen
6056753a9c
Introduce a singleton decorator () 2020-04-30 16:47:14 -07:00
Paulus Schoutsen
d3bbd9ec65
Delay sync for Google and limit updates to relevant info () 2020-04-24 10:49:11 +02:00
J. Nick Koston
96649a7e27
Use registry to find linked batteries for homekit () 2020-04-21 17:43:49 -07:00
J. Nick Koston
0abcf2d176
Optimize async_generate_entity_id () 2020-04-19 18:19:11 -05:00
springstan
fca90a8ddc
Improve string formatting v5 ()
* 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 ()
* 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 ()
* 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 () 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
de26108b23 Restore unit_of_measurement from entity registry ()
* 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 ()
* Fix homekit with 

* Fix test
2020-01-10 16:33:48 -08:00
Paulus Schoutsen
3348f4f6d1
Add search integration ()
* 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 ()
* 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 ()
* 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 () 2019-12-22 19:51:39 +01:00
Bas Nijholt
67c56c860d Sort imports according to PEP8 for 'homeassistant' folder ()
Components are already done
2019-12-09 16:42:10 +01:00
Ville Skyttä
f88ead597a Type hint improvements ()
* 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 ()
* 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 () 2019-09-04 09:49:22 -07:00
Franck Nijhof
decf13b948 Use literal string interpolation in core (f-strings) () 2019-08-23 09:53:33 -07: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
Ville Skyttä
aa508b5106 Complete some incomplete type hints in helpers () 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 ()
* 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 ()
* 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 ()
* 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. ()
* 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 ()
* 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 ()
* 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 ()
* 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 ()
* 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 () 2019-01-30 09:50:32 -08:00
Paulus Schoutsen
0300ef2040
Fix entity registry comments () 2019-01-23 16:33:21 -08:00
Paulus Schoutsen
e964750ac1
Fix invalid entity ID in entity registry () 2019-01-22 14:07:17 -08:00
emontnemery
7a7c2ad416 Fix race in entity_platform.async_add_entities () 2018-12-14 10:33:37 +01:00
Paulus Schoutsen
3928d034a3 Allow checking entity permissions based on devices ()
* 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() ()
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 () 2018-10-24 21:53:18 -06:00
Charles Garwood
da882672bd Save disabled_by in entity registry ()
* 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 ()
* 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 ()
* 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 ()
* 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 ()
* 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 ()
* 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 ()
* Allow changing entity ID

* Add support to websocket command

* Address comments

* Error handling
2018-07-24 14:12:53 +02:00