From 4862904880eb6d73677f90e7f9a9e74e65d73368 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Sat, 16 Dec 2023 16:43:18 +0100 Subject: [PATCH] feat: make login a shared method (#64) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- src/aiocomelit/api.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/aiocomelit/api.py b/src/aiocomelit/api.py index b464b24..db9dd96 100644 --- a/src/aiocomelit/api.py +++ b/src/aiocomelit/api.py @@ -1,6 +1,7 @@ """Support for Comelit SimpleHome.""" import asyncio import functools +from abc import abstractmethod from dataclasses import dataclass from datetime import datetime from http.cookies import SimpleCookie @@ -160,6 +161,10 @@ async def _check_logged_in(self, host_type: str) -> bool: return logged + @abstractmethod + async def login(self) -> bool: + """Login to Comelit device.""" + async def _login(self, payload: dict[str, Any], host_type: str) -> bool: """Login into Comelit device.""" _LOGGER.debug("Logging into host %s [%s]", self.host, host_type) @@ -308,10 +313,6 @@ async def get_all_devices(self) -> dict[str, dict[int, ComelitSerialBridgeObject class ComelitVedoApi(ComelitCommonApi): """Queries Comelit SimpleHome VEDO alarm.""" - def __init__(self, host: str, port: int, alarm_pin: int) -> None: - """Initialize the VEDO session.""" - super().__init__(host, port, alarm_pin) - async def _translate_zone_status( self, zone: ComelitVedoZoneObject ) -> AlarmZoneState: