Commit Graph

185 Commits (3fda66d9e2cc9dc1347be178b0f5747d7b62a32c)

Author SHA1 Message Date
J. Nick Koston 51be2f860a
Reduce boilerplate to setup config entry platforms A-C (#49681)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-04-26 07:46:55 -10:00
Paulus Schoutsen 265fdea83b
Allow config entries to store a reason (#49581) 2021-04-23 09:23:43 +02:00
Ruslan Sayfutdinov 7a9385d857
Explicitly define all methods in ConfigFlow (#49341) 2021-04-17 12:42:31 +02:00
Ruslan Sayfutdinov 80f66f301b
Define data flow result type (#49260)
* Define data flow result type

* Revert explicit definitions

* Fix tests

* Specific mypy ignore
2021-04-15 07:17:07 -10:00
J. Nick Koston dafc7a072c
Cancel discovery flows that are initializing at shutdown (#49241) 2021-04-15 07:13:42 -10:00
J. Nick Koston 44beff31c2
Cancel config entry retry, platform retry, and polling at the stop event (#49138) 2021-04-13 16:16:26 -10:00
J. Nick Koston 4cd7f9bd8b
Raise ConfigEntryAuthFailed during setup or coordinator update to start reauth (#48962) 2021-04-09 19:41:29 -10:00
J. Nick Koston 40450b9cfd
Detach aiohttp.ClientSession created by config entry setup on unload (#48908) 2021-04-09 10:14:33 -07:00
J. Nick Koston cfe2df9ebd
Prevent config entry retry from blocking startup (#48660)
- If there are two integrations doing long retries async_block_till_done() will never be done
2021-04-03 17:00:22 -07:00
J. Nick Koston 6023105c6a
Do not load ignored or disabled integrations at startup (#48355)
config_entries.async_setup will skip ignored and disabled integrations
but bootstrap would still load them in memory even though they would
never be setup.
2021-03-29 13:06:44 +02:00
J. Nick Koston cb1b45d31a
Log the reason a config entry failed to setup (#48449)
If we pass a string to ConfigEntryNotReady or raise it from
another exception we now log the string passed or the
string generated by the original exception.

With #47201 this makes it easy for developers to still show
the reason why setup failed without having to worry about log
spam from additional attempts by rasing ConfigEntryNotReady
from the original exception.
2021-03-29 12:25:40 +02:00
Franck Nijhof f0e5e616a7
Fix device discovery of OAuth2 config flows (#48326) 2021-03-25 10:35:01 -07:00
J. Nick Koston f35641ae8e
Make sure include_ignore=False always works with _async_current_entries (#48196)
If the step was anything other than SOURCE_USER,
include_ignore=False would not be honored
2021-03-21 21:57:49 -07:00
J. Nick Koston 3f2ca16ad7
Index config entries by id (#48199) 2021-03-21 21:44:29 -07:00
Marc Mueller 4cb7718192
Update typing 16 (#48087) 2021-03-18 22:58:19 +01:00
Marc Mueller e55702d635
Update typing 01 (#48013) 2021-03-17 17:34:55 +01:00
Paulus Schoutsen 67effbc8c4
Config flow to allow marking itself as confirm only (#47607) 2021-03-08 10:54:51 -08:00
Erik Montnemery 504e5b77ca
Improve behaviour when disabling or enabling config entries (#47301) 2021-03-03 10:12:37 -08:00
Simone Chemelli 17444e2f2f
Limit log spam by ConfigEntryNotReady (#47201) 2021-03-02 12:50:28 -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 003fee2a35
Fix race when disabling config entries (#47210)
* Fix race when disabling config entries

* Remove unused constant
2021-03-01 12:38:49 +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
Franck Nijhof bc1daf1802
None optional hass typing in FlowHandler (#46462)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-02-13 13:21:37 +01:00
Franck Nijhof 9b7c39d20b
Postponed evaluation of annotations in core (#46434)
* Postponed evaluation of annotations in core

* Remove unneeded future
2021-02-12 10:58:20 +01:00
Erik Montnemery dd150bb797
Allow manual configuration of ignored singleton config entries (#45161)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-02-04 11:08:10 +01:00
jpcornil-git 74a44e03fa
Extend add_update_listener support to bound methods (#44238) 2021-01-26 22:19:10 +01:00
Simone Chemelli 86cd7911de
Clarify ConfigEntryNotReady log (#45425)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Charles Garwood <cgarwood@gmail.com>
2021-01-22 12:13:23 -05:00
J. Nick Koston da677f7d5a
Add support for discovery via DHCP (#45087)
* Add support for discovery via DHCP

* additional tesla ouis

* merge tests

* dhcp test

* merge requirements test

* dhcp test

* dhcp discovery

* dhcp discovery

* pylint

* pylint

* pylint

* fix

* Add matching tests

* 100% cover

* cleanup

* fix codespell

* Update exception handling

* remove unneeded comment

* fix options handling exception

* fix options handling exception
2021-01-14 09:09:08 +01:00
Paulus Schoutsen e83ced6737
Add name to ignored entries (#45051)
* Add name to ignored entries

* Fix test
2021-01-12 09:26:20 +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
nivnoach 906e1ce960
Allow manual configuration of ignored config entries (#43947) 2020-12-07 09:25:04 +01:00
Erik Montnemery 5694e4190c
Extend WS API result when enabling an entity (#42667)
* Extend WS API result when enabling an entity

* Fix tests

* Fix tests

* Move updated registry entry to sub dict

* Address review comments

* Increase test coverage
2020-11-09 19:47:45 +01:00
Raman Gupta a416a9e046
Allow options flows to be aborted (#41875) 2020-11-09 08:59:42 +01:00
Philip Allgaier bd1d6f2c0d
Add link to log view in persistent notification (#42060) 2020-10-21 12:09:45 -05:00
Raman Gupta 0e20bba40a
Add persistent notification for reauth config flows (#41811)
* add persistent notification for reauth config flow

* remove log

* Update homeassistant/config_entries.py

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

* Update homeassistant/config_entries.py

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

* fix logic for determining when to dismiss notification

* add comment

* improve tests to ensure notifications only get dismissed when all in progress config flows of a given type are complete

* Update homeassistant/config_entries.py

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

* handle context is None when accessing source

* add guard to show_advanced_options

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Chris Talkington <chris@talkingtontech.com>
2020-10-15 15:46:27 -05:00
Erik Montnemery a3f8b76537
Make async_step_discovery default for MQTT config flows (#41414) 2020-10-07 23:49:29 +02:00
Erik Montnemery 343e5d64b8
Add MQTT integration discovery (#41332)
* Add MQTT integration discovery

* Add script/hassfest/mqtt.py

* Unsubscribe if config entry exists

* Add homeassistant/generated/mqtt.py

* Fix bad loop

* Improve tests

* Improve tests

* Apply suggestions from code review

Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>

* Prevent initiating multiple config flows

Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>
2020-10-07 18:30:51 +02:00
J. Nick Koston 8d5c124deb
Improve performance of generating non-cryptographically secure uuids (#41314) 2020-10-07 16:37:01 +02:00
Chris Talkington 37e51aa166
Add reauth source constant for config entries (#40352) 2020-09-20 21:15:48 -05:00
Ville Skyttä 1bf2c4d976
Upgrade pylint to 2.6.0 (#39363) 2020-08-29 07:59:24 +02:00
Ville Skyttä b4bac0f7a0
Exception chaining and wrapping improvements (#39320)
* Remove unnecessary exception re-wraps

* Preserve exception chains on re-raise

We slap "from cause" to almost all possible cases here. In some cases it
could conceivably be better to do "from None" if we really want to hide
the cause. However those should be in the minority, and "from cause"
should be an improvement over the corresponding raise without a "from"
in all cases anyway.

The only case where we raise from None here is in plex, where the
exception for an original invalid SSL cert is not the root cause for
failure to validate a newly fetched one.

Follow local convention on exception variable names if there is a
consistent one, otherwise `err` to match with majority of codebase.

* Fix mistaken re-wrap in homematicip_cloud/hap.py

Missed the difference between HmipConnectionError and
HmipcConnectionError.

* Do not hide original error on plex new cert validation error

Original is not the cause for the new one, but showing old in the
traceback is useful nevertheless.
2020-08-28 13:50:32 +02:00
Franck Nijhof 1c2ebdf307
Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
J. Nick Koston e109b04efe
Add api to reload config entries (#39068) 2020-08-26 00:59:22 +02:00
J. Nick Koston bee6d87e7a
Standardize uuid generation for events/storage/registry (#39184) 2020-08-24 17:21:30 +02:00
Paulus Schoutsen 71acb2c665
Only reload config entry if it is loaded (#39202) 2020-08-24 10:54:26 +02:00
J. Nick Koston 74c23c3e96
Add support for reload_on_update to _abort_if_unique_id_configured (#38638)
* Add support for reload_on_update to _abort_if_unique_id_configured

async_update_entry now avoids firing update listeners and writing
the storage if there are no actual changes.

* Actually add the tests

* collapse branch

* Update homeassistant/config_entries.py

Co-authored-by: Franck Nijhof <git@frenck.dev>

* handle entries that lack the ability to reload

* reduce

* adjust konnected tests

* update axis tests

* fix blocking

* more mocking

* config flow tests outside of test_config_flow

* reduce

* volumio

* Update homeassistant/config_entries.py

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

* set reload_on_update=False for integrations that implement self._abort_if_unique_id_configured(updates= and a reload listen

* get rid of copy

* revert test change

Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-08-08 13:23:56 -05:00
Ville Skyttä aa1c5fc43d
Various type hint improvements (#37952) 2020-07-22 08:06:37 -07:00
Ville Skyttä ac0dbb17af
Attrs cleanups (#37849) 2020-07-14 10:30:30 -07:00
Franck Nijhof 53545c984b
Log lines do not end with a full stop (#37527) 2020-07-05 23:04:19 +02:00