Skip to content

Commit

Permalink
Config flow: when testing connection, only pause/resume active devices
Browse files Browse the repository at this point in the history
Issue #2288
  • Loading branch information
make-all committed Sep 10, 2024
1 parent d253c66 commit 0c641e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/tuya_local/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ def create_test_device(hass: HomeAssistant, config: dict):
async def async_test_connection(config: dict, hass: HomeAssistant):
domain_data = hass.data.get(DOMAIN)
existing = domain_data.get(get_device_id(config)) if domain_data else None
if existing:
if existing and existing.get("device"):
_LOGGER.info("Pausing existing device to test new connection parameters")
existing["device"].pause()
await asyncio.sleep(5)
Expand All @@ -634,7 +634,7 @@ async def async_test_connection(config: dict, hass: HomeAssistant):
_LOGGER.warning("Connection test failed with %s %s", type(e), e)
retval = None

if existing:
if existing and existing.get("device"):
_LOGGER.info("Restarting device after test")
existing["device"].resume()

Expand Down

0 comments on commit 0c641e8

Please sign in to comment.