diff --git a/pytec/pytec/gui/model/thermostat.py b/pytec/pytec/gui/model/thermostat.py index 9033e22..22d9a94 100644 --- a/pytec/pytec/gui/model/thermostat.py +++ b/pytec/pytec/gui/model/thermostat.py @@ -37,6 +37,7 @@ class Thermostat(QObject, metaclass=PropertyMeta): async def start_session(self, host, port): await self._client.connect(host, port) + self.start_watching() async def run(self): self._update_params_task = asyncio.create_task(self.update_params()) @@ -104,6 +105,8 @@ class Thermostat(QObject, metaclass=PropertyMeta): ] async def end_session(self): + await self.set_report_mode(False) + self.stop_watching() await self._client.disconnect() self.connection_errored = False diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index df7369f..b08e680 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -190,7 +190,6 @@ class MainWindow(QtWidgets.QMainWindow): logging.debug(self.hw_rev_data) self._status(self.hw_rev_data) - self.thermostat.start_watching() case ThermostatConnectionState.CONNECTING: self.status_lbl.setText("Connecting...") @@ -222,8 +221,6 @@ class MainWindow(QtWidgets.QMainWindow): self.autotuners.autotuners[ch].setOff() else: 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): logging.debug(hw_rev_d)