Skip to content

Commit

Permalink
feat: make login a shared method (#64)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and chemelli74 committed Dec 16, 2023
1 parent 727753f commit 4862904
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/aiocomelit/api.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 4862904

Please sign in to comment.