Compare commits

..

10 Commits

Author SHA1 Message Date
953a48230c README: Introduce Thermostat GUI
Co-authored-by: topquark12 <aw@m-labs.hk>
2024-11-04 18:43:51 +08:00
0dbf154f82 pytec GUI: Set up packaging
Co-authored-by: Egor Savkin <es@m-labs.hk>
2024-11-04 18:43:49 +08:00
287186d030 pytec GUI: Implement Control Panel
Co-authored-by: linuswck <linuswck@m-labs.hk>
Co-authored-by: Egor Savkin <es@m-labs.hk>
2024-11-04 18:43:27 +08:00
ef34d782e0 pytec GUI: Implement PlotSettingsMenu
Co-authored-by: linuswck <linuswck@m-labs.hk>
2024-11-04 18:43:27 +08:00
3d519826dd pytec GUI: Implement plotting
Co-authored-by: linuswck <linuswck@m-labs.hk>
2024-11-04 18:43:27 +08:00
50a69fbfeb pytec GUI: Incorporate autotuning
Co-authored-by: topquark12 <aw@m-labs.hk>
Co-authored-by: linuswck <linuswck@m-labs.hk>
Co-authored-by: Egor Savkin <es@m-labs.hk>
2024-11-04 18:43:27 +08:00
3a45fdaaa6 pytec GUI: Implement ThermostatSettingsMenu
Co-authored-by: linuswck <linuswck@m-labs.hk>
Co-authored-by: Egor Savkin <es@m-labs.hk>
2024-11-04 18:43:27 +08:00
ebb240d7f3 pytec GUI: Implement status line
Co-authored-by: linuswck <linuswck@m-labs.hk>
Co-authored-by: Egor Savkin <es@m-labs.hk>
2024-11-04 18:43:27 +08:00
8daa40f62b pytec: Create GUI to Thermostat
- Add connection menu

- Add basic GUI layout skeleton

Co-authored-by: linuswck <linuswck@m-labs.hk>
Co-authored-by: Egor Savkin <es@m-labs.hk>
2024-11-04 18:43:23 +08:00
8d2b7e69bb pytec: Create asyncio clients 2024-11-04 18:42:59 +08:00
2 changed files with 25 additions and 25 deletions

View File

@ -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))

View File

@ -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()