diff --git a/pytec/pytec/gui/model/thermostat.py b/pytec/pytec/gui/model/thermostat.py index 33c442c..15e8b19 100644 --- a/pytec/pytec/gui/model/thermostat.py +++ b/pytec/pytec/gui/model/thermostat.py @@ -37,7 +37,9 @@ class Thermostat(QObject, metaclass=PropertyMeta): async def start_session(self, host, port): await self._client.connect(host, port) + hw_rev_data = await self.get_hw_rev() self.start_watching() + return hw_rev_data async def run(self): self._update_params_task = asyncio.create_task(self.update_params()) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 05a5998..f4b9833 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -177,9 +177,6 @@ class MainWindow(QtWidgets.QMainWindow): self.conn_menu.port_set_spin.setEnabled(False) self.connect_btn.setText("Disconnect") - self.hw_rev_data = await self.thermostat.get_hw_rev() - logging.debug(self.hw_rev_data) - self._status(self.hw_rev_data) case ThermostatConnectionState.CONNECTING: @@ -214,7 +211,6 @@ class MainWindow(QtWidgets.QMainWindow): await self.autotuners.stop_pid_from_running(ch) def _status(self, hw_rev_d: dict): - logging.debug(hw_rev_d) self.status_lbl.setText( f"Connected to Thermostat v{hw_rev_d['rev']['major']}.{hw_rev_d['rev']['minor']}" ) @@ -255,7 +251,7 @@ class MainWindow(QtWidgets.QMainWindow): ) ) try: - await self._connecting_task + self.hw_rev_data = await self._connecting_task except (OSError, asyncio.CancelledError) as exc: await self.bail() if isinstance(exc, asyncio.CancelledError):