examples: handle the relative light directives. lightWithBrightness and lightWithColorTemp now act on AdjustBrightness (brightnessDelta, clamped 0-100); lightWithColorTemp starts at 2700 K instead of reporting 0 K (outside Alexa's 1000-10000 K range) and acts on IncreaseColorTemperature / DecreaseColorTemperature in 500 K steps. Verified on a D1 mini with Alexa: SetBrightness 10/100 and SetColorTemperature 7000/2200 K round-trip; the relative directives await a voice test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
David 2026-09-28 09:41:59 +00:00
parent 87caad25be
commit 21cc693e74
2 changed files with 13 additions and 1 deletions

View file

@ -89,6 +89,10 @@ void setup() {
brightness=directive["payload"]["brightness"];
Serial.printf("setting brightness to: %d\n", brightness);
outputState = PowerController::ON;
} else if(directive["header"]["name"]=="AdjustBrightness"){ // "dim" / "brighten" (by N percent)
brightness=constrain(brightness + (int)directive["payload"]["brightnessDelta"], 0, 100);
Serial.printf("adjusting brightness to: %d\n", brightness);
outputState = PowerController::ON;
}
}else{
return;