Add missing config flow abort strings (#86180)

* Add missing `already_configured` and `already_in_progress` abort strings

* Note required strings.json entries in config_entries aborting functions
This commit is contained in:
Ville Skyttä 2023-01-24 08:59:32 +02:00 committed by GitHub
parent 3ec7f0280e
commit 5f0adfe6e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 112 additions and 2 deletions

View File

@ -10,6 +10,9 @@
} }
} }
}, },
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]"
},
"error": { "error": {
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]" "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
} }

View File

@ -1,5 +1,8 @@
{ {
"config": { "config": {
"abort": {
"already_configured": "Service is already configured"
},
"error": { "error": {
"cannot_connect": "Failed to connect" "cannot_connect": "Failed to connect"
}, },

View File

@ -22,6 +22,9 @@
} }
} }
}, },
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]"
},
"error": { "error": {
"invalid_resolver": "Invalid IP address for resolver" "invalid_resolver": "Invalid IP address for resolver"
} }

View File

@ -14,6 +14,9 @@
} }
}, },
"options": { "options": {
"abort": {
"already_configured": "Service is already configured"
},
"error": { "error": {
"invalid_resolver": "Invalid IP address for resolver" "invalid_resolver": "Invalid IP address for resolver"
}, },

View File

@ -12,6 +12,9 @@
} }
} }
}, },
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]"
},
"error": { "error": {
"bad_station_id": "Station ID is invalid, missing, or not found in the station ID database", "bad_station_id": "Station ID is invalid, missing, or not found in the station ID database",
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",

View File

@ -1,5 +1,8 @@
{ {
"config": { "config": {
"abort": {
"already_configured": "Service is already configured"
},
"error": { "error": {
"bad_station_id": "Station ID is invalid, missing, or not found in the station ID database", "bad_station_id": "Station ID is invalid, missing, or not found in the station ID database",
"cannot_connect": "Failed to connect", "cannot_connect": "Failed to connect",

View File

@ -8,6 +8,9 @@
} }
} }
}, },
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
},
"error": { "error": {
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"powered_off": "Is projector turned on? You need to turn on projector for initial configuration." "powered_off": "Is projector turned on? You need to turn on projector for initial configuration."

View File

@ -1,5 +1,8 @@
{ {
"config": { "config": {
"abort": {
"already_configured": "Device is already configured"
},
"error": { "error": {
"cannot_connect": "Failed to connect", "cannot_connect": "Failed to connect",
"powered_off": "Is projector turned on? You need to turn on projector for initial configuration." "powered_off": "Is projector turned on? You need to turn on projector for initial configuration."

View File

@ -1,6 +1,7 @@
{ {
"config": { "config": {
"abort": { "abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
"no_plants": "No plants have been found on this account" "no_plants": "No plants have been found on this account"
}, },
"error": { "error": {

View File

@ -1,6 +1,7 @@
{ {
"config": { "config": {
"abort": { "abort": {
"already_configured": "Device is already configured",
"no_plants": "No plants have been found on this account" "no_plants": "No plants have been found on this account"
}, },
"error": { "error": {

View File

@ -1,5 +1,8 @@
{ {
"config": { "config": {
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]"
},
"error": { "error": {
"invalid_credentials": "[%key:common::config_flow::error::invalid_auth%]", "invalid_credentials": "[%key:common::config_flow::error::invalid_auth%]",
"unknown": "[%key:common::config_flow::error::unknown%]" "unknown": "[%key:common::config_flow::error::unknown%]"

View File

@ -1,5 +1,8 @@
{ {
"config": { "config": {
"abort": {
"already_configured": "Account is already configured"
},
"error": { "error": {
"invalid_credentials": "Invalid authentication", "invalid_credentials": "Invalid authentication",
"unknown": "Unexpected error" "unknown": "Unexpected error"

View File

@ -1,6 +1,8 @@
{ {
"config": { "config": {
"abort": { "abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
"already_in_progress": "[%key:common::config_flow::abort::already_in_progress%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]", "reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
"unsupported_device": "Unsupported device" "unsupported_device": "Unsupported device"
}, },

View File

@ -1,6 +1,8 @@
{ {
"config": { "config": {
"abort": { "abort": {
"already_configured": "Device is already configured",
"already_in_progress": "Configuration flow is already in progress",
"reauth_successful": "Re-authentication was successful", "reauth_successful": "Re-authentication was successful",
"unsupported_device": "Unsupported device" "unsupported_device": "Unsupported device"
}, },

View File

@ -15,6 +15,7 @@
"unknown": "[%key:common::config_flow::error::unknown%]" "unknown": "[%key:common::config_flow::error::unknown%]"
}, },
"abort": { "abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]" "single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]"
} }
} }

View File

@ -1,6 +1,7 @@
{ {
"config": { "config": {
"abort": { "abort": {
"already_configured": "Account is already configured",
"single_instance_allowed": "Already configured. Only a single configuration possible." "single_instance_allowed": "Already configured. Only a single configuration possible."
}, },
"error": { "error": {

View File

@ -19,6 +19,7 @@
"unknown": "[%key:common::config_flow::error::unknown%]" "unknown": "[%key:common::config_flow::error::unknown%]"
}, },
"abort": { "abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]" "single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]"
} }
} }

View File

@ -1,6 +1,7 @@
{ {
"config": { "config": {
"abort": { "abort": {
"already_configured": "Account is already configured",
"single_instance_allowed": "Already configured. Only a single configuration possible." "single_instance_allowed": "Already configured. Only a single configuration possible."
}, },
"error": { "error": {

View File

@ -18,6 +18,9 @@
} }
} }
}, },
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]"
},
"error": { "error": {
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]", "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"unknown_auth_error": "[%key:common::config_flow::error::unknown%]", "unknown_auth_error": "[%key:common::config_flow::error::unknown%]",

View File

@ -1,5 +1,8 @@
{ {
"config": { "config": {
"abort": {
"already_configured": "Account is already configured"
},
"error": { "error": {
"invalid_auth": "Invalid authentication", "invalid_auth": "Invalid authentication",
"service_unavailable_error": "The API is currently unavailable, please try again later.", "service_unavailable_error": "The API is currently unavailable, please try again later.",

View File

@ -1,6 +1,7 @@
{ {
"config": { "config": {
"abort": { "abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
"no_devices_found": "There aren't any Melnor Bluetooth devices nearby." "no_devices_found": "There aren't any Melnor Bluetooth devices nearby."
}, },
"step": { "step": {

View File

@ -1,6 +1,7 @@
{ {
"config": { "config": {
"abort": { "abort": {
"already_configured": "Device is already configured",
"no_devices_found": "There aren't any Melnor Bluetooth devices nearby." "no_devices_found": "There aren't any Melnor Bluetooth devices nearby."
}, },
"step": { "step": {

View File

@ -22,6 +22,7 @@
"unknown": "[%key:common::config_flow::error::unknown%]" "unknown": "[%key:common::config_flow::error::unknown%]"
}, },
"abort": { "abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]" "reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
} }
} }

View File

@ -1,6 +1,7 @@
{ {
"config": { "config": {
"abort": { "abort": {
"already_configured": "Device is already configured",
"reauth_successful": "Re-authentication was successful" "reauth_successful": "Re-authentication was successful"
}, },
"error": { "error": {

View File

@ -14,6 +14,7 @@
"unknown": "[%key:common::config_flow::error::unknown%]" "unknown": "[%key:common::config_flow::error::unknown%]"
}, },
"abort": { "abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]" "single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]"
} }
}, },

View File

@ -1,6 +1,7 @@
{ {
"config": { "config": {
"abort": { "abort": {
"already_configured": "Account is already configured",
"single_instance_allowed": "Already configured. Only a single configuration possible." "single_instance_allowed": "Already configured. Only a single configuration possible."
}, },
"error": { "error": {

View File

@ -7,6 +7,9 @@
"zone": "Zone" "zone": "Zone"
} }
} }
},
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]"
} }
} }
} }

View File

@ -1,5 +1,8 @@
{ {
"config": { "config": {
"abort": {
"already_configured": "Service is already configured"
},
"step": { "step": {
"user": { "user": {
"data": { "data": {

View File

@ -20,6 +20,7 @@
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]" "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]"
}, },
"abort": { "abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]" "reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
} }
} }

View File

@ -1,6 +1,7 @@
{ {
"config": { "config": {
"abort": { "abort": {
"already_configured": "Device is already configured",
"reauth_successful": "Re-authentication was successful" "reauth_successful": "Re-authentication was successful"
}, },
"error": { "error": {

View File

@ -10,6 +10,9 @@
} }
} }
}, },
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
},
"error": { "error": {
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"timeout_connect": "[%key:common::config_flow::error::timeout_connect%]" "timeout_connect": "[%key:common::config_flow::error::timeout_connect%]"

View File

@ -1,5 +1,8 @@
{ {
"config": { "config": {
"abort": {
"already_configured": "Device is already configured"
},
"error": { "error": {
"cannot_connect": "Failed to connect", "cannot_connect": "Failed to connect",
"timeout_connect": "Timeout establishing connection" "timeout_connect": "Timeout establishing connection"

View File

@ -7,6 +7,9 @@
} }
} }
}, },
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]"
},
"error": { "error": {
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"unknown_license_plate": "Unknown license plate" "unknown_license_plate": "Unknown license plate"

View File

@ -1,5 +1,8 @@
{ {
"config": { "config": {
"abort": {
"already_configured": "Service is already configured"
},
"error": { "error": {
"cannot_connect": "Failed to connect", "cannot_connect": "Failed to connect",
"unknown_license_plate": "Unknown license plate" "unknown_license_plate": "Unknown license plate"

View File

@ -24,6 +24,9 @@
"title": "Add another account to the current port." "title": "Add another account to the current port."
} }
}, },
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
},
"error": { "error": {
"invalid_key_format": "The key is not a hex value, please use only 0-9 and A-F.", "invalid_key_format": "The key is not a hex value, please use only 0-9 and A-F.",
"invalid_key_length": "The key is not the right length, it has to be 16, 24 or 32 hex characters.", "invalid_key_length": "The key is not the right length, it has to be 16, 24 or 32 hex characters.",

View File

@ -1,5 +1,8 @@
{ {
"config": { "config": {
"abort": {
"already_configured": "Device is already configured"
},
"error": { "error": {
"invalid_account_format": "The account is not a hex value, please use only 0-9 and A-F.", "invalid_account_format": "The account is not a hex value, please use only 0-9 and A-F.",
"invalid_account_length": "The account is not the right length, it has to be between 3 and 16 characters.", "invalid_account_length": "The account is not the right length, it has to be between 3 and 16 characters.",

View File

@ -9,6 +9,9 @@
} }
} }
}, },
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
},
"error": { "error": {
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"unknown": "[%key:common::config_flow::error::unknown%]" "unknown": "[%key:common::config_flow::error::unknown%]"

View File

@ -1,5 +1,8 @@
{ {
"config": { "config": {
"abort": {
"already_configured": "Device is already configured"
},
"error": { "error": {
"cannot_connect": "Failed to connect", "cannot_connect": "Failed to connect",
"unknown": "Unexpected error" "unknown": "Unexpected error"

View File

@ -20,6 +20,7 @@
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]" "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]"
}, },
"abort": { "abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]" "reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
} }
} }

View File

@ -1,6 +1,7 @@
{ {
"config": { "config": {
"abort": { "abort": {
"already_configured": "Service is already configured",
"reauth_successful": "Re-authentication was successful" "reauth_successful": "Re-authentication was successful"
}, },
"error": { "error": {

View File

@ -10,6 +10,9 @@
} }
} }
}, },
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]"
},
"error": { "error": {
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"invalid_api_key": "[%key:common::config_flow::error::invalid_api_key%]", "invalid_api_key": "[%key:common::config_flow::error::invalid_api_key%]",

View File

@ -1,5 +1,8 @@
{ {
"config": { "config": {
"abort": {
"already_configured": "Service is already configured"
},
"error": { "error": {
"cannot_connect": "Failed to connect", "cannot_connect": "Failed to connect",
"invalid_api_key": "Invalid API key", "invalid_api_key": "Invalid API key",

View File

@ -1,6 +1,7 @@
{ {
"config": { "config": {
"abort": { "abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
"cannot_connect": "Could not connect to controller with URL {base_url}" "cannot_connect": "Could not connect to controller with URL {base_url}"
}, },
"step": { "step": {

View File

@ -1,6 +1,7 @@
{ {
"config": { "config": {
"abort": { "abort": {
"already_configured": "Device is already configured",
"cannot_connect": "Could not connect to controller with URL {base_url}" "cannot_connect": "Could not connect to controller with URL {base_url}"
}, },
"step": { "step": {

View File

@ -8,6 +8,9 @@
} }
} }
}, },
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]"
},
"error": { "error": {
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]", "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",

View File

@ -1,5 +1,8 @@
{ {
"config": { "config": {
"abort": {
"already_configured": "Account is already configured"
},
"error": { "error": {
"cannot_connect": "Failed to connect", "cannot_connect": "Failed to connect",
"invalid_auth": "Invalid authentication", "invalid_auth": "Invalid authentication",

View File

@ -1455,7 +1455,10 @@ class ConfigFlow(data_entry_flow.FlowHandler):
def _async_abort_entries_match( def _async_abort_entries_match(
self, match_dict: dict[str, Any] | None = None self, match_dict: dict[str, Any] | None = None
) -> None: ) -> None:
"""Abort if current entries match all data.""" """Abort if current entries match all data.
Requires `already_configured` in strings.json in user visible flows.
"""
if match_dict is None: if match_dict is None:
match_dict = {} # Match any entry match_dict = {} # Match any entry
for entry in self._async_current_entries(include_ignore=False): for entry in self._async_current_entries(include_ignore=False):
@ -1477,7 +1480,11 @@ class ConfigFlow(data_entry_flow.FlowHandler):
*, *,
error: str = "already_configured", error: str = "already_configured",
) -> None: ) -> None:
"""Abort if the unique ID is already configured.""" """Abort if the unique ID is already configured.
Requires strings.json entry corresponding to the `error` parameter
in user visible flows.
"""
if self.unique_id is None: if self.unique_id is None:
return return
@ -1619,6 +1626,9 @@ class ConfigFlow(data_entry_flow.FlowHandler):
when the handler has no existing config entries. when the handler has no existing config entries.
It ensures that the discovery can be ignored by the user. It ensures that the discovery can be ignored by the user.
Requires `already_configured` and `already_in_progress` in strings.json
in user visible flows.
""" """
if self.unique_id is not None: if self.unique_id is not None:
return return