diff --git a/src/wyzeapy/__init__.py b/src/wyzeapy/__init__.py index 44e3a84..00aaec3 100644 --- a/src/wyzeapy/__init__.py +++ b/src/wyzeapy/__init__.py @@ -36,10 +36,9 @@ async def create(cls): :return: An instance of the Wyzeapy class """ - self = Wyzeapy() - self._client = Client("", "") - await self._client.async_init() - return self + cls._client = Client("", "") + await cls._client.async_init() + return cls async def async_close(self): await self._client.async_close() diff --git a/src/wyzeapy/services/base_service.py b/src/wyzeapy/services/base_service.py index a8a6092..0e98a10 100644 --- a/src/wyzeapy/services/base_service.py +++ b/src/wyzeapy/services/base_service.py @@ -4,7 +4,6 @@ # the license with this file. If not, please write to: # joshua@mulliken.net to receive a copy from abc import abstractmethod, ABC -from typing import Any from wyzeapy import Client diff --git a/src/wyzeapy/services/hms_service.py b/src/wyzeapy/services/hms_service.py index cc015ea..1b89b86 100644 --- a/src/wyzeapy/services/hms_service.py +++ b/src/wyzeapy/services/hms_service.py @@ -6,7 +6,7 @@ from enum import Enum from typing import Optional -from wyzeapy import Client, Wyzeapy +from wyzeapy import Client from wyzeapy.services.base_service import BaseService @@ -41,16 +41,16 @@ def hms_id(self) -> Optional[str]: @property async def has_hms(self): if self._hms_id is None: - self._hms_id = await self.hms_id + self._hms_id = self.hms_id return self._hms_id is not None async def set_mode(self, mode: HMSMode): if mode == HMSMode.DISARMED: - await self._client.net_client.disable_reme_alarm(await self.hms_id) - await self._client.net_client.monitoring_profile_active(await self.hms_id, 0, 0) + await self._client.net_client.disable_reme_alarm(self.hms_id) + await self._client.net_client.monitoring_profile_active(self.hms_id, 0, 0) elif mode == HMSMode.AWAY: - await self._client.net_client.monitoring_profile_active(await self.hms_id, 0, 1) + await self._client.net_client.monitoring_profile_active(self.hms_id, 0, 1) elif mode == HMSMode.HOME: - await self._client.net_client.monitoring_profile_active(await self.hms_id, 1, 0) + await self._client.net_client.monitoring_profile_active(self.hms_id, 1, 0) diff --git a/src/wyzeapy/services/sensor_service.py b/src/wyzeapy/services/sensor_service.py index 4540d42..38fa7aa 100644 --- a/src/wyzeapy/services/sensor_service.py +++ b/src/wyzeapy/services/sensor_service.py @@ -37,7 +37,6 @@ async def update(self, sensor: Sensor) -> Sensor: return sensor - async def register_for_updates(self, sensor: Sensor, callback: Callable[[Sensor], None]): if self._updater_thread is None: self._updater_thread = Thread(target=self.update_worker, daemon=True)