{"record":{"id":"d83537e50b48eb2c","repo":"home-assistant/core","slug":"set-operation-mode-error","errorCode":"set_operation_mode_error","errorMessage":"An error occurred while setting the operation mode","messagePattern":"An error occurred while setting the operation mode","errorType":"exception","errorClass":"HomeAssistantError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/bsblan/water_heater.py","lineNumber":190,"sourceCode":"            raise HomeAssistantError(\n                translation_domain=DOMAIN,\n                translation_key=\"set_temperature_error\",\n            ) from err\n\n        await self.coordinator.async_request_refresh()\n\n    @override\n    async def async_set_operation_mode(self, operation_mode: str) -> None:\n        \"\"\"Set new operation mode.\"\"\"\n        # Base class validates operation_mode is in operation_list before calling\n        bsblan_mode = HA_TO_BSBLAN_OPERATION_MODE[operation_mode]\n        try:\n            # Send numeric value as string - BSB-LAN API expects numeric mode values\n            await self.coordinator.client.set_hot_water(\n                SetHotWaterParam(operating_mode=str(bsblan_mode))\n            )\n        except BSBLANError as err:\n            raise HomeAssistantError(\n                translation_domain=DOMAIN,\n                translation_key=\"set_operation_mode_error\",\n            ) from err\n\n        await self.coordinator.async_request_refresh()\n\n    @override\n    async def async_turn_on(self, **kwargs: Any) -> None:\n        \"\"\"Turn the water heater on.\"\"\"\n        await self.async_set_operation_mode(STATE_PERFORMANCE)\n\n    @override\n    async def async_turn_off(self, **kwargs: Any) -> None:\n        \"\"\"Turn the water heater off.\"\"\"\n        await self.async_set_operation_mode(STATE_OFF)\n","sourceCodeStart":172,"sourceCodeEnd":206,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/bsblan/water_heater.py#L172-L206","documentation":"HomeAssistantError raised by the bsblan water-heater entity when `client.set_hot_water(SetHotWaterParam(operating_mode=str(bsblan_mode)))` raises BSBLANError, translation key `set_operation_mode_error`. The HA operation mode is already validated against operation_list by the base class before this point, so failure means the device rejected the numeric mode string or communication broke. Also reached via `async_turn_on` (which sets STATE_PERFORMANCE).","triggerScenarios":"Calling `water_heater.set_operation_mode` or `water_heater.turn_on` on a bsblan water heater while offline, or when the boiler rejects the mapped numeric operating mode for DHW.","commonSituations":"Automations turning DHW to performance mode in the morning while the device is briefly unreachable; boilers whose firmware doesn't accept mode writes on the DHW parameter set.","solutions":["Verify connectivity (entity state not unavailable) and retry.","Confirm the target mode is in the entity's operation_list; `turn_on` maps to performance mode.","Test the equivalent mode write in the BSB-LAN web UI to isolate device-side rejection.","Enable debug logging to capture the underlying BSBLANError."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    await client.set_hot_water(SetHotWaterParam(operating_mode=str(bsblan_mode)))\nexcept BSBLANError as err:\n    raise HomeAssistantError(translation_domain=DOMAIN, translation_key=\"set_operation_mode_error\") from err","preventionTips":["Remember water_heater.turn_on maps to performance mode — the device must accept it.","Gate mode-change automations on entity availability.","Test mode writes manually once after firmware updates to confirm acceptance."],"tags":["home-assistant","bsblan","water-heater","operation-mode","write"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}