Skip to content

Commit

Permalink
Now i'm just spitballing
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Mulliken committed Jun 30, 2021
1 parent 9fcf372 commit 0093b47
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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=.
Expand Down
9 changes: 3 additions & 6 deletions src/wyzeapy/services/sensor_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()]

0 comments on commit 0093b47

Please sign in to comment.