This repository was archived by the owner on Apr 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change 7
7
import logging
8
8
9
9
from aiohttp import ClientError , ServerDisconnectedError
10
- from homeassistant .config_entries import ConfigEntry
10
+ from homeassistant .config_entries import (
11
+ SOURCE_DHCP ,
12
+ SOURCE_USER ,
13
+ SOURCE_ZEROCONF ,
14
+ ConfigEntry ,
15
+ )
11
16
from homeassistant .const import CONF_PASSWORD , CONF_USERNAME , Platform
12
17
from homeassistant .core import HomeAssistant , ServiceCall
13
18
from homeassistant .exceptions import ConfigEntryAuthFailed , ConfigEntryNotReady
@@ -222,11 +227,11 @@ def log_device(message: str, device: Device) -> None:
222
227
async def _block_if_core_is_configured (hass : HomeAssistant , entry : ConfigEntry ) -> bool :
223
228
overkiz_config_entries = hass .config_entries .async_entries ("overkiz" )
224
229
225
- for overkiz_entry in overkiz_config_entries :
226
- if (
227
- entry .data [CONF_USERNAME ] == overkiz_entry .data [CONF_USERNAME ]
230
+ return any (
231
+ (
232
+ overkiz_entry .source in [SOURCE_USER , SOURCE_ZEROCONF , SOURCE_DHCP ]
233
+ and entry .data [CONF_USERNAME ] == overkiz_entry .data [CONF_USERNAME ]
228
234
and entry .data [CONF_HUB ] == overkiz_entry .data [CONF_HUB ]
229
- ):
230
- return True
231
-
232
- return False
235
+ )
236
+ for overkiz_entry in overkiz_config_entries
237
+ )
You can’t perform that action at this time.
0 commit comments