Use common strings for songpal config flow (#35517)
parent
ea9c103fe1
commit
2748dcaaf1
|
@ -64,7 +64,7 @@ class SongpalConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
): str,
|
): str,
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
errors={"base": "connection"},
|
errors={"base": "cannot_connect"},
|
||||||
)
|
)
|
||||||
|
|
||||||
self.conf = SongpalConfig(name, parsed_url.hostname, endpoint)
|
self.conf = SongpalConfig(name, parsed_url.hostname, endpoint)
|
||||||
|
@ -139,7 +139,7 @@ class SongpalConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
name = interface_info.modelName
|
name = interface_info.modelName
|
||||||
except SongpalException as ex:
|
except SongpalException as ex:
|
||||||
_LOGGER.error("Import from yaml configuration failed: %s", ex)
|
_LOGGER.error("Import from yaml configuration failed: %s", ex)
|
||||||
return self.async_abort(reason="connection")
|
return self.async_abort(reason="cannot_connect")
|
||||||
|
|
||||||
self.conf = SongpalConfig(name, parsed_url.hostname, endpoint)
|
self.conf = SongpalConfig(name, parsed_url.hostname, endpoint)
|
||||||
|
|
||||||
|
|
|
@ -5,19 +5,17 @@
|
||||||
"user": {
|
"user": {
|
||||||
"data": {
|
"data": {
|
||||||
"endpoint": "Endpoint"
|
"endpoint": "Endpoint"
|
||||||
},
|
}
|
||||||
"title": "Sony Songpal"
|
|
||||||
},
|
},
|
||||||
"init": {
|
"init": {
|
||||||
"description": "Do you want to set up {name} ({host})?",
|
"description": "Do you want to set up {name} ({host})?"
|
||||||
"title": "Sony Songpal"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"connection": "Connection error: please check your endpoint"
|
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
||||||
},
|
},
|
||||||
"abort": {
|
"abort": {
|
||||||
"already_configured": "Device already configured",
|
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
|
||||||
"not_songpal_device": "Not a Songpal device"
|
"not_songpal_device": "Not a Songpal device"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ async def test_user_invalid(hass):
|
||||||
)
|
)
|
||||||
assert result["type"] == RESULT_TYPE_FORM
|
assert result["type"] == RESULT_TYPE_FORM
|
||||||
assert result["step_id"] == "user"
|
assert result["step_id"] == "user"
|
||||||
assert result["errors"] == {"base": "connection"}
|
assert result["errors"] == {"base": "cannot_connect"}
|
||||||
|
|
||||||
mocked_device.get_supported_methods.assert_called_once()
|
mocked_device.get_supported_methods.assert_called_once()
|
||||||
mocked_device.get_interface_information.assert_not_called()
|
mocked_device.get_interface_information.assert_not_called()
|
||||||
|
@ -223,7 +223,7 @@ async def test_import_invalid(hass):
|
||||||
DOMAIN, context={"source": SOURCE_IMPORT}, data=CONF_DATA
|
DOMAIN, context={"source": SOURCE_IMPORT}, data=CONF_DATA
|
||||||
)
|
)
|
||||||
assert result["type"] == RESULT_TYPE_ABORT
|
assert result["type"] == RESULT_TYPE_ABORT
|
||||||
assert result["reason"] == "connection"
|
assert result["reason"] == "cannot_connect"
|
||||||
|
|
||||||
mocked_device.get_supported_methods.assert_called_once()
|
mocked_device.get_supported_methods.assert_called_once()
|
||||||
mocked_device.get_interface_information.assert_not_called()
|
mocked_device.get_interface_information.assert_not_called()
|
||||||
|
|
Loading…
Reference in New Issue