From 85f2e259daf10ee2758f74ebcfc6c475c2d45043 Mon Sep 17 00:00:00 2001 From: Steffen Zimmermann Date: Wed, 29 Dec 2021 14:34:47 +0100 Subject: [PATCH] Add unique id check in wiffi config flow (#60388) Co-authored-by: Franck Nijhof --- homeassistant/components/wiffi/config_flow.py | 2 ++ homeassistant/components/wiffi/strings.json | 1 + homeassistant/components/wiffi/translations/en.json | 1 + 3 files changed, 4 insertions(+) diff --git a/homeassistant/components/wiffi/config_flow.py b/homeassistant/components/wiffi/config_flow.py index f9456f25df2..79f26d82585 100644 --- a/homeassistant/components/wiffi/config_flow.py +++ b/homeassistant/components/wiffi/config_flow.py @@ -38,6 +38,8 @@ class WiffiFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): return self._async_show_form() # received input from form or configuration.yaml + await self.async_set_unique_id(user_input[CONF_PORT]) + self._abort_if_unique_id_configured() try: # try to start server to check whether port is in use diff --git a/homeassistant/components/wiffi/strings.json b/homeassistant/components/wiffi/strings.json index d4dc66972c7..ebc5dd67a20 100644 --- a/homeassistant/components/wiffi/strings.json +++ b/homeassistant/components/wiffi/strings.json @@ -10,6 +10,7 @@ }, "abort": { "addr_in_use": "Server port already in use.", + "already_configured": "Server port is already configured.", "start_server_failed": "Start server failed." } }, diff --git a/homeassistant/components/wiffi/translations/en.json b/homeassistant/components/wiffi/translations/en.json index 046f37de2c7..6732e5102da 100644 --- a/homeassistant/components/wiffi/translations/en.json +++ b/homeassistant/components/wiffi/translations/en.json @@ -2,6 +2,7 @@ "config": { "abort": { "addr_in_use": "Server port already in use.", + "already_configured": "Server port is already configured.", "start_server_failed": "Start server failed." }, "step": {