async def async_set_preset_mode(self, preset_mode: str) -> None: """Set new preset mode.""" if self.device.mode.supports_operation_mode: knx_operation_mode = HVACOperationMode( PRESET_MODES_INV.get(preset_mode)) await self.device.mode.set_operation_mode(knx_operation_mode) self.async_write_ha_state()
async def async_set_operation_mode(self, operation_mode): """Set operation mode.""" if self.device.mode.supports_operation_mode: from xknx.knx import HVACOperationMode knx_operation_mode = HVACOperationMode( OPERATION_MODES_INV.get(operation_mode)) await self.device.mode.set_operation_mode(knx_operation_mode) await self.async_update_ha_state()
async def async_set_preset_mode(self, preset_mode: str) -> None: """Set new preset mode. This method must be run in the event loop and returns a coroutine. """ if self.device.mode.supports_operation_mode: knx_operation_mode = HVACOperationMode( PRESET_MODES_INV.get(preset_mode)) await self.device.mode.set_operation_mode(knx_operation_mode) await self.async_update_ha_state()
async def async_set_hvac_mode(self, hvac_mode: str) -> None: """Set operation mode.""" if self.device.supports_on_off and hvac_mode == HVAC_MODE_OFF: await self.device.turn_off() elif self.device.supports_on_off and hvac_mode == HVAC_MODE_HEAT: await self.device.turn_on() elif self.device.mode.supports_operation_mode: knx_operation_mode = HVACOperationMode( OPERATION_MODES_INV.get(hvac_mode)) await self.device.mode.set_operation_mode(knx_operation_mode) self.async_write_ha_state()
def async_set_operation_mode(self, operation_mode): """Set operation mode.""" if self.device.supports_operation_mode: from xknx.knx import HVACOperationMode knx_operation_mode = HVACOperationMode(operation_mode) yield from self.device.set_operation_mode(knx_operation_mode)
async def async_set_operation_mode(self, operation_mode): """Set operation mode.""" if self.device.supports_operation_mode: from xknx.knx import HVACOperationMode knx_operation_mode = HVACOperationMode(self.operationModeMapping.get(operation_mode, operation_mode)) await self.device.mode.set_operation_mode(knx_operation_mode)