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:
@@ -12,8 +12,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.11', '3.12']
|
||||
home-assistant-version: ['2023.12.0', '2024.1.0']
|
||||
python-version: ['3.9','3.10','3.11','3.12','3.13']
|
||||
home-assistant-version: ['2025.9.4']
|
||||
|
||||
steps:
|
||||
- name: 📥 Checkout Code
|
||||
|
@@ -24,7 +24,7 @@ jobs:
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install flake8 black isort mypy bandit safety
|
||||
pip install homeassistant==2023.12.0
|
||||
pip install homeassistant==2025.9.4
|
||||
pip install -r requirements-dev.txt || echo "No dev requirements found"
|
||||
|
||||
- name: 🎨 Check Code Formatting (Black)
|
||||
|
@@ -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))
|
||||
@@ -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."""
|
||||
|
||||
|
@@ -7,11 +7,12 @@ from .const import API_ENDPOINTS
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AdGuardHomeAPI:
|
||||
"""API wrapper for AdGuard Home."""
|
||||
|
||||
def __init__(self, host: str, port: int = 3000, username: str = None,
|
||||
password: str = None, ssl: bool = False, session = None):
|
||||
password: str = None, ssl: bool = False, session=None):
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.username = username
|
||||
@@ -88,7 +89,8 @@ class AdGuardHomeAPI:
|
||||
|
||||
return None
|
||||
|
||||
async def update_client_blocked_services(self, client_name: str, blocked_services: list, schedule: dict = None) -> dict:
|
||||
async def update_client_blocked_services(self, client_name: str, blocked_services: list,
|
||||
schedule: dict = None) -> dict:
|
||||
"""Update blocked services for a specific client."""
|
||||
client = await self.get_client_by_name(client_name)
|
||||
if not client:
|
||||
|
@@ -1,13 +1,12 @@
|
||||
{
|
||||
"domain": "adguard_hub",
|
||||
"name": "AdGuard Control Hub",
|
||||
"codeowners": ["@your-gitea-username"],
|
||||
"codeowners": ["@sq4ind"],
|
||||
"config_flow": true,
|
||||
"dependencies": [],
|
||||
"documentation": "https://your-gitea-domain.com/your-username/adguard-control-hub",
|
||||
"documentation": "https://git.sq4ind.eu/sq4ind/adguard-control-hub",
|
||||
"integration_type": "hub",
|
||||
"iot_class": "local_polling",
|
||||
"issue_tracker": "https://your-gitea-domain.com/your-username/adguard-control-hub/issues",
|
||||
"requirements": [
|
||||
"aiohttp>=3.8.0"
|
||||
],
|
||||
|
@@ -11,6 +11,7 @@ from .const import DOMAIN, ICON_PROTECTION, ICON_PROTECTION_OFF, ICON_CLIENT, MA
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback):
|
||||
"""Set up AdGuard Control Hub switch platform."""
|
||||
coordinator = hass.data[DOMAIN][config_entry.entry_id]["coordinator"]
|
||||
@@ -26,6 +27,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn
|
||||
|
||||
async_add_entities(entities)
|
||||
|
||||
|
||||
class AdGuardBaseSwitch(CoordinatorEntity, SwitchEntity):
|
||||
"""Base class for AdGuard switches."""
|
||||
|
||||
@@ -39,6 +41,7 @@ class AdGuardBaseSwitch(CoordinatorEntity, SwitchEntity):
|
||||
"model": "AdGuard Home",
|
||||
}
|
||||
|
||||
|
||||
class AdGuardProtectionSwitch(AdGuardBaseSwitch):
|
||||
"""Switch to control global AdGuard protection."""
|
||||
|
||||
@@ -63,6 +66,7 @@ class AdGuardProtectionSwitch(AdGuardBaseSwitch):
|
||||
await self.api.set_protection(False)
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
|
||||
class AdGuardClientSwitch(AdGuardBaseSwitch):
|
||||
"""Switch to control client-specific protection."""
|
||||
|
||||
|
Reference in New Issue
Block a user