Skip to content

Commit

Permalink
Fix core detection when overkiz is ignored (#750)
Browse files Browse the repository at this point in the history
* Fix core detection when overkiz is ignored

* Check if entry in a list

* Add correct imports
  • Loading branch information
vlebourl committed Feb 4, 2022
1 parent 9e126c9 commit b1625df
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions custom_components/tahoma/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
import logging

from aiohttp import ClientError, ServerDisconnectedError
from homeassistant.config_entries import ConfigEntry
from homeassistant.config_entries import (
SOURCE_DHCP,
SOURCE_USER,
SOURCE_ZEROCONF,
ConfigEntry,
)
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
from homeassistant.core import HomeAssistant, ServiceCall
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
Expand Down Expand Up @@ -222,11 +227,11 @@ def log_device(message: str, device: Device) -> None:
async def _block_if_core_is_configured(hass: HomeAssistant, entry: ConfigEntry) -> bool:
overkiz_config_entries = hass.config_entries.async_entries("overkiz")

for overkiz_entry in overkiz_config_entries:
if (
entry.data[CONF_USERNAME] == overkiz_entry.data[CONF_USERNAME]
return any(
(
overkiz_entry.source in [SOURCE_USER, SOURCE_ZEROCONF, SOURCE_DHCP]
and entry.data[CONF_USERNAME] == overkiz_entry.data[CONF_USERNAME]
and entry.data[CONF_HUB] == overkiz_entry.data[CONF_HUB]
):
return True

return False
)
for overkiz_entry in overkiz_config_entries
)

0 comments on commit b1625df

Please sign in to comment.