Stuff non-UI changes in Thermostat model

This commit is contained in:
atse 2024-08-23 12:11:58 +08:00
parent 77b66e15cc
commit bfddfd8e20
2 changed files with 3 additions and 3 deletions

View File

@ -37,6 +37,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.start_watching()
async def run(self): async def run(self):
self._update_params_task = asyncio.create_task(self.update_params()) self._update_params_task = asyncio.create_task(self.update_params())
@ -104,6 +105,8 @@ class Thermostat(QObject, metaclass=PropertyMeta):
] ]
async def end_session(self): async def end_session(self):
await self.set_report_mode(False)
self.stop_watching()
await self._client.disconnect() await self._client.disconnect()
self.connection_errored = False self.connection_errored = False

View File

@ -190,7 +190,6 @@ class MainWindow(QtWidgets.QMainWindow):
logging.debug(self.hw_rev_data) logging.debug(self.hw_rev_data)
self._status(self.hw_rev_data) self._status(self.hw_rev_data)
self.thermostat.start_watching()
case ThermostatConnectionState.CONNECTING: case ThermostatConnectionState.CONNECTING:
self.status_lbl.setText("Connecting...") self.status_lbl.setText("Connecting...")
@ -222,8 +221,6 @@ class MainWindow(QtWidgets.QMainWindow):
self.autotuners.autotuners[ch].setOff() self.autotuners.autotuners[ch].setOff()
else: else:
await self.autotuners.stop_pid_from_running(ch) await self.autotuners.stop_pid_from_running(ch)
await self.thermostat.set_report_mode(False)
self.thermostat.stop_watching()
def _status(self, hw_rev_d: dict): def _status(self, hw_rev_d: dict):
logging.debug(hw_rev_d) logging.debug(hw_rev_d)