480 Commits

Author SHA1 Message Date
epenet
353ccf3ea7
Only apply OptionsFlowWithConfigEntry deprecation to core (#130054)
* Only apply OptionsFlowWithConfigEntry deprecation to core

* Fix match string in pytest.raises

* Improve coverage
2024-11-08 15:55:19 +01:00
Erik Montnemery
2b7d593ebe
Avoid collision when replacing existing config entry with same unique id (#130062) 2024-11-08 07:45:16 +01:00
Erik Montnemery
536e686892
Don't create repairs asking user to remove duplicate flipr config entries (#130058)
* Don't create repairs asking user to remove duplicate flipr config entries

* Improve comments
2024-11-07 17:38:10 +01:00
Erik Montnemery
c5e3ba536c
Don't create repairs asking user to remove duplicate ignored config entries (#130056) 2024-11-07 17:07:23 +01:00
epenet
03d5b18974
Remove options property from OptionFlow (#129890)
* Remove options property from OptionFlow

* Update test_config_entries.py

* Partial revert of "Remove deprecated property setters in option flows (#129773)"

* Partial revert "Use new helper properties in crownstone options flow (#129774)"

* Restore onewire init

* Restore onvif

* Restore roborock

* Use deepcopy in onewire

* Restore steam_online

* Restore initial options property in OptionsFlowWithConfigEntry

* re-add options property in SchemaOptionsFlowHandler

* Restore test

* Cleanup
2024-11-06 23:28:01 +01:00
epenet
79901cede9
Drop initialize_options helper from OptionsFlow (#129870) 2024-11-05 12:02:33 +01:00
epenet
d180ff417d
Cleanup deprecated OptionsFlowWithConfigEntry (part 3) (#129756) 2024-11-04 18:55:01 +01:00
Erik Montnemery
4ac35d40cd
Fix create flow logic for single config entry integrations (#129807)
* Fix create flow logic for single config entry integrations

* Adjust MQTT test
2024-11-04 15:45:29 +01:00
Erik Montnemery
4784199038
Fix aborting flows for single config entry integrations (#129805) 2024-11-04 13:59:10 +01:00
epenet
89eb395e2d
Add OptionsFlow helper for a mutable copy of the config entry options (#129718)
* Add OptionsFlow helper for a mutable copy of the config entry options

* Add tests

* Improve coverage

* error_if_core=False

* Adjust report

* Avoid mutli-line ternary
2024-11-03 20:37:58 +01:00
epenet
ab5b9dbdc9
Add OptionsFlow helpers to get the current config entry (#129562)
* Add OptionsFlow helpers to get the current config entry

* Add tests

* Improve

* Add ValueError to indicate that the config entry is not available in `__init__` method

* Use a property

* Update config_entries.py

* Update config_entries.py

* Update config_entries.py

* Add a property setter for compatibility

* Add report

* Update config_flow.py

* Add tests

* Update test_config_entries.py
2024-11-01 12:54:35 +01:00
epenet
b626c9b450
Ensure entry_id is set on reauth/reconfigure flows (#129319)
* Ensure entry_id is set on reauth/reconfigure flows

* Improve

* Improve

* Use report helper

* Adjust deprecation date

* Update config_entries.py

* Improve message and adjust tests

* Apply suggestions from code review

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

---------

Co-authored-by: G Johansson <goran.johansson@shiftit.se>
2024-11-01 10:29:58 +01:00
epenet
696efe349e
Log type as well as value for unique_id checks (#129575) 2024-10-31 15:10:27 +01:00
G Johansson
a4f210379d
Raise on non-string unique id for config entry (#125950)
* Raise on non-string unique id for config entry

* Add test update entry

* Fix breaking

* Add check get_entry_by_domain_and_unique_id

* Naming

* Add test

* Fix logic

* No unique id

* Fix tests

* Fixes

* Fix gardena

* Not related to this PR

* Update docstring and comment

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-10-30 18:09:50 +01:00
G Johansson
3db6d82904
Add name to description placeholders automatically for reauth flows (#129232)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-10-30 17:38:59 +01:00
Robert Resch
380974eed4
Remove hassio from ALLOWED_USED_COMPONENTS and move some functions to helper (#127228)
* Remove hassio from ALLOWED_USED_COMPONENTS

* Move HassioServiceInfo to helpers.service_info

* Deprecate moved functions

* Add note about deprecation

* Fix tests

* Implement suggestion

* Typo

* Update pyproject.toml

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

---------

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2024-10-30 12:43:41 +01:00
Erik Montnemery
da11a72b4c
Create repair asking user to remove duplicate config entries (#127948)
Co-authored-by: Joostlek <joostlek@outlook.com>
2024-10-29 13:10:56 +01:00
epenet
5674c1d82f
Use reauth helpers in google_mail (#128584) 2024-10-18 09:04:55 +02:00
epenet
350a27575f
Prevent leak of current_entry context variable (#128145) 2024-10-16 18:02:37 +02:00
epenet
0e7297873c
Add SOURCE_HASSIO to DISCOVERY_SOURCES (#128454) 2024-10-16 13:34:28 +02:00
epenet
8ae8fa7ec9
Add SOURCE_SYSTEM to DISCOVERY_SOURCES (#128457) 2024-10-16 11:27:48 +02:00
epenet
99eb466223
Add updates argument to update_reload_and_abort helper (#127781)
* Add updates argument to update_reload_and_abort helper

* Also apply to airvisual_pro

* Rename argument

* docstring

* Use modern syntax

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Apply suggestion

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Apply suggestion

* Docstring

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-10-09 07:47:18 +02:00
epenet
5836a85340
Prevent async_create_entry from reauth/reconfigure flows (#127527)
* Prevent `async_create_entry` from reauth/reconfigure flows

* Adjust message

* Don't raise just yet

* Adjust message

* Fix string

* Remove invalid comment

* Add parameter

* Use count parameter

* Remove another branching
2024-10-08 15:19:58 +02:00
Erik Montnemery
0c0ff855b1
Warn when async_update_entry creates a unique_id collision (#127929) 2024-10-08 14:42:41 +02:00
epenet
4478f64002
Remove dead reconfigure code (#127398)
* Remove dead reconfigure code

* Adjust

* Start cleaning up test

* Prevent duplicate flows

* Add missing string

* Adjust two more tests

* Only filter out reauth flows

* Update strings.json

* Update config_entries.py

* Adjust tests

* Remove all checks - but add comment in tests

* Simplify PR
2024-10-08 13:35:04 +02: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
epenet
2c664efb3c
Add new helper for matching reauth/reconfigure config flows (#127565) 2024-10-08 10:07:36 +02:00
epenet
c87a2ca335
Add default reconfigure reason in update_reload_and_abort (#127756)
* Add default reconfigure reason in async_update_reload_and_abort

* Simplify

* Fix test

* Add sample usage

* Remove multi-line ternary
2024-10-07 09:02:58 +02:00
J. Nick Koston
10c033e580
Migrate config_entries to use propcache cached_property (#127495) 2024-10-03 22:28:00 +02:00
Erik Montnemery
48a07d531c
Remove assumption in ConfigEntryItems about unique unique_id (#127399) 2024-10-03 22:27:15 +02:00
J. Nick Koston
e2b1ef053f
Cache serialization of config entry storage (#127435) 2024-10-03 19:51:09 +02:00
epenet
21266e1c68
Add config_flow helper to get reauth/reconfigure config entry (#127115)
* Add config_flow helper to get config entry from context

* Simplify

* Apply to aussie_broadband

* Another example

* Rename and adjust docstring

* Simplify

* Add test

* Refactor to hide context

* Raise

* Improve coverage

* Use AttributeError

* Use ValueError

* Raise UnknownEntry
2024-10-02 12:00:07 +02:00
Erik Montnemery
59a690f214
Use ConfigFlow.has_matching_flow to deduplicate homekit_controller flows (#126894) 2024-09-27 13:41:55 +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
Erik Montnemery
7d61cb1ef5
Remove unignore flow (#126765) 2024-09-25 20:29:14 +02:00
Erik Montnemery
589910b49b
Reinitialize zeroconf discovery flow on config entry removal (#126595) 2024-09-24 13:37:28 +02:00
Erik Montnemery
4a66395d51
Simplify signal_discovered_config_entry_removed job (#126591) 2024-09-24 08:44:11 +02:00
Erik Montnemery
d82bff1bc2
Index config entry discovery_keys by discovery domain (#126563)
* Index config entry discovery_keys by discovery domain

* Add new signal

* Update tests

* Update homeassistant/config_entries.py

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

* Fix imports

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-09-23 21:48:11 +02:00
Erik Montnemery
b2982c18bb
Reinitialize zeroconf discovery flow on unignore (#125753)
* Reinitialize zeroconf discovery flow on unignore

* Adjust tests

* Improve comments

* Fix logic for updating discovery keys

* Add tests

* Use mock_config_flow helper in new config_entries test

* Add discovery_keys attribute to ConfigEntry

* Update zeroconf rediscovery

* Change type of ConfigEntry.discovery_keys

* Update tests

* Fix DiscoveryKey.from_json_dict and add tests

* Fix test

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-09-23 16:49:21 +02: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
epenet
3536ba43f5
End deprecation setting disabled_by as string (#125646) 2024-09-10 20:39:51 +02:00
epenet
97c55ae6f1
Warn on non-string config entry unique IDs (#125662)
* Warn on non-string config entry unique IDs

* Add comment

* isinstance
2024-09-10 15:30:03 +02:00
G Johansson
436ac72b82
End deprecation setting attributes directly on config entry (#123729)
* End deprecation setting attr directly on config entry

* Update ollama test

* Fix android_tv
2024-09-03 15:56:00 +02:00
Erik Montnemery
9cae786f40
Add ConfigEntries.async_get_loaded (#124705) 2024-08-27 14:20:57 +02:00
J. Nick Koston
91951ed734
Speed up initializing config flows (#124015) 2024-08-16 16:48:03 -05:00
J. Nick Koston
b6de2cd741
Unpack non-performant any expressions in config flow discovery path (#123124) 2024-08-03 17:33:46 -05:00
Robert Resch
ad50136dbd
Add created_at/modified_at to config entries (#122456) 2024-07-29 22:08:46 +02:00
epenet
07c7bb8b2a
Use HOMEASSISTANT_DOMAIN alias for core DOMAIN (#122760) 2024-07-29 13:35:36 +02:00
Marc Mueller
ca55986057
Import Generator from collections.abc (1) (#120914) 2024-07-01 11:51:51 +02:00
Erik Montnemery
471e2a17a2
Improve error messages when config entry is in wrong state (#119591)
* Improve error messages when config entry is in wrong state

* Apply suggestions from code review

Co-authored-by: Joakim Sørensen <ludeeus@ludeeus.dev>

* Adjust tests

---------

Co-authored-by: Joakim Sørensen <ludeeus@ludeeus.dev>
2024-06-14 08:00:36 +02:00