mirror of
https://github.com/home-assistant/core.git
synced 2025-08-02 20:25:07 +02:00
load locations to prevent 'unknown error occurred'
This commit is contained in:
@@ -4,6 +4,7 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||||
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
|
|
||||||
from .const import CONF_USERCODES, DOMAIN
|
from .const import CONF_USERCODES, DOMAIN
|
||||||
|
|
||||||
@@ -88,6 +89,14 @@ class TotalConnectConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
# Force the loading of locations using I/O
|
||||||
|
number_locations = await self.hass.async_add_executor_job(
|
||||||
|
self.client.get_number_locations,
|
||||||
|
)
|
||||||
|
if number_locations < 1:
|
||||||
|
raise HomeAssistantError(
|
||||||
|
"There are no locations enabled or available for this TotalConnect user."
|
||||||
|
)
|
||||||
for location_id in self.client.locations:
|
for location_id in self.client.locations:
|
||||||
self.usercodes[location_id] = None
|
self.usercodes[location_id] = None
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user