1
mirror of https://github.com/home-assistant/core synced 2024-10-04 07:58:43 +02:00
Commit Graph

152 Commits

Author SHA1 Message Date
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
Erik Montnemery
747490ab34
Support reconfiguring MQTT config entry (#36537) 2020-06-22 17:49:01 -07:00
Franck Nijhof
3cc94f7d6a
ConfigFlow default discovery without unique ID (#36754) 2020-06-15 13:38:38 +02:00
J. Nick Koston
d2a92ce4f3
Ensure a deleted integration can be removed (#36130)
* Ensure a deleted intergration can be removed

* Update homeassistant/config_entries.py

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

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-05-25 15:40:06 -04:00
jjlawren
c12f8bed43
Plex discovery on demand (#35303)
* Allow Plex discovery on demand

* Add new discovery source

* Add tests
2020-05-13 09:11:00 -04:00
Ville Skyttä
b4404b071f
Pylint cleanups (#35409)
* Avoid some outer name redefinitions

* Remove unneeded directives

* Narrow directive scope

* Don't disable redefined-variable-type
2020-05-09 14:08:40 +03:00
Franck Nijhof
98a2efcbab
Collection of random (mainly) test improvements (#33733) 2020-04-06 12:51:48 +02:00
Franck Nijhof
7d3c974747
Use set & dict literals (#33636)
Co-authored-by: Daniel Høyer Iversen <mail@dahoiv.net>
2020-04-04 20:05:15 +02:00
Paulus Schoutsen
d4615fd432
Freeze config entry data (#32615)
* Freeze config entry data

* Fix mutating entry.data

* Fix config entry options tests
2020-03-09 14:07:50 -07:00
Paulus Schoutsen
e019280d94
Annotate more async functions correctly (#31802) 2020-02-14 10:00:22 -08:00
Franck Nijhof
0173c61fee
Spelling: Config(uration) (#31782) 2020-02-13 08:27:00 -08:00
Christian Clauss
df7d2b3aeb
Fix typos found by codespell (#31243)
* Fix typos found by codespell

* Fix typos found by codespell

* codespell: Furture  ==> Future

* Update test_config_flow.py

* Update __init__.py

* Spellcheck: successfull  ==> successful

* Codespell: unsuccesful  ==> unsuccessful

* Codespell: cant  ==> can't

* Codespell: firware ==> firmware

* Codespell: mimick  ==> mimic
2020-01-31 08:33:00 -08:00
Franck Nijhof
b743f9b8f6 Add update_entry dict to unique ID flow abort helper (#31090)
* Add update_entry dict to unique ID flow abort helper

* Process review suggestions

* Process review suggestions

* Add additional test
2020-01-23 11:21:19 -08:00
Jc2k
6b519499a7 Don't expose flows that aren't initialised. (#30432)
* Don't expose flows that aren't initialised.

If a flow init does not return immediately then there is a window where our
behaviour is screwy:

 * Can try to configure a flow that isn't ready
 * Can show notifications for discoveries that might yet return an abort

This moves the flow discovery events and notifications to after the flow is
initialised and hides flows that don't have a cur_step from async_progress

* Fix tradfri test

* Black.

* Lint fixes
2020-01-03 17:28:05 +01:00
Jc2k
fdfedd086b Rework FlowManager to use inheritance (#30133)
* Pull async_finish_flow/async_create_flow out of ConfigEntries

* Towards refactoring

* mypy fixes

* Mark Flow manager with abc.* annotations

* Flake8 fixes

* Mypy fixes

* Blacken data_entry_flow

* Blacken longer signatures caused by mypy changes

* test fixes

* Test fixes

* Fix typo

* Avoid protected member lint (W0212) in config_entries

* More protected member fixes

* Missing await
2020-01-03 11:52:01 +01:00
Jc2k
b41480ae46 Add a config entry mechanism to rediscover a discovery that was ignored (#30099)
* Mechanism to rediscover a discovery that was ignored

* Add core config entry tests for new rediscover step

* Add tests for homekit_controller implementation of async_step_rediscover

* Rename rediscover to unignore

* Comment the new ignore/unignore mechanisms
2019-12-21 11:22:07 +01:00
Jc2k
4ef04840e9 Don't error on removal of an ignored homekit_controller config entry (#30083)
* Don't error on ignored entries

* Don't ever call async_remove_entry or async_unload_entry for an unignored ignore config entry
2019-12-20 21:49:07 +01:00
Paulus Schoutsen
9c7caaa142
Add option to ignore flows (#30008) 2019-12-18 07:41:01 +01:00
Paulus Schoutsen
58b5833d64
Convert Hue to use unique ID (#30000)
* Convert Hue to use unique ID

* Fix normalization

* Store/restore unique ID

* Fix tests
2019-12-16 19:45:09 +01:00
Paulus Schoutsen
d851cb6f9e
Add unique ID to config entries (#29806)
* Add unique ID to config entries

* Unload existing entries with same unique ID if flow with unique ID is
finished

* Remove unused exception

* Fix typing

* silence pylint

* Fix tests

* Add unique ID to Hue

* Address typing comment

* Tweaks to comments

* lint
2019-12-16 12:27:43 +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
Franck Nijhof
a4ec4d5a18 Add source constants for all config entry discovery sources (#28311) 2019-10-28 23:32:57 -07: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ä
381d423fec Upgrade mypy to 0.740 (#27913)
* Upgrade mypy to 0.740

http://mypy-lang.blogspot.com/2019/10/mypy-0740-released.html

* Type hint additions

* Type fixes

* Remove no longer needed type ignores and casts

* Disable untyped definition checks in bunch of files
2019-10-19 11:35:57 -07:00
Paulus Schoutsen
b6c26cb363
Introduce new OAuth2 config flow helper (#27727)
* Refactor the Somfy auth implementation

* Typing

* Migrate Somfy to OAuth2 flow helper

* Add tests

* Add more tests

* Fix tests

* Fix type error

* More tests

* Remove side effect from constructor

* implementation -> auth_implementation

* Make get_implementation async

* Minor cleanup + Allow picking implementations.

* Add support for extra authorize data
2019-10-18 13:06:33 -07:00
Franck Nijhof
2f0eb07624 Migrate legacy typehints in core to PEP-526 (#26403)
* Migrate legacy typehints in core to PEP-526

* Fix one type
2019-09-03 20:36:04 -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
Paulus Schoutsen
cf2d927f14
Use init_subclass for Config Entries (#26059)
* Use init_subclass for Config Entries

* Ignore type
2019-08-20 10:46:51 -07:00
Paulus Schoutsen
a1dbdbba6a Save config entry after updating system options (#26077) 2019-08-19 18:45:17 -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
8a1ab8c0b5
Tweaks to options flow (#25969) 2019-08-15 14:11:55 -07:00
Paulus Schoutsen
4de97abc3a Black 2019-07-31 12:25:30 -07:00
Ville Skyttä
b230562c76 Mypy config cleanups (#25475)
* Move file specific config to inline comments

* Disallow untyped defs by default everywhere
2019-07-25 08:08:20 +02:00
Ville Skyttä
fc5b1c7005 Mypy config improvements (#25340)
* Specify python version

So that it type checks against the lowest common denominator version,
not the runtime one.

* Disallow incomplete definitions
2019-07-20 14:35:59 -07:00