1
0
mirror of https://github.com/natekspencer/hacs-oasis_mini.git synced 2025-11-18 01:53:41 -05:00
This commit is contained in:
Nathan Spencer
2024-07-08 23:58:14 -06:00
parent 33faf66109
commit 10fcfb8a9f
12 changed files with 1019 additions and 56 deletions

View File

@@ -16,10 +16,12 @@ from .helpers import create_client
_LOGGER = logging.getLogger(__name__)
PLATFORMS = [
Platform.BUTTON,
Platform.IMAGE,
Platform.LIGHT,
Platform.MEDIA_PLAYER,
Platform.NUMBER,
Platform.SELECT,
Platform.SENSOR,
Platform.SWITCH,
]
@@ -30,9 +32,14 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
hass.data.setdefault(DOMAIN, {})
client = create_client(entry.data | entry.options)
coordinator = OasisMiniCoordinator(hass, client)
await coordinator.async_config_entry_first_refresh()
try:
await coordinator.async_config_entry_first_refresh()
except Exception as ex:
_LOGGER.exception(ex)
if not coordinator.data:
await client.session.close()
raise ConfigEntryNotReady
hass.data[DOMAIN][entry.entry_id] = coordinator