forked from M-Labs/thermostat
Fix hwrev getting
This commit is contained in:
parent
585c35b4c9
commit
c761f9fe94
@ -38,6 +38,7 @@ class Thermostat(QObject, metaclass=PropertyMeta):
|
|||||||
async def start_session(self, host, port):
|
async def start_session(self, host, port):
|
||||||
self.connection_state_changed.emit(ThermostatConnectionState.CONNECTING)
|
self.connection_state_changed.emit(ThermostatConnectionState.CONNECTING)
|
||||||
await self._client.connect(host, port)
|
await self._client.connect(host, port)
|
||||||
|
self.hw_rev = await self.get_hw_rev()
|
||||||
self.connection_state_changed.emit(ThermostatConnectionState.CONNECTED)
|
self.connection_state_changed.emit(ThermostatConnectionState.CONNECTED)
|
||||||
self.start_watching()
|
self.start_watching()
|
||||||
|
|
||||||
@ -58,8 +59,7 @@ class Thermostat(QObject, metaclass=PropertyMeta):
|
|||||||
await asyncio.sleep(self._update_s)
|
await asyncio.sleep(self._update_s)
|
||||||
|
|
||||||
async def get_hw_rev(self):
|
async def get_hw_rev(self):
|
||||||
self.hw_rev = await self._client.hw_rev()
|
return await self._client.hw_rev()
|
||||||
return self.hw_rev
|
|
||||||
|
|
||||||
async def update_params(self):
|
async def update_params(self):
|
||||||
fan_task = asyncio.create_task(self._client.get_fan())
|
fan_task = asyncio.create_task(self._client.get_fan())
|
||||||
|
@ -141,9 +141,10 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
match state:
|
match state:
|
||||||
case ThermostatConnectionState.CONNECTED:
|
case ThermostatConnectionState.CONNECTED:
|
||||||
self.connect_btn.setText("Disconnect")
|
self.connect_btn.setText("Disconnect")
|
||||||
hw_rev_d = await self.thermostat.get_hw_rev()
|
|
||||||
self.status_lbl.setText(
|
self.status_lbl.setText(
|
||||||
f"Connected to Thermostat v{hw_rev_d['rev']['major']}.{hw_rev_d['rev']['minor']}"
|
"Connected to Thermostat v"
|
||||||
|
f"{self.thermostat.hw_rev['rev']['major']}."
|
||||||
|
f"{self.thermostat.hw_rev['rev']['minor']}"
|
||||||
)
|
)
|
||||||
|
|
||||||
case ThermostatConnectionState.CONNECTING:
|
case ThermostatConnectionState.CONNECTING:
|
||||||
|
Loading…
Reference in New Issue
Block a user