forked from M-Labs/thermostat
end_session in thermostat itself afterall
This commit is contained in:
parent
02aab70e82
commit
9787dc1e8b
@ -54,11 +54,15 @@ class Thermostat(QObject, metaclass=PropertyMeta):
|
|||||||
"Encountered an error while polling for information from Thermostat.",
|
"Encountered an error while polling for information from Thermostat.",
|
||||||
exc_info=True,
|
exc_info=True,
|
||||||
)
|
)
|
||||||
self.connection_error.emit()
|
await self.handle_connection_error()
|
||||||
return
|
return
|
||||||
self._update_params_task = asyncio.create_task(self.update_params())
|
self._update_params_task = asyncio.create_task(self.update_params())
|
||||||
await asyncio.sleep(self._update_s)
|
await asyncio.sleep(self._update_s)
|
||||||
|
|
||||||
|
async def handle_connection_error(self):
|
||||||
|
await self.end_session()
|
||||||
|
self.connection_error.emit()
|
||||||
|
|
||||||
async def get_hw_rev(self):
|
async def get_hw_rev(self):
|
||||||
return await self._client.hw_rev()
|
return await self._client.hw_rev()
|
||||||
|
|
||||||
|
@ -80,7 +80,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
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)
|
||||||
|
|
||||||
# Control Panel
|
# Control Panel
|
||||||
|
Loading…
Reference in New Issue
Block a user