diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index b97bca1..92d72eb 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -63,15 +63,16 @@ class MainWindow(QtWidgets.QMainWindow): self.thermostat = Thermostat(self, self.report_refresh_spin.value()) self._connecting_task = None - def handle_connection_error(): + @asyncSlot() + async def handle_connection_error(): 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) self.thermostat.connection_error.connect(self.thermostat.timed_out) - self.thermostat.connection_error.connect(self.thermostat.end_session) self.thermostat.connection_state_changed.connect(self._on_connection_changed)