forked from M-Labs/thermostat
Fix hwrev getting
This commit is contained in:
parent
6e9ded532b
commit
d6f86c3435
@ -39,6 +39,7 @@ class Thermostat(QObject, metaclass=PropertyMeta):
|
||||
async def start_session(self, host, port):
|
||||
self.connection_state_changed.emit(ThermostatConnectionState.CONNECTING)
|
||||
await self._client.connect(host, port)
|
||||
self.hw_rev = await self.get_hw_rev()
|
||||
self.connection_state_changed.emit(ThermostatConnectionState.CONNECTED)
|
||||
self.start_watching()
|
||||
|
||||
@ -63,8 +64,7 @@ class Thermostat(QObject, metaclass=PropertyMeta):
|
||||
self.connection_errored = True
|
||||
|
||||
async def get_hw_rev(self):
|
||||
self.hw_rev = await self._client.hw_rev()
|
||||
return self.hw_rev
|
||||
return await self._client.hw_rev()
|
||||
|
||||
async def update_params(self):
|
||||
fan_task = asyncio.create_task(self._client.get_fan())
|
||||
|
@ -133,9 +133,10 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
self.conn_menu.host_set_line.setEnabled(False)
|
||||
self.conn_menu.port_set_spin.setEnabled(False)
|
||||
self.connect_btn.setText("Disconnect")
|
||||
hw_rev_d = await self.thermostat.get_hw_rev()
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user