Commit Graph

150 Commits

Author SHA1 Message Date
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
J. Nick Koston
d675825b5a Avoid double lookups with data_entry_flow indices (#100627) 2023-09-20 11:55:51 +02:00
Erik Montnemery
d282ba6bac Use a single WS command for group preview (#98903)
* Use a single WS command for group preview

* Fix tests
2023-08-24 11:59:24 +02:00
Erik Montnemery
b885dfa5a8 Add preview to sensor group config and option flows (#83638) 2023-08-22 10:29:16 +02:00
Franck Nijhof
30058297cf Migrate backported StrEnum to built-in StrEnum (#97101) 2023-07-23 23:19:24 +02:00
Marc Mueller
77f38e33e5 Import names from typing instead of typing_extensions [3.11] (#97065) 2023-07-22 17:03:44 -05:00
J. Nick Koston
9e666ae0c0 Reduce in progress flow matching overhead (#94403)
* Reduce config flow matching overhead

Much of the config flow matching is happening on the context data
after converting via a series of functions. Avoid the conversions
by passing the context matcher deeper into the stack so only
relvant entries need to be processed.

The goal is to reduce the overhead and reduce the chance
the event loop falls behind at the started event when
all the discoveries are processed

* Reduce config flow matching overhead

Much of the config flow matching is happening on the context data
after converting via a series of functions. Avoid the conversions
by passing the context matcher deeper into the stack so only
relvant entries need to be processed.

The goal is to reduce the overhead and reduce the chance
the event loop falls behind at the started event when
all the discoveries are processed

* Reduce config flow matching overhead

Much of the config flow matching is happening on the context data
after converting via a series of functions. Avoid the conversions
by passing the context matcher deeper into the stack so only
relvant entries need to be processed.

The goal is to reduce the overhead and reduce the chance
the event loop falls behind at the started event when
all the discoveries are processed

* augment cover
2023-06-11 10:41:38 +02:00
J. Nick Koston
0cc9b2e803 Use slots for discovery dataclasses (#90751) 2023-04-04 12:44:59 +02:00
J. Nick Koston
331102e592 Dismiss discoveries when the underlying device disappears (#88340)
* Implement discovery removals

Bluetooth, HomeKit, SSDP, and Zeroconf now implement
dismissing discoveries when the underlying discovered
device disappears

* cover

* add zeroconf test

* cover

* cover bluetooth

* fix rediscover
2023-02-17 15:51:19 -05:00
Erik Montnemery
3cd6bd87a7 Remove config entry specifics from FlowManager (#85565) 2023-01-17 15:26:17 +01:00
epenet
13cfd60019 Allow None in add_suggested_values_to_schema (#85763) 2023-01-16 11:36:21 +01:00
Franck Nijhof
64c2340fab Core code styling improvements (#85963) 2023-01-15 23:00:51 +01:00
Franck Nijhof
bcf32f8331 Mark required fields in FlowResult typedict (#84811)
* Mark required fields in FlowResult typedict

* Remove unneeded asserts from tests
2022-12-30 12:01:45 +01:00
Franck Nijhof
b0cee0bc46 String formatting and max line length - Part 1 (#84390)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-12-22 10:12:50 +01:00
Erik Montnemery
bf4c399b19 Improve data entry flow typing (#84030) 2022-12-15 12:41:20 +01:00
Erik Montnemery
033a16b67e Improve data entry flow typing (#83901) 2022-12-15 08:45:54 +01:00
Erik Montnemery
cc132bfad6 Make it optional to provide a title when finishing a FlowHandler (#83534)
* Make it optional to provide a title when finishing a FlowHandler

* Make ConfigEntry.title a str

* Revert changes in ConfigFlow

* Adjust tests
2022-12-09 10:24:08 +01:00
epenet
724a79a8e8 Add suggested_value helper for FlowHandler (#82491)
* Add suggested_value helper for ConfigFlow

* Move helper function to FlowHandler

* Rename and adjust docstring

* Fix rebase
2022-11-29 10:16:01 +01:00
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