Compare commits

..

10 Commits

Author SHA1 Message Date
f7ad053433 README: Introduce Thermostat GUI
Co-authored-by: topquark12 <aw@m-labs.hk>
2024-11-11 12:40:52 +08:00
a9e7fbc394 pytec GUI: Set up packaging
Co-authored-by: Egor Savkin <es@m-labs.hk>
2024-11-11 12:40:52 +08:00
c5ad9a355e pytec GUI: Implement Control Panel
Co-authored-by: linuswck <linuswck@m-labs.hk>
Co-authored-by: Egor Savkin <es@m-labs.hk>
2024-11-11 12:40:52 +08:00
3648cab1f8 pytec GUI: Implement PlotSettingsMenu
Co-authored-by: linuswck <linuswck@m-labs.hk>
2024-11-11 12:40:52 +08:00
8568ed59eb pytec GUI: Implement plotting
Co-authored-by: linuswck <linuswck@m-labs.hk>
2024-11-11 12:40:52 +08:00
7e78d987eb 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-11 12:40:52 +08:00
a412679d43 pytec GUI: Implement ThermostatSettingsMenu
Co-authored-by: linuswck <linuswck@m-labs.hk>
Co-authored-by: Egor Savkin <es@m-labs.hk>
2024-11-11 12:40:52 +08:00
a99f0c9870 pytec GUI: Implement status line
Co-authored-by: linuswck <linuswck@m-labs.hk>
Co-authored-by: Egor Savkin <es@m-labs.hk>
2024-11-11 12:40:52 +08:00
c1b5931f6b 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-11 12:40:52 +08:00
5bbe8a06c6 pytec: Create asyncio clients 2024-11-11 12:40:52 +08:00
2 changed files with 25 additions and 25 deletions

View File

@ -139,11 +139,7 @@ class AsyncioClient:
""" """
return await self._get_conf("postfilter") return await self._get_conf("postfilter")
async def get_fan(self): async def get_report(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:
@ -164,6 +160,18 @@ 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
@ -182,14 +190,6 @@ 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,10 +207,6 @@ 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
@ -222,7 +218,7 @@ class AsyncioClient:
await self.disconnect() await self.disconnect()
async def dfu(self): async def enter_dfu_mode(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
@ -235,6 +231,10 @@ class AsyncioClient:
await self.disconnect() await self.disconnect()
async def ipv4(self): async def set_fan(self, power="auto"):
"""Get the IPv4 settings of the Thermostat""" """Set fan power"""
return await self._command("ipv4") 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))

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.hw_rev() self.hw_rev = await self._client.get_hwrev()
@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.report(), self._client.get_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.ipv4() return await self._client.get_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.dfu() await self._client.enter_dfu_mode()
async def reset(self): async def reset(self):
await self._client.reset() await self._client.reset()