{"record":{"id":"e4b1d1ae1a07a7bd","repo":"AprilNEA/OpenLogi","slug":"selected-light-does-not-support-brightness","errorCode":null,"errorMessage":"selected light does not support brightness","messagePattern":"selected light does not support brightness","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/openlogi-cli/src/cmd/light.rs","lineNumber":126,"sourceCode":"    }\n    Ok(())\n}\n\nasync fn set_power(query: Option<&str>, enabled: bool) -> Result<()> {\n    let devices = standalone().await?;\n    let device = select(&devices, query)?;\n    apply(device, LightCommand::Power(enabled)).await\n}\n\nasync fn set_brightness(args: BrightnessArgs) -> Result<()> {\n    let devices = standalone().await?;\n    let device = select(&devices, args.device.device.as_deref())?;\n    let caps = device\n        .light_capabilities\n        .ok_or_else(|| anyhow!(\"selected light did not advertise capabilities\"))?;\n    let range = caps\n        .brightness\n        .ok_or_else(|| anyhow!(\"selected light does not support brightness\"))?;\n    let command = match (args.percent, args.lumens) {\n        (Some(percent), None) => LightCommand::BrightnessPercent(percent),\n        (None, Some(lumens)) => {\n            if range.unit() != LightValueUnit::Lumens || !range.contains(lumens) {\n                return Err(anyhow!(\n                    \"lumens must be in the supported range {}..={} with step {}\",\n                    range.min(),\n                    range.max(),\n                    range.step()\n                ));\n            }\n            LightCommand::BrightnessNative(lumens)\n        }\n        (None, None) => return Err(anyhow!(\"pass either --percent or --lumens\")),\n        (Some(_), Some(_)) => unreachable!(\"clap enforces the argument conflict\"),\n    };\n    apply(device, command).await\n}","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/AprilNEA/OpenLogi/blob/e846e6f4b4405e33bd6a9aaf949a482ce34cb6d8/crates/openlogi-cli/src/cmd/light.rs#L108-L144","documentation":"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.","triggerScenarios":"`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).","commonSituations":"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.","solutions":["Use a supported light control instead (power or color-temperature subcommands if advertised)","Confirm the product's lighting is dimmable; if it is, refresh the probe cache and re-run","Check for firmware updates if the device should expose brightness but does not"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if let Some(caps) = &device.light_capabilities {\n    if caps.brightness.is_none() {\n        anyhow::bail!(\"{} lighting is not dimmable\", device.display_name);\n    }\n}","typeGuard":"fn brightness_range(caps: &LightCapabilities) -> Option<&BrightnessRange> {\n    caps.brightness.as_ref()\n}","tryCatchPattern":"match set_brightness(args).await {\n    Ok(()) => (),\n    Err(e) if e.to_string().contains(\"does not support brightness\") => {\n        eprintln!(\"Device lighting exists but has no dimming control; use power/temperature.\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Inspect the advertised brightness range before scripting brightness changes","Fall back to power or color-temperature controls for non-dimmable lighting","Keep the device probe cache fresh after firmware updates"],"tags":["cli","hardware","lighting","capabilities"],"backgroundTag":"unsupported-operation","analyzedSha":"e846e6f4b4405e33bd6a9aaf949a482ce34cb6d8","analyzedAt":"2026-09-13T03:07:16.451Z","contentChangedAt":"2026-09-13T03:07:16.451Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}