This commit is contained in:
atse 2024-08-28 11:06:26 +08:00
parent 4c9df5e1a8
commit da55d07bdb
1 changed files with 3 additions and 2 deletions

View File

@ -63,15 +63,16 @@ class MainWindow(QtWidgets.QMainWindow):
self.thermostat = Thermostat(self, self.report_refresh_spin.value()) self.thermostat = Thermostat(self, self.report_refresh_spin.value())
self._connecting_task = None self._connecting_task = None
def handle_connection_error(): @asyncSlot()
async def handle_connection_error():
self.info_box.display_info_box( self.info_box.display_info_box(
"Connection Error", "Thermostat connection lost. Is it unplugged?" "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(handle_connection_error)
self.thermostat.connection_error.connect(self.thermostat.timed_out) 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) self.thermostat.connection_state_changed.connect(self._on_connection_changed)