end_session in thermostat itself afterall

This commit is contained in:
atse 2024-08-29 11:40:57 +08:00
parent a6be838445
commit daa3192d41
2 changed files with 5 additions and 2 deletions

View File

@ -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()

View File

@ -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():