Introduced abort in config flow if all entities are deselected when editing a device
This commit is contained in:
@@ -570,6 +570,11 @@ class LocalTuyaOptionsFlowHandler(config_entries.OptionsFlow):
|
|||||||
CONF_ENTITIES: [],
|
CONF_ENTITIES: [],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
if len(user_input[CONF_ENTITIES]) == 0:
|
||||||
|
return self.async_abort(
|
||||||
|
reason="no_entities",
|
||||||
|
description_placeholders={},
|
||||||
|
)
|
||||||
if user_input[CONF_ENTITIES]:
|
if user_input[CONF_ENTITIES]:
|
||||||
entity_ids = [
|
entity_ids = [
|
||||||
int(entity.split(":")[0])
|
int(entity.split(":")[0])
|
||||||
|
@@ -33,7 +33,8 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"abort": {
|
"abort": {
|
||||||
"already_configured": "Device has already been configured.",
|
"already_configured": "Device has already been configured.",
|
||||||
"device_success": "Device {dev_name} successfully {action}."
|
"device_success": "Device {dev_name} successfully {action}.",
|
||||||
|
"no_entities": "Cannot remove all entities from a device.\nIf you want to delete a device, enter it in the Devices menu, click the 3 dots in the 'Device info' frame, and press the Delete button."
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"authentication_failed": "Failed to authenticate.\n{msg}",
|
"authentication_failed": "Failed to authenticate.\n{msg}",
|
||||||
|
Reference in New Issue
Block a user