fix: minor fixes
Some checks failed
🧪 Integration Testing / 🔧 Test Integration (2025.9.4, 3.10) (push) Failing after 32s
🧪 Integration Testing / 🔧 Test Integration (2025.9.4, 3.11) (push) Failing after 14s
🧪 Integration Testing / 🔧 Test Integration (2025.9.4, 3.12) (push) Failing after 15s
🧪 Integration Testing / 🔧 Test Integration (2025.9.4, 3.13) (push) Failing after 1m57s
🧪 Integration Testing / 🔧 Test Integration (2025.9.4, 3.9) (push) Failing after 28s
🛡️ Code Quality & Security Check / 🔍 Code Quality Analysis (push) Failing after 19s
Some checks failed
🧪 Integration Testing / 🔧 Test Integration (2025.9.4, 3.10) (push) Failing after 32s
🧪 Integration Testing / 🔧 Test Integration (2025.9.4, 3.11) (push) Failing after 14s
🧪 Integration Testing / 🔧 Test Integration (2025.9.4, 3.12) (push) Failing after 15s
🧪 Integration Testing / 🔧 Test Integration (2025.9.4, 3.13) (push) Failing after 1m57s
🧪 Integration Testing / 🔧 Test Integration (2025.9.4, 3.9) (push) Failing after 28s
🛡️ Code Quality & Security Check / 🔍 Code Quality Analysis (push) Failing after 19s
Signed-off-by: Rafal Zielinski <sq4ind@gmail.com>
This commit is contained in:
@@ -18,6 +18,7 @@ from .api import AdGuardHomeAPI
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up AdGuard Control Hub from a config entry."""
|
||||
session = async_get_clientsession(hass, entry.data.get(CONF_VERIFY_SSL, True))
|
||||
@@ -34,8 +35,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
# Test the connection
|
||||
try:
|
||||
await api.test_connection()
|
||||
_LOGGER.info("Successfully connected to AdGuard Home at %s:%s",
|
||||
entry.data[CONF_HOST], entry.data[CONF_PORT])
|
||||
_LOGGER.info("Successfully connected to AdGuard Home at %s:%s",
|
||||
entry.data[CONF_HOST], entry.data[CONF_PORT])
|
||||
except Exception as err:
|
||||
_LOGGER.error("Failed to connect to AdGuard Home: %s", err)
|
||||
raise ConfigEntryNotReady(f"Unable to connect: {err}")
|
||||
@@ -57,6 +58,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
_LOGGER.info("AdGuard Control Hub setup complete")
|
||||
return True
|
||||
|
||||
|
||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Unload AdGuard Control Hub config entry."""
|
||||
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||
@@ -66,6 +68,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
||||
return unload_ok
|
||||
|
||||
|
||||
class AdGuardControlHubCoordinator(DataUpdateCoordinator):
|
||||
"""AdGuard Control Hub data update coordinator."""
|
||||
|
||||
@@ -88,7 +91,7 @@ class AdGuardControlHubCoordinator(DataUpdateCoordinator):
|
||||
# Fetch all data concurrently for better performance
|
||||
results = await asyncio.gather(
|
||||
self.api.get_clients(),
|
||||
self.api.get_statistics(),
|
||||
self.api.get_statistics(),
|
||||
self.api.get_status(),
|
||||
return_exceptions=True,
|
||||
)
|
||||
@@ -103,7 +106,7 @@ class AdGuardControlHubCoordinator(DataUpdateCoordinator):
|
||||
|
||||
# Update stored data (use empty dict if fetch failed)
|
||||
self._clients = {
|
||||
client["name"]: client
|
||||
client["name"]: client
|
||||
for client in (clients.get("clients", []) if not isinstance(clients, Exception) else [])
|
||||
}
|
||||
self._statistics = statistics if not isinstance(statistics, Exception) else {}
|
||||
@@ -123,7 +126,7 @@ class AdGuardControlHubCoordinator(DataUpdateCoordinator):
|
||||
"""Return clients data."""
|
||||
return self._clients
|
||||
|
||||
@property
|
||||
@property
|
||||
def statistics(self):
|
||||
"""Return statistics data."""
|
||||
return self._statistics
|
||||
@@ -131,4 +134,4 @@ class AdGuardControlHubCoordinator(DataUpdateCoordinator):
|
||||
@property
|
||||
def protection_status(self):
|
||||
"""Return protection status data."""
|
||||
return self._protection_status
|
||||
return self._protection_status
|
||||
|
Reference in New Issue
Block a user