{"record":{"id":"36c5cc298f3ce46a","repo":"home-assistant/core","slug":"the-bond-api-returned-an-error-calling-set-brightn","errorCode":null,"errorMessage":"The bond API returned an error calling set_brightness_belief for {self.entity_id}.  Code: {ex.status}  Message: {ex.message}","messagePattern":"The bond API returned an error calling set_brightness_belief for (.+?)\\.  Code: (.+?)  Message: (.+?)","errorType":"exception","errorClass":"HomeAssistantError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/bond/light.py","lineNumber":94,"sourceCode":"    \"\"\"Representation of a Bond light.\"\"\"\n\n    _attr_color_mode = ColorMode.ONOFF\n    _attr_supported_color_modes = {ColorMode.ONOFF}\n\n    async def async_set_brightness_belief(self, brightness: int) -> None:\n        \"\"\"Set the belief state of the light.\"\"\"\n        if not self._device.supports_set_brightness():\n            raise HomeAssistantError(\"This device does not support setting brightness\")\n        if brightness == 0:\n            await self.async_set_power_belief(False)\n            return\n        try:\n            await self._bond.action(\n                self._device_id,\n                Action.set_brightness_belief(round((brightness * 100) / 255)),\n            )\n        except ClientResponseError as ex:\n            raise HomeAssistantError(\n                \"The bond API returned an error calling set_brightness_belief for\"\n                f\" {self.entity_id}.  Code: {ex.status}  Message: {ex.message}\"\n            ) from ex\n\n    async def async_set_power_belief(self, power_state: bool) -> None:\n        \"\"\"Set the belief state of the light.\"\"\"\n        try:\n            await self._bond.action(\n                self._device_id, Action.set_light_state_belief(power_state)\n            )\n        except ClientResponseError as ex:\n            raise HomeAssistantError(\n                \"The bond API returned an error calling set_light_state_belief for\"\n                f\" {self.entity_id}.  Code: {ex.status}  Message: {ex.message}\"\n            ) from ex\n\n\nclass BondLight(BondBaseLight, BondEntity, LightEntity):","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/bond/light.py#L76-L112","documentation":"Raised by BondBaseLight.async_set_brightness_belief when Action.set_brightness_belief(round(brightness*100/255)) fails with a ClientResponseError. The 0-255 HA brightness is converted to a 0-100 Bond brightness first; the message includes the HTTP status and API message text.","triggerScenarios":"Any brightness set on a Bond light while the hub replies 4xx/5xx: 401 stale token, 404 device removed, 400 device rejecting the belief despite advertising the capability.","commonSituations":"Token rotated in the Bond app, device deleted/re-paired (device_id changed), hub overloaded returning 5xx.","solutions":["Read Code: in the message — 401 → re-authenticate; 404 → reload integration after re-adding device in Bond app; 5xx → retry.","Verify the device still exists in the Bond app with the same device_id.","Update integration + hub firmware if 400s persist on a brightness-capable light."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    await light.async_set_brightness_belief(brightness)\nexcept HomeAssistantError as err:\n    status = parse_code(str(err))  # extract 'Code: NNN'\n    if status == 401: trigger_reauth()\n    elif status == 404: reload_integration()","preventionTips":["Re-authenticate promptly after rotating the Bond token.","Re-add deleted devices in the Bond app and reload the integration in the same step."],"tags":["bond","light","http","home-assistant","belief-command"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}