forked from M-Labs/thermostat
AsyncIO version Client -> AsyncioClient
This commit is contained in:
parent
c4d31a78b1
commit
7abcc63a90
@ -1,9 +1,9 @@
|
||||
import asyncio
|
||||
from pytec.aioclient import Client
|
||||
from pytec.aioclient import AsyncioClient
|
||||
|
||||
|
||||
async def main():
|
||||
tec = Client()
|
||||
tec = AsyncioClient()
|
||||
await tec.start_session() # (host="192.168.1.26", port=23)
|
||||
await tec.set_param("s-h", 1, "t0", 20)
|
||||
print(await tec.get_pwm())
|
||||
|
@ -11,7 +11,7 @@ class StoppedConnecting(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class Client:
|
||||
class AsyncioClient:
|
||||
def __init__(self):
|
||||
self._reader = None
|
||||
self._writer = None
|
||||
@ -26,7 +26,7 @@ class Client:
|
||||
Throws asyncio.TimeoutError if timeout was exceeded.
|
||||
|
||||
Example::
|
||||
client = Client()
|
||||
client = AsyncioClient()
|
||||
try:
|
||||
await client.start_session()
|
||||
except StoppedConnecting:
|
||||
|
@ -3,7 +3,7 @@ from qasync import asyncSlot
|
||||
from pytec.gui.model.property import Property, PropertyMeta
|
||||
import asyncio
|
||||
import logging
|
||||
from pytec.aioclient import Client
|
||||
from pytec.aioclient import AsyncioClient
|
||||
|
||||
|
||||
class Thermostat(QObject, metaclass=PropertyMeta):
|
||||
@ -20,7 +20,7 @@ class Thermostat(QObject, metaclass=PropertyMeta):
|
||||
|
||||
def __init__(self, parent, update_s):
|
||||
self._update_s = update_s
|
||||
self._client = Client()
|
||||
self._client = AsyncioClient()
|
||||
self._watch_task = None
|
||||
self._report_mode_task = None
|
||||
self._poll_for_report = True
|
||||
|
Loading…
Reference in New Issue
Block a user