Commit graph

103 commits

Author SHA1 Message Date
Franck Nijhof
efb1bb08a4
Add small async_get_current_platform helper method () 2021-05-03 16:46:42 +02:00
Franck Nijhof
378cee01b4
Add typing to async_register_entity_service () 2021-05-03 14:22:38 +02:00
Ruslan Sayfutdinov
0301706fc6
Define AddEntitiesCallback type () 2021-04-29 12:28:14 +02:00
J. Nick Koston
3fa8ffa731
Enable mccabe complexity checks in flake8 ()
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-04-25 12:38:40 +02:00
Marc Mueller
c07646db5d
Update typing syntax ()
* Update typing syntax

* Replace typing imports with ones from collections where possible

* Changes after review
2021-04-20 17:40:41 +02:00
J. Nick Koston
44beff31c2
Cancel config entry retry, platform retry, and polling at the stop event () 2021-04-13 16:16:26 -10:00
Raman Gupta
769923e8dd
Raise exception for invalid call to DeviceRegistry.async_get_or_create ()
* Raise exception instead of returning None for DeviceRegistry.async_get_or_create

* fix entity_platform logic
2021-04-13 14:18:51 +02:00
J. Nick Koston
4cd7f9bd8b
Raise ConfigEntryAuthFailed during setup or coordinator update to start reauth () 2021-04-09 19:41:29 -10:00
J. Nick Koston
12e3bc8101
Provide api to see which integrations are being loaded ()
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-04-04 22:11:44 -10:00
J. Nick Koston
b5c679f3d0
Apply ConfigEntryNotReady improvements to PlatformNotReady ()
* Apply ConfigEntryNotReady improvements to PlatformNotReady

- Limit log spam 
- Log exception reason 
- Prevent startup blockage 

* coverage
2021-04-04 12:31:58 +02:00
Franck Nijhof
38d14702fa
Remove HomeAssistantType alias from helpers () 2021-03-27 12:55:24 +01:00
J. Nick Koston
c4f98a3084
Small speed up to adding entities () 2021-03-26 12:05:19 +01:00
Marc Mueller
6fb2e63e49
Update typing 02 () 2021-03-17 18:34:19 +01:00
Ville Skyttä
dc880118a4
Lint suppression cleanups ()
* 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
J. Nick Koston
bb7e4d7daa
Implement suggested_area in the device registry ()
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-02-19 19:34:33 -10:00
Franck Nijhof
9b7c39d20b
Postponed evaluation of annotations in core ()
* Postponed evaluation of annotations in core

* Remove unneeded future
2021-02-12 10:58:20 +01:00
Paulus Schoutsen
9e07910ab0
Mark entities as unavailable when they are removed but are still registered ()
* 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
Ville Skyttä
3a88a4120e
Helpers type hint improvements () 2021-01-09 00:08:34 +01:00
Philip Allgaier
392c058d34
Ensure consistent spelling of "ID" () 2020-12-28 18:34:08 +01:00
J. Nick Koston
3ec7258c21
Ensure instances of async_add_entities can be garbage collected () 2020-11-07 06:54:20 -10:00
J. Nick Koston
ce2c388c09
Ensure config entry platforms are excluded from reload () 2020-10-25 23:53:31 +01:00
J. Nick Koston
df2ede6522
Fix state overwrite race condition where two platforms request the same entity_id ()
* 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
Erik Montnemery
12a6d10168
Log exceptions in EntityPlatform.async_add_entities ()
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-10-13 15:35:27 +02:00
Ville Skyttä
f28c3273c2
Upgrade mypy to 0.790 () 2020-10-12 19:17:30 -05:00
Ville Skyttä
167490b71c
Complete helpers.service type hints ()
* Complete helpers.service type hints

* Update homeassistant/helpers/service.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Handle None entity.supported_features
2020-09-20 12:03:58 +03:00
J. Nick Koston
8adfcf23f0
Fix isy994 send_node_command () 2020-09-08 17:31:08 +02:00
Franck Nijhof
1c2ebdf307
Upgrade black to 20.8b1 () 2020-08-27 13:56:20 +02:00
Paulus Schoutsen
3dc79aa60a
Track entity sources ()
Co-authored-by: David Mulcahey <david.mulcahey@me.com>
2020-08-19 14:57:38 +02:00
J. Nick Koston
af5cb948a0
Adjust slow add entities timeouts to handle slowest known case ()
With this change, we should still be able to startup
in under 10 minutes if something really goes wrong.

The testing done in  was used to determine
these values.
2020-08-15 07:14:02 +02:00
Paulus Schoutsen
b3571602bb
Add default_* to device registry () 2020-08-13 10:38:56 +02:00
Ville Skyttä
991bf126d4
Helpers type hint improvements () 2020-08-12 23:01:10 +02:00
Pascal Vizeli
72a6251042
V2 timeout for async_add_entities ()
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-08-07 08:36:38 +02:00
Pascal Vizeli
896bdbff8f
Revert "Add a timeout for async_add_entities ()" ()
This reverts commit 7590af3930.
2020-08-06 09:32:42 +02:00
J. Nick Koston
7590af3930
Add a timeout for async_add_entities () 2020-08-05 18:06:21 +02:00
Pascal Vizeli
c291d4aa7d
Intelligent timeout handler for setup/bootstrap ()
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-08-05 14:58:19 +02:00
J. Nick Koston
fe69a85386
Improve logging when a unique id conflict is detected ()
* fix error when unique id is re-used

* add test for the logging

* Update homeassistant/helpers/entity_platform.py

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

* Update homeassistant/helpers/entity_platform.py

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

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-08-01 11:20:37 +02:00
David F. Mulcahey
967a168ab7
Update comment about parallel updates to match the documentation () 2020-07-19 14:40:08 -10:00
Paulus Schoutsen
d08d00daa7
Limit entity platform entity service to same integration () 2020-07-02 11:39:53 +02:00
mdegat01
52f3238e17
Add constant for PlatformNotReady wait time to use in tests () 2020-07-01 08:42:57 -07:00
Paulus Schoutsen
1ffa8fcbba
Platforms cleanup when adding entity fails () 2020-06-12 17:54:46 -07:00
Ville Skyttä
0c5ca3084e
Add and fix type hints ()
* Fix exceptions.Unauthorized.permission type

* Use auth.permission consts more

* Auth typing improvements

* Helpers typing improvements

* Calculate self.state only once
2020-06-06 20:34:56 +02:00
Paulus Schoutsen
276f3afb00
Do async_setup_platform in background ()
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-31 22:18:30 -07:00
Paulus Schoutsen
b90cb09fd1
Add type to device registry () 2020-05-03 13:56:58 -07:00
Paulus Schoutsen
5a9970e63c
Dump states in event handler for HA_Stop ()
* Dump states in event handler for HA_Stop

* Fix type
2020-04-13 17:41:01 -07:00
Paulus Schoutsen
aef06a3544
Directly call write state 2 ()
* Directly call async_write_ha_state pt2

* Directly call async_write_ha_state pt2

* Fix mock

* Address comments
2020-04-03 09:34:50 +02:00
Ziv
4dbbf93af9
Replace asyncio.wait with asyncio.gather since wait ignores exceptions ()
* replace asyncio.wait with asyncio.gather since wait ignores exceptions
fix for test_entity_platform so it expects the exception

* changed to log on failed domains

* discovered that this fix actually removes other uncaught exceptions

* fix in the list of ignored exceptions

* replaced a few ignores on dyson tests that work locally but fail in the CI

* two more tests that are failing on the CI and not locally

* removed assertion on multiple entries with same unique_id - replaced with log and return
reverted test_entity_platform to its original since now there is no exception thrown

* entered all the dyson tests. they all pass locally and probabilistically fail in the CI

* removed unnecessary str() for exception

* added log message for duplicate entity_id / unique_id

* removed log in case of False return value

* added exc_info

* change the use of exc_info
2020-04-01 07:09:13 -07:00
Paulus Schoutsen
1ff245d9c2
Make sure entity platform services work for all platforms of d… ()
* Make sure entity platform services work for all platforms of domain

* Register a bad service handler

* Fix cleaning up

* Tiny cleanup
2020-03-23 12:59:36 -07:00
Ville Skyttä
05abf37046
Type hint improvements ()
* Complete helpers.entity_component type hints

* Add discovery info type
2020-03-18 19:27:25 +02: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
Paulus Schoutsen
e970177eeb
Use entity.async_request_call in service helper ()
* Use entity.async_request_call in service helper

* Clean up semaphore handling

* Address comments

* Simplify call entity service helper

* Fix stupid rflink test
2020-02-04 15:30:15 -08:00