home-assistant/core · error · HomeAssistantError
bad_value
bad_value
Error message
bad_value
What it means
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.
Source
Thrown at homeassistant/components/blebox/light.py:235
value = list(rgb)
if brightness is not None:
if self.color_mode == ColorMode.COLOR_TEMP:
value = feature.return_color_temp_with_brightness(
self._color_temp_to_native_scale(self.color_temp_kelvin),
brightness,
)
else:
value = feature.apply_brightness(value, brightness)
if isinstance(value, (list, tuple)) and not any(value):
await self._feature.async_off()
return
try:
await self._feature.async_on(value)
except ValueError as exc:
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="bad_value",
translation_placeholders={"error": str(exc)},
) from exc
if effect is not None:
try:
effect_value = self.effect_list.index(effect)
await self._feature.async_api_command("effect", effect_value)
except ValueError as exc:
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="effect_not_found",
translation_placeholders={"error": str(exc)},
) from exc
@blebox_command
@overrideView on GitHub (pinned to 58a3fdb3ea)
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.
Example fix
# before: sending color to a brightness-only light
await light.async_turn_on(color_name="red")
# after: send only what the feature supports
if light.supported_color_modes and ColorMode.RGB in light.supported_color_modes:
await light.async_turn_on(color_name="red")
else:
await light.async_turn_on(brightness=128) Defensive patterns
Strategy: validation
Validate before calling
from homeassistant.components.light import ColorMode
if color_kwargs and ColorMode.RGB not in (light.supported_color_modes or set()):
color_kwargs = {k: v for k, v in color_kwargs.items() if k == "brightness" Try / catch
from homeassistant.exceptions import HomeAssistantError
try:
await light.async_turn_on(**kwargs)
except HomeAssistantError as err:
if "bad_value" in str(err.translation_key or ""):
# strip unsupported attributes and retry once
await light.async_turn_on(brightness=kwargs.get("brightness", 255)) Prevention
- Read supported_color_modes from the entity state before composing turn_on payloads.
- Test automations against the actual entity, not a different light model.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/9655bf62dab7bf35.
Report an issue: GitHub.