Skip to content

Commit 9b4d209

Browse files
authored
Add translated reasons to Govee Light Local setup failures (home-assistant#163576)
1 parent 99ca425 commit 9b4d209

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

homeassistant/components/govee_light_local/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from homeassistant.core import HomeAssistant
1616
from homeassistant.exceptions import ConfigEntryNotReady
1717

18-
from .const import DISCOVERY_TIMEOUT
18+
from .const import DISCOVERY_TIMEOUT, DOMAIN
1919
from .coordinator import GoveeLocalApiCoordinator, GoveeLocalConfigEntry
2020

2121
PLATFORMS: list[Platform] = [Platform.LIGHT]
@@ -52,7 +52,11 @@ async def await_cleanup():
5252
_LOGGER.error("Start failed, errno: %d", ex.errno)
5353
return False
5454
_LOGGER.error("Port %s already in use", LISTENING_PORT)
55-
raise ConfigEntryNotReady from ex
55+
raise ConfigEntryNotReady(
56+
translation_domain=DOMAIN,
57+
translation_key="port_in_use",
58+
translation_placeholders={"port": LISTENING_PORT},
59+
) from ex
5660

5761
await coordinator.async_config_entry_first_refresh()
5862

@@ -61,7 +65,9 @@ async def await_cleanup():
6165
while not coordinator.devices:
6266
await asyncio.sleep(delay=1)
6367
except TimeoutError as ex:
64-
raise ConfigEntryNotReady from ex
68+
raise ConfigEntryNotReady(
69+
translation_domain=DOMAIN, translation_key="no_devices_found"
70+
) from ex
6571

6672
entry.runtime_data = coordinator
6773
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

homeassistant/components/govee_light_local/strings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,13 @@
3333
}
3434
}
3535
}
36+
},
37+
"exceptions": {
38+
"no_devices_found": {
39+
"message": "[%key:common::config_flow::abort::no_devices_found%]"
40+
},
41+
"port_in_use": {
42+
"message": "Port {port} is already in use"
43+
}
3644
}
3745
}

0 commit comments

Comments
 (0)