Commit Graph

79 Commits

Author SHA1 Message Date
Paulus Schoutsen
14f68ec1a9 Store redirect URI in context instead of asking each time (#77380)
* Store redirect URI in context instead of asking each time

* Fix tests
2022-08-29 19:28:42 -04:00
puddly
2224d0f43a Add a callback for data flow handler removal (#77394)
* Add a callback for when data flows are removed

* Call `async_remove` at the very end

* Handle and log exceptions caught during flow removal

* Log the error as an exception, with a traceback

* Adjust test's expected logging output to match updated format specifier
2022-08-29 16:25:34 -04:00
Marc Mueller
563ec67d39 Add strict typing for auth (#75586) 2022-08-16 10:10:37 -04:00
epenet
67b0354632 Adjust FlowResult construction in data entry flow (#72884) 2022-06-16 12:57:41 +02:00
epenet
f91aa33c5f Add FlowResultType enum to data entry flow (#72955) 2022-06-07 22:02:44 -07:00
epenet
627d6f7803 Ensure description_placeholders is always typed (#72716) 2022-05-31 10:33:34 +02:00
Erik Montnemery
a50bac5cc2 Make initial group config flow step a menu (#68565) 2022-03-23 08:34:44 -07:00
Paulus Schoutsen
f6af93ae35 Add support for menu step (#68203) 2022-03-16 14:14:50 -07:00
Franck Nijhof
5965b015dd Adjust data entry flow to have an option data_schema (#67637) 2022-03-04 16:42:02 +01:00
Marc Mueller
8d2fb72cc3 Add type ignore error codes [core] (#66773) 2022-02-17 23:09:22 -08:00
J. Nick Koston
490d8e1136 Fix webserver responsiveness where there are a lot of discoveries (#64719) 2022-01-22 22:29:16 +01:00
epenet
560546f65e Use dataclass for DhcpServiceInfo (#60136)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-23 13:35:53 +01:00
epenet
4ecbfe8646 Drop STEP_ID constants from data_entry_flow (#59497)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-11 16:28:46 +01:00
Marc Mueller
4c68662612 Use assignment expressions 34 (#58823) 2021-10-31 19:01:16 +01:00
epenet
1e8ccb47ce Use constants in control4 config flow (#58602)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-10-28 22:15:30 +02:00
epenet
d3bafce157 Use constants in acmeda config flow (#58590)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-10-28 18:09:28 +02:00
J. Nick Koston
3b7dce8b95 Index in-progress flows to avoid linear search (#58146)
Co-authored-by: Steven Looman <steven.looman@gmail.com>
2021-10-22 07:19:49 -10:00
J. Nick Koston
7cc924e83c Remove unreachable code in data_entry_flow.py (#58193)
- bc1daf1802 removed the need for this
  guard
2021-10-22 01:45:16 +02:00
J. Nick Koston
b86e19143d Prevent event loop delay / instability from discovery (#57463) 2021-10-13 08:37:14 -07:00
Marc Mueller
7af67d34cf Use assignment expressions 01 (#56394) 2021-09-18 13:31:35 -10:00
Ruslan Sayfutdinov
391b2f8ccd Add missing return type in Core constructors (#50884) 2021-05-20 18:53:29 +03:00
Franck Nijhof
177317a345 Allow passing options in config flow entry creation (#49912) 2021-05-05 22:14:01 -07:00
Franck Nijhof
44383f25ce Clean up pylint comments (#49334) 2021-05-05 08:56:50 +02:00
Ruslan Sayfutdinov
183220008d Rename FlowResultDict to FlowResult (#49847) 2021-04-29 13:40:51 +02:00
Erik Montnemery
8013eb0e08 Allow data entry flows to hint for additional steps (#49202) 2021-04-23 11:02:12 -07:00
J. Nick Koston
5fb36ad9e1 Add missing typing to data_entry_flow (#49271) 2021-04-15 09:59:52 -10: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
Ruslan Sayfutdinov
9997ae6932 Type data parameter as Mapping in async_create_entry (#49050) 2021-04-11 16:56:33 +02:00
Franck Nijhof
f0e5e616a7 Fix device discovery of OAuth2 config flows (#48326) 2021-03-25 10:35:01 -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
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
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
Martin Hjelmare
1338c4a425 Add data entry flow show progress step (#42419) 2020-11-09 18:39:28 +01: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
Philip Allgaier
625bbe6238 Cleanup unused loggers (components A-M) (#41600) 2020-10-12 16:59:05 +02:00
Franck Nijhof
1c2ebdf307 Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
Paulus Schoutsen
1c5b4dbd97 Add current step that is in progress (#35272) 2020-05-05 21:34:51 -07:00
Paulus Schoutsen
6404882ec4 Allow flows to know if user is in advanced mode (#34629) 2020-04-24 09:31:56 -07:00
Paulus Schoutsen
0b90ebf91e Allow async_setup changes to config entry data be taken into a… (#34166)
* Allow async_setup changes to config entry data be taken into account

* Fix tests

* Limit scope try…finally

* Update tests/test_config_entries.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Fix import

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-14 18:46:41 -07:00
springstan
fca90a8ddc Improve string formatting v5 (#33697)
* Improve string formatting v5

* Address review comments
2020-04-05 17:48:55 +02:00
Franck Nijhof
7653dc947a Enable pylint unnecessary-pass (#33650)
* Enable pylint unnecessary-pass

* Process review suggestions

* Fix smhi tests
2020-04-05 10:33:07 +02: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
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
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
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
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