146 Commits

Author SHA1 Message Date
Petar Petrov
9239ace1c8
Config flow progress in percent (#142737)
* Config flow progress in percent

* PR comments
2025-04-14 10:24:01 +02:00
Erik Montnemery
cf63175232
Abort reauth flows on config entry reload (#140931)
* Abort reauth flows on config entry reload

* Don't cancel reauth when reload is triggered by a reauth flow

* Revert "Don't cancel reauth when reload is triggered by a reauth flow"

This reverts commit f37c75621e99d4c160c2c4adc9b36e52e4cc81ec.

* Don't fail in FlowManager._async_handle_step when the flow was aborted

* Update tplink config flow

* Add tests

* Don't allow create_entry from an aborted flow

* Add comment

* Adjust after merge with dev
2025-04-10 20:55:34 +02:00
Erik Montnemery
f344314762
Abort if a flow is removed during a step (#142138)
* Abort if a flow is removed during a step

* Reorganize code

* Only call _set_pending_import_done if an entry is created

* Try a new approach

* Add tests

* Update tests
2025-04-09 07:04:41 -10:00
Erik Montnemery
a026820483
Remove FlowManager.async_post_init (#142462) 2025-04-07 13:28:27 +02:00
Jan Bouwhuis
e192bfb62e
Do not deepcopy section schema when applying suggested values (#141280)
Do not deep copy section schema when appying suggested values
2025-03-24 15:32:57 +01:00
Jan Bouwhuis
93010ab5c9
Ensure suggested values are added to section schema in data entry fow (#141227) 2025-03-23 22:14:06 +01:00
Erik Montnemery
fe3d6f93d7
Fix data_entry_flow.UnknownStep error message (#138288) 2025-02-11 18:56:18 +01:00
Franck Nijhof
60bdc13c94
Drop Python 3.12 support (#135589) 2025-01-14 16:23:15 +01:00
Robert Resch
a68cf21179
Remove deprecated data entry flow constants (#131800)
* Remove deprecated data entry flow constants

* Fix

* Fix

* Fix

* Fix

---------

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2024-11-29 00:37:26 +01:00
epenet
c7485b94d5
Use breaks_in_ha_version in report_usage (#131137)
* Use breaks_in_ha_version in report_usage

* Revert behavior change
2024-11-23 18:58:24 +01:00
epenet
e772eef035
Prevent None strings in description_placeholders (#127103) 2024-11-15 14:39:57 +01:00
epenet
a3b0909e3f
Add new frame helper to better distinguish custom and core integrations (#130025)
* Add new frame helper to clarify options available

* Adjust

* Improve

* Use report_usage in core

* Add tests

* Use is/is not

Co-authored-by: J. Nick Koston <nick@koston.org>

* Use enum.auto()

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-11-07 18:23:35 +01:00
Erik Montnemery
d6ee10a543
Make FlowHandler.context a typed dict (#126291)
* Make FlowHandler.context a typed dict

* Adjust typing

* Adjust typing

* Avoid calling ConfigFlowContext constructor in hot path
2024-10-08 12:18:45 +02:00
Erik Montnemery
3c0be47d3c
Add FlowManager.async_has_matching_flow (#126804)
* Add FlowManager.async_flow_has_matching_flow

* Revert changes from the future

* Apply suggested changes to apple_tv config flow

* Rename methods after discussion

* Update homeassistant/data_entry_flow.py

Co-authored-by: J. Nick Koston <nick@koston.org>

* Move deduplication functions to config_entries, add tests

* Adjust tests

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-09-27 10:51:36 +02:00
J. Nick Koston
af2798f063
Switch genexp to listcomp in async_progress_by_init_data_type (#126405)
Since listcomps are inlined in python 3.12+, the listcomp
will be a bit faster. Additionally we always iterate everything
here so there is no reason to use a genexpr
2024-09-21 19:18:53 -05:00
Erik Montnemery
252ce2c95b
Improve FlowManager.async_finish_flow docstring (#126178)
* Improve FlowManager.async_finish_flow docstring

* Fix typos
2024-09-18 18:19:13 +02:00
Dave T
1e59ce2909
Update deprecation warning for data_entry_flow (#122154) 2024-07-19 09:08:45 +02:00
Marc Mueller
0e52d149e4
Update voluptuous to 0.15.2 (#120631)
* Update voluptuous to 0.15.1

* Fix typing issues

* Add type ignores for json result type

* Update voluptuous to 0.15.2

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-07-02 12:57:09 -07:00
Marc Mueller
d527113d59
Improve schema typing (3) (#120521) 2024-06-26 11:30:07 +02:00
Erik Montnemery
0545ed8082
Section support for data entry flows (#118369)
* Add expandable support for data entry form flows

* Update config_validation.py

* optional options

* Adjust

* Correct translations of data within sections

* Update homeassistant/components/kitchen_sink/config_flow.py

Co-authored-by: Robert Resch <robert@resch.dev>

* Add missing import

* Update tests/components/kitchen_sink/test_config_flow.py

Co-authored-by: Robert Resch <robert@resch.dev>

* Format code

* Match frontend when serializing

* Move section class to data_entry_flow

* Correct serializing

* Fix import in kitchen_sink

* Move and update test

---------

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
Co-authored-by: Robert Resch <robert@resch.dev>
2024-06-25 11:02:00 +02:00
J. Nick Koston
a5644c8ddb
Rewrite flow handler to flow result conversion as a list comp (#118269) 2024-05-27 15:39:59 -10:00
J. Nick Koston
1985a2ad8b
Small speed up to creating flows (#117896)
Use a defaultdict instead of setdefault
2024-05-22 08:16:08 +02:00
Erik Montnemery
b006aadeff
Remove options from FlowResult (#117351) 2024-05-13 10:11:33 +02:00
Sid
2cc916db6d
Replace pylint broad-except with Ruff BLE001 (#116250) 2024-05-07 14:00:27 +02:00
Erik Montnemery
1e72e9e0b2
Add workaround for data entry flow show progress (#116704)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2024-05-04 13:17:21 -05:00
J. Nick Koston
a22c221722
Rename bus._async_fire to bus.async_fire_internal (#116027) 2024-04-23 22:28:31 +02:00
Marc Mueller
1b24e78dd9
Improve FlowHandler menu_options typing (#115296) 2024-04-11 22:14:37 -04:00
Sid
a5b609f081
Enable ruff TRY401 (#114395)
* Enable ruff TRY401

* fix tests
2024-03-29 07:20:36 +01:00
Marc Mueller
24168dfba7
Update mypy-dev to 1.10.0a3 (#114289)
* Update mypy-dev to 1.10.0a3

* Allow TypedDict init from Type
2024-03-27 12:32:29 +01:00
Marc Mueller
19ab3d6daf
Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
Erik Montnemery
82efb3d35b
Make FlowResult a generic type (#111952) 2024-03-07 12:41:14 +01:00
Erik Montnemery
3d3e9900c3
Add TypeVar default for FlowResult (#112345)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2024-03-05 22:52:11 +01:00
Erik Montnemery
3a5e0c14bf
Remove config flow specifics from FlowResult (#111932)
* Remove config flow specifics from FlowResult

* Improve docstring

* Update pylint rules
2024-03-01 13:07:13 +01:00
Erik Montnemery
a0e558c457
Add generic classes BaseFlowHandler and BaseFlowManager (#111814)
* Add generic classes BaseFlowHandler and BaseFlowManager

* Migrate zwave_js

* Update tests

* Update tests

* Address review comments
2024-02-29 16:52:39 +01:00
Erik Montnemery
fc4b18b907
Return FlowResultType.ABORT when violating single_config_entry (#111637)
* Return FlowResultType.ABORT when violating single_config_entry

* Fix translations

* Fix tests
2024-02-27 18:28:19 +01:00
Robert Resch
6fdad44941
Improve invalid error messages in the config flows (#108075) 2024-01-30 12:24:19 +01:00
Erik Montnemery
e90b42d3d0
Fix FlowHandler show progress (#108586) 2024-01-21 22:40:48 +01:00
Erik Montnemery
fb24e086b2
Hide FlowResultType.SHOW_PROGRESS_DONE from frontend (#107799)
* Hide FlowResultType.SHOW_PROGRESS_DONE from frontend

* Update tests
2024-01-16 09:04:27 +01:00
Erik Montnemery
c3e8e931e6
Deprecate passing step_id to FlowHandler methods (#107944) 2024-01-15 09:37:57 +01:00
Erik Montnemery
24c23d7323
Warn if integrations call async_show_progress without passing a task (#107796) 2024-01-13 11:56:05 +01:00
Erik Montnemery
44a6882c39
Make step_id parameter to FlowHandler.async_show_progress optional (#107802)
Drop step_id parameter from FlowHandler.async_show_progress
2024-01-11 21:05:20 +01:00
Erik Montnemery
24cd6a8a52
Improve ergonomics of FlowManager.async_show_progress (#107668)
* Improve ergonomics of FlowManager.async_show_progress

* Don't include progress coroutine in web response

* Unconditionally reset progress task when show_progress finished

* Fix race

* Tweak, add tests

* Address review comments

* Improve error handling

* Allow progress jobs to return anything

* Add comment

* Remove unneeded check

* Change API according to discussion

* Adjust typing
2024-01-11 12:00:12 +01:00
J. Nick Koston
7d18ad6fe7
Reduce discovery flow matching overhead (#107709) 2024-01-10 07:14:18 -10:00
Erik Montnemery
c805ea7b4f
Include deprecated constants in wildcard imports (#107114) 2024-01-05 11:46:45 +01:00
Robert Resch
060172fc24
Deprecate deprecated data entry flow constants (#106229) 2023-12-23 11:25:39 +01:00
J. Nick Koston
0d9a583f4d
Small speed up to data entry flow steps (#105713)
Instead of checking if the flow is completed with
a linear tuple search each time, use a constant
set
2023-12-14 17:32:14 +01:00
Erik Montnemery
6908497c3d
Add minor version to config entries (#105479) 2023-12-12 08:44:35 +01:00
Erik Montnemery
4498c2e8c4
Validate steps in Flowhandler (#102152)
* Validate steps in Flowhandler

* Move validation to FlowManager._async_handle_step

* Fix _raise_if_not_has_step

* Fix config_entries tests

* Fix tests

* Rename

* Add test
2023-10-19 13:34:10 +02:00
Marc Mueller
0b2b486754
Update mypy to 1.6.0 (#101780) 2023-10-11 13:25:11 +02:00
Simon Lamon
a618e8d1cf
Fix loop in progress config flow (#97229)
* Fix data entry flow with multiple steps

* Update a test

* Update description and add a show progress change test

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-10-02 14:15:54 +02:00