diff --git a/pytec/pytec/gui/model/thermostat.py b/pytec/pytec/gui/model/thermostat.py index b0ee322..31f02e9 100644 --- a/pytec/pytec/gui/model/thermostat.py +++ b/pytec/pytec/gui/model/thermostat.py @@ -54,11 +54,15 @@ class Thermostat(QObject, metaclass=PropertyMeta): "Encountered an error while polling for information from Thermostat.", exc_info=True, ) - self.connection_error.emit() + self.handle_connection_error() return self._update_params_task = asyncio.create_task(self.update_params()) await asyncio.sleep(self._update_s) + def handle_connection_error(self): + self.end_session() + self.connection_error.emit() + async def get_hw_rev(self): return await self._client.hw_rev() diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 72b4304..fa072d5 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -76,7 +76,6 @@ class MainWindow(QtWidgets.QMainWindow): self.info_box.display_info_box( "Connection Error", "Thermostat connection lost. Is it unplugged?" ) - await self.thermostat.end_session() self.thermostat.connection_error.connect(handle_connection_error) async def autotune_disconnect():