From 0093b472dbcab2e62765fc3d80addb46a85c2544 Mon Sep 17 00:00:00 2001 From: Joshua Mulliken Date: Tue, 29 Jun 2021 21:27:35 -0400 Subject: [PATCH] Now i'm just spitballing --- setup.cfg | 2 +- sonar-project.properties | 2 +- src/wyzeapy/services/sensor_service.py | 9 +++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/setup.cfg b/setup.cfg index e7f7ca2..b7b3081 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = wyzeapy -version = 0.1.0-beta.20 +version = 0.1.0-beta.21 author = Mulliken LLC author_email = joshua@mulliken.net description = Python client for private Wyze API diff --git a/sonar-project.properties b/sonar-project.properties index c638a77..51993fb 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -3,7 +3,7 @@ sonar.organization=joshuamulliken # This is the name and version displayed in the SonarCloud UI. sonar.projectName=wyzeapy -sonar.projectVersion=0.1.0-beta.20 +sonar.projectVersion=0.1.0-beta.21 # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. #sonar.sources=. diff --git a/src/wyzeapy/services/sensor_service.py b/src/wyzeapy/services/sensor_service.py index 425200a..0f2ee50 100644 --- a/src/wyzeapy/services/sensor_service.py +++ b/src/wyzeapy/services/sensor_service.py @@ -51,12 +51,9 @@ async def register_for_updates(self, sensor: Sensor, callback: Callable[[Sensor] def update_worker(self): loop = asyncio.new_event_loop() while True: - if len(self._subscribers) < 1: - time.sleep(0.1) - else: - for sensor, callback in self._subscribers: - _LOGGER.debug(f"Providing update for {sensor.nickname}") - callback(asyncio.run_coroutine_threadsafe(self.update(sensor), loop).result()) + for sensor, callback in self._subscribers: + _LOGGER.debug(f"Providing update for {sensor.nickname}") + callback(asyncio.run_coroutine_threadsafe(self.update(sensor), loop).result()) async def get_sensors(self) -> List[Sensor]: return [Sensor(sensor.raw_dict) for sensor in await self._client.get_sensors()]