Announce a doorbell with proactivelyReported and a scene with supportsDeactivation

An interface without properties says beside its name what Alexa has to know
of it; the library left both out. With a board and Alexa on 2026-09-28 the
discovery of a doorbell was accepted (202), the endpoint was not listed, and
its DoorbellPress was answered with 500 INTERNAL_SERVICE_EXCEPTION.

DoorbellEventSource now always carries "proactivelyReported": true.
SceneController carries "supportsDeactivation", false until the sketch calls
setSupportsDeactivation(true); on another interface the call is refused and
logged. The Scene example says that it can be undone.

148 host tests. Light: static RAM 30,616 B, flash 332,705 B (+140 B).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
David 2026-09-28 22:20:34 +00:00
parent 1b8a5ff806
commit c3d02f462e
11 changed files with 65 additions and 18 deletions

View file

@ -76,7 +76,7 @@ void setup()
// The name Alexa shows, and the id of the endpoint: every device of an account has its own
doorbell = alexa.getDevice("Front Door Bell", "esp-doorbell");
doorbell->setDisplayCategory(DisplayCategory::DOORBELL);
doorbell->addCapability(AlexaInterfaces::DoorbellEventSource)->setProactivelyReported(true);
doorbell->addCapability(AlexaInterfaces::DoorbellEventSource);
doorbell->addCapability(AlexaInterfaces::EndpointHealth);
doorbell->onDirective(onDirective);
}

View file

@ -105,8 +105,6 @@ not been tried.
## Limits
- Scene: the discovery object does not carry `supportsDeactivation`. The sketch answers `Deactivate`, but Alexa
may never send it.
- Doorbell, ContactSensor: an event or a change while there is no session with the broker is not sent later.
- Lock: the answer after the DeferredResponse is sent once. If the session is lost while the bolt moves, Alexa gets
the state with its next ReportState.

View file

@ -4,8 +4,8 @@
// with DeactivationStarted. The scene of this sketch switches two outputs: the ceiling lamp off and the lamp
// behind the screen on.
//
// The discovery object of the library does not say that the scene can be deactivated (supportsDeactivation), so
// Alexa may never send Deactivate. The handler answers it all the same.
// setSupportsDeactivation(true) tells Alexa that the scene can be undone: "Alexa, turn off Movie Night" then
// arrives as Deactivate.
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <Alex2ESP.h>
@ -93,7 +93,7 @@ void setup()
// The name Alexa shows, and the id of the endpoint: every device of an account has its own
AlexaDevice *scene = alexa.getDevice("Movie Night", "esp-scene");
scene->setDisplayCategory(DisplayCategory::SCENE_TRIGGER);
scene->addCapability(AlexaInterfaces::SceneController);
scene->addCapability(AlexaInterfaces::SceneController)->setSupportsDeactivation(true);
scene->addCapability(AlexaInterfaces::EndpointHealth);
scene->onDirective(onDirective);
}