Closed Akeboshiwind closed 1 year ago
Looking at the docs for the climate entity, there's an optional parameter hvac_mode which it looks like your climate entity doesn't support.
hvac_mode
Would it be possible to add it? I've tried this out locally and it seems to work:
diff --git a/custom_components/mitsubishi_wf_rac/climate.py b/custom_components/mitsubishi_wf_rac/climate.py index 197b728..561766e 100644 --- a/custom_components/mitsubishi_wf_rac/climate.py +++ b/custom_components/mitsubishi_wf_rac/climate.py @@ -87,10 +87,16 @@ class AircoClimate(ClimateEntity): self._attr_unique_id = f"{DOMAIN}-{self._device.airco_id}-climate" self._update_state() - async def async_set_temperature(self, **kwargs) -> None: + async def async_set_temperature(self, hvac_mode: HVACMode, **kwargs) -> None: """Set new target temperature.""" await self._device.set_airco( - {AirconCommands.PresetTemp: kwargs.get(ATTR_TEMPERATURE)} + { + AirconCommands.PresetTemp: kwargs.get(ATTR_TEMPERATURE), + AirconCommands.OperationMode: self._device.airco.OperationMode + if hvac_mode == HVACMode.OFF + else HVAC_TRANSLATION[hvac_mode], + AirconCommands.Operation: hvac_mode != HVACMode.OFF, + } ) self._update_state()
Another option would be to call await self.async_set_hvac_mode(**kwargs) and remove one call to self._update_state()
await self.async_set_hvac_mode(**kwargs)
self._update_state()
Actually my two options here don't make hvac_mode optional. I've submitted a PR to allow optionally setting it :)
Looking at the docs for the climate entity, there's an optional parameter
hvac_mode
which it looks like your climate entity doesn't support.Would it be possible to add it? I've tried this out locally and it seems to work:
Another option would be to call
await self.async_set_hvac_mode(**kwargs)
and remove one call toself._update_state()