forked from M-Labs/thermostat
Compare commits
2 Commits
2b6b7f4db0
...
9c22950e59
Author | SHA1 | Date | |
---|---|---|---|
9c22950e59 | |||
cebf995427 |
@ -13,7 +13,6 @@ class AsyncioClient:
|
|||||||
self._writer = None
|
self._writer = None
|
||||||
self._command_lock = asyncio.Lock()
|
self._command_lock = asyncio.Lock()
|
||||||
self._report_mode_on = False
|
self._report_mode_on = False
|
||||||
self.timeout = None
|
|
||||||
|
|
||||||
async def start_session(self, host="192.168.1.26", port=23):
|
async def start_session(self, host="192.168.1.26", port=23):
|
||||||
"""Start session to Thermostat at specified host and port.
|
"""Start session to Thermostat at specified host and port.
|
||||||
@ -54,9 +53,7 @@ class AsyncioClient:
|
|||||||
|
|
||||||
async def _read_line(self):
|
async def _read_line(self):
|
||||||
# read 1 line
|
# read 1 line
|
||||||
chunk = await asyncio.wait_for(
|
chunk = await self._reader.readline()
|
||||||
self._reader.readline(), self.timeout
|
|
||||||
) # Only wait for response until timeout
|
|
||||||
return chunk.decode("utf-8", errors="ignore")
|
return chunk.decode("utf-8", errors="ignore")
|
||||||
|
|
||||||
async def _read_write(self, command):
|
async def _read_write(self, command):
|
||||||
|
@ -3,9 +3,16 @@ from qasync import asyncSlot
|
|||||||
from pytec.gui.model.property import Property, PropertyMeta
|
from pytec.gui.model.property import Property, PropertyMeta
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
from enum import Enum
|
||||||
from pytec.aioclient import AsyncioClient
|
from pytec.aioclient import AsyncioClient
|
||||||
|
|
||||||
|
|
||||||
|
class ThermostatConnectionState(Enum):
|
||||||
|
STATE_DISCONNECTED = "disconnected"
|
||||||
|
STATE_CONNECTING = "connecting"
|
||||||
|
STATE_CONNECTED = "connected"
|
||||||
|
|
||||||
|
|
||||||
class Thermostat(QObject, metaclass=PropertyMeta):
|
class Thermostat(QObject, metaclass=PropertyMeta):
|
||||||
hw_rev = Property(dict)
|
hw_rev = Property(dict)
|
||||||
fan = Property(dict)
|
fan = Property(dict)
|
||||||
|
Loading…
Reference in New Issue
Block a user