From 2189dc3e2abc158c56a6f2603d364bec3183f252 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Tue, 27 May 2025 12:33:02 +0200 Subject: [PATCH] Use string type for amazon devices OTP code (#145698) --- homeassistant/components/amazon_devices/config_flow.py | 2 +- tests/components/amazon_devices/const.py | 2 +- tests/components/amazon_devices/test_config_flow.py | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/amazon_devices/config_flow.py b/homeassistant/components/amazon_devices/config_flow.py index 5566c16602b..d0c3d067cee 100644 --- a/homeassistant/components/amazon_devices/config_flow.py +++ b/homeassistant/components/amazon_devices/config_flow.py @@ -57,7 +57,7 @@ class AmazonDevicesConfigFlow(ConfigFlow, domain=DOMAIN): ): CountrySelector(), vol.Required(CONF_USERNAME): cv.string, vol.Required(CONF_PASSWORD): cv.string, - vol.Required(CONF_CODE): cv.positive_int, + vol.Required(CONF_CODE): cv.string, } ), ) diff --git a/tests/components/amazon_devices/const.py b/tests/components/amazon_devices/const.py index 94b5b7052e6..a2600ba98a6 100644 --- a/tests/components/amazon_devices/const.py +++ b/tests/components/amazon_devices/const.py @@ -1,6 +1,6 @@ """Amazon Devices tests const.""" -TEST_CODE = 123123 +TEST_CODE = "023123" TEST_COUNTRY = "IT" TEST_PASSWORD = "fake_password" TEST_SERIAL_NUMBER = "echo_test_serial_number" diff --git a/tests/components/amazon_devices/test_config_flow.py b/tests/components/amazon_devices/test_config_flow.py index 68ab7f4ffa6..41b65c33bd5 100644 --- a/tests/components/amazon_devices/test_config_flow.py +++ b/tests/components/amazon_devices/test_config_flow.py @@ -56,6 +56,7 @@ async def test_full_flow( }, } assert result["result"].unique_id == TEST_USERNAME + mock_amazon_devices_client.login_mode_interactive.assert_called_once_with("023123") @pytest.mark.parametrize(