diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index fa78e45..6fd9548 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -201,11 +201,11 @@ class MainWindow(QtWidgets.QMainWindow): case ThermostatConnectionState.CONNECTING: self._connecting_task.cancel() + self._connecting_task = None await self._thermostat.end_session() self._thermostat.connection_state = ( ThermostatConnectionState.DISCONNECTED ) - self._connecting_task = None case ThermostatConnectionState.CONNECTED: await self._thermostat.end_session()