forked from M-Labs/thermostat
Compare commits
10 Commits
f7ad053433
...
953a48230c
Author | SHA1 | Date | |
---|---|---|---|
953a48230c | |||
0dbf154f82 | |||
287186d030 | |||
ef34d782e0 | |||
3d519826dd | |||
50a69fbfeb | |||
3a45fdaaa6 | |||
ebb240d7f3 | |||
8daa40f62b | |||
8d2b7e69bb |
@ -139,7 +139,11 @@ class AsyncioClient:
|
|||||||
"""
|
"""
|
||||||
return await self._get_conf("postfilter")
|
return await self._get_conf("postfilter")
|
||||||
|
|
||||||
async def get_report(self):
|
async def get_fan(self):
|
||||||
|
"""Get Thermostat current fan settings"""
|
||||||
|
return await self._command("fan")
|
||||||
|
|
||||||
|
async def report(self):
|
||||||
"""Obtain one-time report on measurement values
|
"""Obtain one-time report on measurement values
|
||||||
|
|
||||||
Example of yielded data:
|
Example of yielded data:
|
||||||
@ -160,18 +164,6 @@ class AsyncioClient:
|
|||||||
"""
|
"""
|
||||||
return await self._command("report")
|
return await self._command("report")
|
||||||
|
|
||||||
async def get_ipv4(self):
|
|
||||||
"""Get the IPv4 settings of the Thermostat"""
|
|
||||||
return await self._command("ipv4")
|
|
||||||
|
|
||||||
async def get_fan(self):
|
|
||||||
"""Get Thermostat current fan settings"""
|
|
||||||
return await self._command("fan")
|
|
||||||
|
|
||||||
async def get_hwrev(self):
|
|
||||||
"""Get Thermostat hardware revision"""
|
|
||||||
return await self._command("hwrev")
|
|
||||||
|
|
||||||
async def set_param(self, topic, channel, field="", value=""):
|
async def set_param(self, topic, channel, field="", value=""):
|
||||||
"""Set configuration parameters
|
"""Set configuration parameters
|
||||||
|
|
||||||
@ -190,6 +182,14 @@ class AsyncioClient:
|
|||||||
value = str(value)
|
value = str(value)
|
||||||
await self._command(topic, str(channel), field, value)
|
await self._command(topic, str(channel), field, value)
|
||||||
|
|
||||||
|
async def set_fan(self, power="auto"):
|
||||||
|
"""Set fan power"""
|
||||||
|
await self._command("fan", str(power))
|
||||||
|
|
||||||
|
async def set_fcurve(self, a=1.0, b=0.0, c=0.0):
|
||||||
|
"""Set fan curve"""
|
||||||
|
await self._command("fcurve", str(a), str(b), str(c))
|
||||||
|
|
||||||
async def power_up(self, channel, target):
|
async def power_up(self, channel, target):
|
||||||
"""Start closed-loop mode"""
|
"""Start closed-loop mode"""
|
||||||
await self.set_param("pid", channel, "target", value=target)
|
await self.set_param("pid", channel, "target", value=target)
|
||||||
@ -207,6 +207,10 @@ class AsyncioClient:
|
|||||||
if channel == "":
|
if channel == "":
|
||||||
await self._read_line() # Read the extra {}
|
await self._read_line() # Read the extra {}
|
||||||
|
|
||||||
|
async def hw_rev(self):
|
||||||
|
"""Get Thermostat hardware revision"""
|
||||||
|
return await self._command("hwrev")
|
||||||
|
|
||||||
async def reset(self):
|
async def reset(self):
|
||||||
"""Reset the Thermostat
|
"""Reset the Thermostat
|
||||||
|
|
||||||
@ -218,7 +222,7 @@ class AsyncioClient:
|
|||||||
|
|
||||||
await self.disconnect()
|
await self.disconnect()
|
||||||
|
|
||||||
async def enter_dfu_mode(self):
|
async def dfu(self):
|
||||||
"""Put the Thermostat in DFU mode
|
"""Put the Thermostat in DFU mode
|
||||||
|
|
||||||
The client is disconnected as the Thermostat stops responding to
|
The client is disconnected as the Thermostat stops responding to
|
||||||
@ -231,10 +235,6 @@ class AsyncioClient:
|
|||||||
|
|
||||||
await self.disconnect()
|
await self.disconnect()
|
||||||
|
|
||||||
async def set_fan(self, power="auto"):
|
async def ipv4(self):
|
||||||
"""Set fan power"""
|
"""Get the IPv4 settings of the Thermostat"""
|
||||||
await self._command("fan", str(power))
|
return await self._command("ipv4")
|
||||||
|
|
||||||
async def set_fcurve(self, a=1.0, b=0.0, c=0.0):
|
|
||||||
"""Set fan curve"""
|
|
||||||
await self._command("fcurve", str(a), str(b), str(c))
|
|
||||||
|
@ -39,7 +39,7 @@ class Thermostat(QObject, metaclass=PropertyMeta):
|
|||||||
|
|
||||||
async def start_session(self, host, port):
|
async def start_session(self, host, port):
|
||||||
await self._client.connect(host, port)
|
await self._client.connect(host, port)
|
||||||
self.hw_rev = await self._client.get_hwrev()
|
self.hw_rev = await self._client.hw_rev()
|
||||||
|
|
||||||
@asyncSlot()
|
@asyncSlot()
|
||||||
async def end_session(self):
|
async def end_session(self):
|
||||||
@ -92,7 +92,7 @@ class Thermostat(QObject, metaclass=PropertyMeta):
|
|||||||
) = await asyncio.gather(
|
) = await asyncio.gather(
|
||||||
self._client.get_fan(),
|
self._client.get_fan(),
|
||||||
self._client.get_output(),
|
self._client.get_output(),
|
||||||
self._client.get_report(),
|
self._client.report(),
|
||||||
self._client.get_pid(),
|
self._client.get_pid(),
|
||||||
self._client.get_b_parameter(),
|
self._client.get_b_parameter(),
|
||||||
self._client.get_postfilter(),
|
self._client.get_postfilter(),
|
||||||
@ -109,7 +109,7 @@ class Thermostat(QObject, metaclass=PropertyMeta):
|
|||||||
await self._client.set_param("ipv4", ipv4)
|
await self._client.set_param("ipv4", ipv4)
|
||||||
|
|
||||||
async def get_ipv4(self):
|
async def get_ipv4(self):
|
||||||
return await self._client.get_ipv4()
|
return await self._client.ipv4()
|
||||||
|
|
||||||
@asyncSlot()
|
@asyncSlot()
|
||||||
async def save_cfg(self, ch=""):
|
async def save_cfg(self, ch=""):
|
||||||
@ -120,7 +120,7 @@ class Thermostat(QObject, metaclass=PropertyMeta):
|
|||||||
await self._client.load_config(ch)
|
await self._client.load_config(ch)
|
||||||
|
|
||||||
async def dfu(self):
|
async def dfu(self):
|
||||||
await self._client.enter_dfu_mode()
|
await self._client.dfu()
|
||||||
|
|
||||||
async def reset(self):
|
async def reset(self):
|
||||||
await self._client.reset()
|
await self._client.reset()
|
||||||
|
Loading…
Reference in New Issue
Block a user