AprilNEA/OpenLogi · error

selected light does not support brightness

Error message

selected light does not support brightness

What it means

Raised in `set_brightness` when the device advertises light capabilities but its capability block has no `brightness` entry, i.e. the light supports other controls (power, temperature) but not brightness adjustment. The CLI checks the advertised range before building any LightCommand.

Solutions

  1. Use a supported light control instead (power or color-temperature subcommands if advertised)
  2. Confirm the product's lighting is dimmable; if it is, refresh the probe cache and re-run
  3. Check for firmware updates if the device should expose brightness but does not
Defensive patterns

Strategy: type-guard

Validate before calling

if let Some(caps) = &device.light_capabilities {
    if caps.brightness.is_none() {
        anyhow::bail!("{} lighting is not dimmable", device.display_name);
    }
}

Type guard

fn brightness_range(caps: &LightCapabilities) -> Option<&BrightnessRange> {
    caps.brightness.as_ref()
}

Try / catch

match set_brightness(args).await {
    Ok(()) => (),
    Err(e) if e.to_string().contains("does not support brightness") => {
        eprintln!("Device lighting exists but has no dimming control; use power/temperature.");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: `openlogi light ... brightness` against a device whose `light_capabilities.brightness` is None — the product exposes lighting but not a controllable brightness range (e.g. fixed-color indicator lighting).

Common situations: Assuming all Logitech lit devices have dimmable LEDs; a product with on/off-only lighting; stale probe cache from a different device on the same route.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of AprilNEA/OpenLogi@e846e6f4b4 (2026-09-13). Data as JSON: /api/errors/e4b1d1ae1a07a7bd. Report an issue: GitHub.

Appendix: source

Thrown at crates/openlogi-cli/src/cmd/light.rs:126

    }
    Ok(())
}

async fn set_power(query: Option<&str>, enabled: bool) -> Result<()> {
    let devices = standalone().await?;
    let device = select(&devices, query)?;
    apply(device, LightCommand::Power(enabled)).await
}

async fn set_brightness(args: BrightnessArgs) -> Result<()> {
    let devices = standalone().await?;
    let device = select(&devices, args.device.device.as_deref())?;
    let caps = device
        .light_capabilities
        .ok_or_else(|| anyhow!("selected light did not advertise capabilities"))?;
    let range = caps
        .brightness
        .ok_or_else(|| anyhow!("selected light does not support brightness"))?;
    let command = match (args.percent, args.lumens) {
        (Some(percent), None) => LightCommand::BrightnessPercent(percent),
        (None, Some(lumens)) => {
            if range.unit() != LightValueUnit::Lumens || !range.contains(lumens) {
                return Err(anyhow!(
                    "lumens must be in the supported range {}..={} with step {}",
                    range.min(),
                    range.max(),
                    range.step()
                ));
            }
            LightCommand::BrightnessNative(lumens)
        }
        (None, None) => return Err(anyhow!("pass either --percent or --lumens")),
        (Some(_), Some(_)) => unreachable!("clap enforces the argument conflict"),
    };
    apply(device, command).await
}

View on GitHub (pinned to e846e6f4b4)