From 506e733986cbf4045859a66943166a679e50db09 Mon Sep 17 00:00:00 2001 From: Daniel <49846893+danielbrunt57@users.noreply.github.com> Date: Wed, 18 Dec 2024 03:37:11 -0800 Subject: [PATCH 1/3] Remove leading/trailing spaces in device strings This allows users to enter a space to clear the previous entry and we need to change the string from " " to "". --- custom_components/alexa_media/config_flow.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/custom_components/alexa_media/config_flow.py b/custom_components/alexa_media/config_flow.py index 70997c3e..fe863a08 100644 --- a/custom_components/alexa_media/config_flow.py +++ b/custom_components/alexa_media/config_flow.py @@ -959,6 +959,11 @@ async def async_step_init( if CONF_PUBLIC_URL in self._config_entry.data: if not user_input[CONF_PUBLIC_URL].endswith("/"): user_input[CONF_PUBLIC_URL] = user_input[CONF_PUBLIC_URL] + "/" + """Remove leading/trailing spaces in device strings""" + if CONF_INCLUDE_DEVICES in self._config_entry.data: + user_input[CONF_INCLUDE_DEVICES] = user_input[CONF_INCLUDE_DEVICES].strip() + if CONF_EXCLUDE_DEVICES in self._config_entry.data: + user_input[CONF_EXCLUDE_DEVICES] = user_input[CONF_EXCLUDE_DEVICES].strip() self.hass.config_entries.async_update_entry( self._config_entry, data=user_input, options=self._config_entry.options From a762a8104c03325312af9880641a55df24449514 Mon Sep 17 00:00:00 2001 From: Daniel <49846893+danielbrunt57@users.noreply.github.com> Date: Wed, 18 Dec 2024 03:58:51 -0800 Subject: [PATCH 2/3] Fixed indentation --- custom_components/alexa_media/config_flow.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/custom_components/alexa_media/config_flow.py b/custom_components/alexa_media/config_flow.py index fe863a08..6e327063 100644 --- a/custom_components/alexa_media/config_flow.py +++ b/custom_components/alexa_media/config_flow.py @@ -960,10 +960,10 @@ async def async_step_init( if not user_input[CONF_PUBLIC_URL].endswith("/"): user_input[CONF_PUBLIC_URL] = user_input[CONF_PUBLIC_URL] + "/" """Remove leading/trailing spaces in device strings""" - if CONF_INCLUDE_DEVICES in self._config_entry.data: - user_input[CONF_INCLUDE_DEVICES] = user_input[CONF_INCLUDE_DEVICES].strip() - if CONF_EXCLUDE_DEVICES in self._config_entry.data: - user_input[CONF_EXCLUDE_DEVICES] = user_input[CONF_EXCLUDE_DEVICES].strip() + if CONF_INCLUDE_DEVICES in self._config_entry.data: + user_input[CONF_INCLUDE_DEVICES] = user_input[CONF_INCLUDE_DEVICES].strip() + if CONF_EXCLUDE_DEVICES in self._config_entry.data: + user_input[CONF_EXCLUDE_DEVICES] = user_input[CONF_EXCLUDE_DEVICES].strip() self.hass.config_entries.async_update_entry( self._config_entry, data=user_input, options=self._config_entry.options From 67b51f339bd95a6a362f03e2c120f32b2af4b976 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:59:44 +0000 Subject: [PATCH 3/3] style: auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- custom_components/alexa_media/config_flow.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/custom_components/alexa_media/config_flow.py b/custom_components/alexa_media/config_flow.py index 6e327063..5551ffb1 100644 --- a/custom_components/alexa_media/config_flow.py +++ b/custom_components/alexa_media/config_flow.py @@ -961,9 +961,13 @@ async def async_step_init( user_input[CONF_PUBLIC_URL] = user_input[CONF_PUBLIC_URL] + "/" """Remove leading/trailing spaces in device strings""" if CONF_INCLUDE_DEVICES in self._config_entry.data: - user_input[CONF_INCLUDE_DEVICES] = user_input[CONF_INCLUDE_DEVICES].strip() + user_input[CONF_INCLUDE_DEVICES] = user_input[ + CONF_INCLUDE_DEVICES + ].strip() if CONF_EXCLUDE_DEVICES in self._config_entry.data: - user_input[CONF_EXCLUDE_DEVICES] = user_input[CONF_EXCLUDE_DEVICES].strip() + user_input[CONF_EXCLUDE_DEVICES] = user_input[ + CONF_EXCLUDE_DEVICES + ].strip() self.hass.config_entries.async_update_entry( self._config_entry, data=user_input, options=self._config_entry.options