Skip to content

Commit

Permalink
Fix climate support in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Jan 19, 2024
1 parent e3fa81d commit 699bfb9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions custom_components/yandex_station/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,18 @@ def on_track_template(self, value):

async def async_set_hvac_mode(self, hvac_mode: HVACMode):
if hvac_mode == HVACMode.OFF:
await self.quasar.device_action(self.device["id"], "on", False)
kwargs = {"on": False}
elif self.hvac_instance is None:
await self.quasar.device_action(self.device["id"], "on", True)
kwargs = {"on": True}
else:
await self.quasar.device_action(
self.device["id"], self.hvac_instance, str(hvac_mode)
kwargs = (
{"on": True, self.hvac_instance: str(hvac_mode)}
if self._attr_hvac_mode == HVACMode.OFF
else {self.hvac_instance: str(hvac_mode)}
)

await self.quasar.device_actions(self.device["id"], **kwargs)

async def async_set_temperature(self, temperature: float, **kwargs):
await self.quasar.device_action(self.device["id"], "temperature", temperature)

Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_station/core/yandex_quasar.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"temperature": "devices.capabilities.range",
"fan_speed": "devices.capabilities.mode",
"thermostat": "devices.capabilities.mode",
"program": "devices.capabilities.mode",
"heat": "devices.capabilities.mode",
"volume": "devices.capabilities.range",
"pause": "devices.capabilities.toggle",
Expand Down

0 comments on commit 699bfb9

Please sign in to comment.