{"record":{"id":"9655bf62dab7bf35","repo":"home-assistant/core","slug":"bad-value","errorCode":"bad_value","errorMessage":"bad_value","messagePattern":"bad_value","errorType":"validation","errorClass":"HomeAssistantError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/blebox/light.py","lineNumber":235,"sourceCode":"            value = list(rgb)\n\n        if brightness is not None:\n            if self.color_mode == ColorMode.COLOR_TEMP:\n                value = feature.return_color_temp_with_brightness(\n                    self._color_temp_to_native_scale(self.color_temp_kelvin),\n                    brightness,\n                )\n            else:\n                value = feature.apply_brightness(value, brightness)\n\n        if isinstance(value, (list, tuple)) and not any(value):\n            await self._feature.async_off()\n            return\n\n        try:\n            await self._feature.async_on(value)\n        except ValueError as exc:\n            raise HomeAssistantError(\n                translation_domain=DOMAIN,\n                translation_key=\"bad_value\",\n                translation_placeholders={\"error\": str(exc)},\n            ) from exc\n\n        if effect is not None:\n            try:\n                effect_value = self.effect_list.index(effect)\n                await self._feature.async_api_command(\"effect\", effect_value)\n            except ValueError as exc:\n                raise HomeAssistantError(\n                    translation_domain=DOMAIN,\n                    translation_key=\"effect_not_found\",\n                    translation_placeholders={\"error\": str(exc)},\n                ) from exc\n\n    @blebox_command\n    @override","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/blebox/light.py#L217-L253","documentation":"In blebox's light.async_turn_on, calling the feature's async_on(value) with a value the underlying python-blebox library rejects raises ValueError, which is converted to HomeAssistantError with key 'bad_value' and the ValueError text. The library validates channel values (e.g. color/brightness tuples) and throws when they cannot be applied to the light's feature type.","triggerScenarios":"Turning on a BleBox light with a color or brightness payload that does not fit the feature, e.g. sending an RGB/HSV value to a dimmer-only channel, or a computed list/tuple value the library cannot map onto the device's channels.","commonSituations":"Automations or scenes passing color attributes to lights that only support brightness; mismatch between HA light capabilities advertised by the integration and what the specific BleBox product (dimmer vs RGBW) accepts; library version tightening value validation.","solutions":["Check the light's supported_color_modes / feature list and only send attributes it supports.","Update the python-blebox dependency and the integration to the latest version in case capability reporting improved.","Reproduce with debug logging to see the exact ValueError message and adjust the payload."],"exampleFix":"# before: sending color to a brightness-only light\nawait light.async_turn_on(color_name=\"red\")\n# after: send only what the feature supports\nif light.supported_color_modes and ColorMode.RGB in light.supported_color_modes:\n    await light.async_turn_on(color_name=\"red\")\nelse:\n    await light.async_turn_on(brightness=128)","handlingStrategy":"validation","validationCode":"from homeassistant.components.light import ColorMode\n\nif color_kwargs and ColorMode.RGB not in (light.supported_color_modes or set()):\n    color_kwargs = {k: v for k, v in color_kwargs.items() if k == \"brightness\"","typeGuard":null,"tryCatchPattern":"from homeassistant.exceptions import HomeAssistantError\n\ntry:\n    await light.async_turn_on(**kwargs)\nexcept HomeAssistantError as err:\n    if \"bad_value\" in str(err.translation_key or \"\"):\n        # strip unsupported attributes and retry once\n        await light.async_turn_on(brightness=kwargs.get(\"brightness\", 255))","preventionTips":["Read supported_color_modes from the entity state before composing turn_on payloads.","Test automations against the actual entity, not a different light model."],"tags":["home-assistant","blebox","light","value-validation"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}