forked from M-Labs/thermostat
Start running only when task is running
This commit is contained in:
parent
1fd49360d0
commit
84018c3ebc
|
@ -36,7 +36,7 @@ class ClientWatcher(QObject):
|
||||||
|
|
||||||
def __init__(self, parent, client, update_s):
|
def __init__(self, parent, client, update_s):
|
||||||
self.update_s = update_s
|
self.update_s = update_s
|
||||||
self.running = True
|
self.running = False
|
||||||
self.client = client
|
self.client = client
|
||||||
self.watch_task = None
|
self.watch_task = None
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
@ -52,6 +52,7 @@ class ClientWatcher(QObject):
|
||||||
self.fan_update.emit(await self.client.fan())
|
self.fan_update.emit(await self.client.fan())
|
||||||
|
|
||||||
def start_watching(self):
|
def start_watching(self):
|
||||||
|
self.running = True
|
||||||
self.watch_task = asyncio.create_task(self.run())
|
self.watch_task = asyncio.create_task(self.run())
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
|
|
Loading…
Reference in New Issue