registry: ThermostatController 3.2 and ThermostatController.Schedule

The thermostat is described from its page: one, two or three setpoints with holdUntil, AdjustTargetTemperature,
SetThermostatMode with the six modes (EM_HEAT is new), ResumeSchedule, adaptiveRecoveryStatus, and its seven error
types under Alexa.ThermostatController. A declaration gives supportedModes, supportsScheduling and the properties
the device has; without them discovery is what 1.5.2 sent: HEAT, COOL, AUTO, OFF and the three setpoints with
thermostatMode. supportedModes without HEAT or COOL is refused where it is declared.

ThermostatController.Schedule replaces its stub. Wire change for a 1.x declaration of it: version 3.2 (was 1) and
scheduleEnabled listed (was nothing). SetAdaptiveRecovery is taken only with supportsAdaptiveRecovery.

24 examples of three pages are saved as fixtures; the page folds the SetWeeklySchedule example away, its payload
is tested from the tables. 207 tests pass, 191 before.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
David 2026-09-28 20:34:49 +00:00
parent af1489696d
commit f555a5df70
67 changed files with 2445 additions and 58 deletions

View file

@ -51,7 +51,7 @@ export declare class AlexaInterface extends Capability<any, any, Options> {
getTypeString(): string;
/** @deprecated Read descriptor.version. */
getVersion(): string;
/** @deprecated Read the keys of descriptor.properties. */
/** @deprecated The properties discovery lists: read properties.supported of toJSON(). */
getProps(): string[];
getJSON(): CapabilityJson;
toJSON(): CapabilityJson;

View file

@ -199,7 +199,9 @@ export declare enum ThermostatMode {
COOL = "COOL",
AUTO = "AUTO",
ECO = "ECO",
CUSTOM = "CUSTOM"
CUSTOM = "CUSTOM",
/** Emergency heating, since 2.0. */
EM_HEAT = "EM_HEAT"
}
/** The scale of a temperature given to addTemperatureSensorProp() and addThermostatControllerProp(). */
export declare enum TemperatureSensorScale {

View file

@ -5,11 +5,11 @@ export type { EndpointDefinition, EndpointJson } from "./device/Device.js";
export { Capability } from "./device/Capability.js";
export type { CapabilityJson, CommonOptions, Declaration } from "./device/Capability.js";
export { registry, DeclarationError, SchemaError } from "./registry/index.js";
export { Alexa, BrightnessController, ColorController, ColorTemperatureController, ContactSensor, HumiditySensor, LockController, ModeController, MotionSensor, PercentageController, PowerLevelController, RangeController, TemperatureSensor, ToggleController, } from "./registry/index.js";
export { Alexa, BrightnessController, ColorController, ColorTemperatureController, ContactSensor, HumiditySensor, LockController, ModeController, MotionSensor, PercentageController, PowerLevelController, RangeController, TemperatureSensor, ThermostatController, ThermostatControllerSchedule, ToggleController, } from "./registry/index.js";
export { PowerController, EndpointHealth } from "./compat/enums.js";
export { asset, text, semantics, SemanticsBuilder } from "./registry/index.js";
export { ASSETS as Assets, UNITS_OF_MEASURE as Units, ACTIONS as Actions, STATES as States, DISPLAY_CATEGORIES as DisplayCategories, } from "./registry/index.js";
export type { ActionId, AssetId, DisplayCategoryName, StateId, UnitOfMeasure, ActionsToDirective, AnyDescriptor, CapabilityExtras, Declared, DirectiveDescriptor, EndpointView, EventDescriptor, InterfaceDescriptor, Label, PropertyDescriptor, Semantics, StatesToRange, StatesToValue, ActionName, StateName, Mode, Infer, Schema, Temperature, TimeInterval, } from "./registry/index.js";
export { ASSETS as Assets, UNITS_OF_MEASURE as Units, ACTIONS as Actions, STATES as States, DISPLAY_CATEGORIES as DisplayCategories, THERMOSTAT_MODES as ThermostatModes, } from "./registry/index.js";
export type { ActionId, AssetId, DisplayCategoryName, StateId, UnitOfMeasure, ActionsToDirective, AnyDescriptor, CapabilityExtras, Declared, DirectiveDescriptor, EndpointView, EventDescriptor, InterfaceDescriptor, Label, PropertyDescriptor, Semantics, StatesToRange, StatesToValue, ActionName, StateName, Mode, ThermostatModeName, Infer, Schema, Temperature, TimeInterval, } from "./registry/index.js";
export * as messages from "./messages/index.js";
export { AlexaError, AlexaErrors, MessageError, StateBuilder, property } from "./messages/index.js";
export type { ChangeCause, ChangeReportMessage, DeferredResponseMessage, ErrorResponseMessage, Header, ProactiveEventMessage, Property, PropertyOptions, ResponseMessage, SceneEventMessage, } from "./messages/index.js";

View file

@ -13,6 +13,8 @@ import { PowerController } from "./interfaces/PowerController.js";
import { PowerLevelController } from "./interfaces/PowerLevelController.js";
import { RangeController } from "./interfaces/RangeController.js";
import { TemperatureSensor } from "./interfaces/TemperatureSensor.js";
import { ThermostatController } from "./interfaces/ThermostatController.js";
import { ThermostatControllerSchedule } from "./interfaces/ThermostatControllerSchedule.js";
import { ToggleController } from "./interfaces/ToggleController.js";
import type { AnyDescriptor } from "./types.js";
export declare const registry: {
@ -23,8 +25,10 @@ export declare const registry: {
/** Every descriptor, ordered by namespace. */
list(): AnyDescriptor[];
};
export { Alexa, BrightnessController, ColorController, ColorTemperatureController, ContactSensor, EndpointHealth, HumiditySensor, LockController, ModeController, MotionSensor, PercentageController, PowerController, PowerLevelController, RangeController, TemperatureSensor, ToggleController, };
export { Alexa, BrightnessController, ColorController, ColorTemperatureController, ContactSensor, EndpointHealth, HumiditySensor, LockController, ModeController, MotionSensor, PercentageController, PowerController, PowerLevelController, RangeController, TemperatureSensor, ThermostatController, ThermostatControllerSchedule, ToggleController, };
export type { Mode } from "./interfaces/ModeController.js";
export { THERMOSTAT_MODES } from "./interfaces/ThermostatController.js";
export type { ThermostatModeName } from "./interfaces/ThermostatController.js";
export { asset, text } from "./resources.js";
export { semantics, SemanticsBuilder } from "./semantics.js";
export type { ActionName, StateName } from "./semantics.js";

View file

@ -0,0 +1,71 @@
import type { Schema } from "../schema.js";
/** alexa-property-schemas.html, "ThermostatMode values". EM_HEAT, emergency heating, came with version 3.2. */
export declare const THERMOSTAT_MODES: readonly ["AUTO", "COOL", "ECO", "EM_HEAT", "HEAT", "OFF"];
export type ThermostatModeName = (typeof THERMOSTAT_MODES)[number];
/**
* Version 3.2. A thermostat declares the properties it has: targetSetpoint for a single setpoint, lowerSetpoint and
* upperSetpoint for two, all three for a target within a range. Temperatures are reported "in the same temperature
* scale (Celsius or Fahrenheit) that the thermostat is set to display". An error of errorTypes goes under the
* namespace of the interface, TEMPERATURE_VALUE_OUT_OF_RANGE under Alexa
* (alexa-thermostatcontroller-errorresponse.html).
*/
export declare const ThermostatController: import("../types.js").InterfaceDescriptor<{
targetSetpoint: {
name: string;
value: Schema<import("../schema.js").Temperature>;
};
lowerSetpoint: {
name: string;
value: Schema<import("../schema.js").Temperature>;
};
upperSetpoint: {
name: string;
value: Schema<import("../schema.js").Temperature>;
};
thermostatMode: {
name: string;
value: import("../schema.js").EnumSchema<"ECO" | "OFF" | "AUTO" | "COOL" | "EM_HEAT" | "HEAT">;
};
adaptiveRecoveryStatus: {
name: string;
value: import("../schema.js").EnumSchema<"PREHEATING" | "PRECOOLING" | "INACTIVE">;
note: string;
};
}, {
SetTargetTemperature: {
name: string;
payload: Schema<import("../schema.js").InferShape<{
targetSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
lowerSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
upperSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
holdUntil: import("../schema.js").OptionalSchema<import("../schema.js").TimeInterval>;
}>>;
note: string;
};
AdjustTargetTemperature: {
name: string;
payload: Schema<import("../schema.js").InferShape<{
targetSetpointDelta: Schema<import("../schema.js").Temperature>;
}>>;
};
SetThermostatMode: {
name: string;
payload: Schema<import("../schema.js").InferShape<{
thermostatMode: Schema<import("../schema.js").InferShape<{
value: import("../schema.js").EnumSchema<"ECO" | "OFF" | "AUTO" | "COOL" | "EM_HEAT" | "HEAT">;
}>>;
}>>;
};
ResumeSchedule: {
name: string;
payload: Schema<import("../schema.js").InferShape<{}>>;
note: string;
};
}, import("../schema.js").InferShape<{
/** Default: HEAT, COOL, AUTO, OFF. */
supportedModes: import("../schema.js").OptionalSchema<("ECO" | "OFF" | "AUTO" | "COOL" | "EM_HEAT" | "HEAT")[]>;
/** The user can set a temperature for a time: SetTargetTemperature comes with holdUntil. Default: false. */
supportsScheduling: import("../schema.js").OptionalSchema<boolean>;
/** The properties the thermostat has. Default: the three setpoints and thermostatMode. */
properties: import("../schema.js").OptionalSchema<("targetSetpoint" | "lowerSetpoint" | "upperSetpoint" | "thermostatMode" | "adaptiveRecoveryStatus")[]>;
}>, false>;

View file

@ -0,0 +1,142 @@
/**
* Version 3.2. The schedule a user writes in the Alexa app: the interface has no utterances. Discovery lists
* adaptiveRecoveryEnabled for a thermostat declared with supportsAdaptiveRecovery, and Alexa sends
* SetAdaptiveRecovery to such a thermostat only.
*/
export declare const ThermostatControllerSchedule: import("../types.js").InterfaceDescriptor<{
adaptiveRecoveryEnabled: {
name: string;
value: import("../schema.js").Schema<boolean>;
};
scheduleEnabled: {
name: string;
value: import("../schema.js").Schema<boolean>;
};
}, {
SetWeeklySchedule: {
name: string;
payload: import("../schema.js").Schema<import("../schema.js").InferShape<{
weeklySchedule: import("../schema.js").OptionalSchema<import("../schema.js").InferShape<{
temperatureScale: import("../schema.js").EnumSchema<"CELSIUS" | "FAHRENHEIT" | "KELVIN">;
Monday: import("../schema.js").Schema<import("../schema.js").InferShape<{
startTimeInMinutes: import("../schema.js").Schema<number>;
setpoints: import("../schema.js").Schema<import("../schema.js").InferShape<{
upperSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
lowerSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
}>>;
/** Without a mode the fan runs as the manufacturer set it. */
fanSetting: import("../schema.js").OptionalSchema<import("../schema.js").InferShape<{
mode: import("../schema.js").OptionalSchema<"ON" | "AUTO" | "CIRCULATE">;
}>>;
activityType: import("../schema.js").OptionalSchema<import("../schema.js").InferShape<{
type: import("../schema.js").EnumSchema<"AWAY" | "HOME" | "SLEEP">;
}>>;
}>[]>;
Tuesday: import("../schema.js").Schema<import("../schema.js").InferShape<{
startTimeInMinutes: import("../schema.js").Schema<number>;
setpoints: import("../schema.js").Schema<import("../schema.js").InferShape<{
upperSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
lowerSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
}>>;
/** Without a mode the fan runs as the manufacturer set it. */
fanSetting: import("../schema.js").OptionalSchema<import("../schema.js").InferShape<{
mode: import("../schema.js").OptionalSchema<"ON" | "AUTO" | "CIRCULATE">;
}>>;
activityType: import("../schema.js").OptionalSchema<import("../schema.js").InferShape<{
type: import("../schema.js").EnumSchema<"AWAY" | "HOME" | "SLEEP">;
}>>;
}>[]>;
Wednesday: import("../schema.js").Schema<import("../schema.js").InferShape<{
startTimeInMinutes: import("../schema.js").Schema<number>;
setpoints: import("../schema.js").Schema<import("../schema.js").InferShape<{
upperSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
lowerSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
}>>;
/** Without a mode the fan runs as the manufacturer set it. */
fanSetting: import("../schema.js").OptionalSchema<import("../schema.js").InferShape<{
mode: import("../schema.js").OptionalSchema<"ON" | "AUTO" | "CIRCULATE">;
}>>;
activityType: import("../schema.js").OptionalSchema<import("../schema.js").InferShape<{
type: import("../schema.js").EnumSchema<"AWAY" | "HOME" | "SLEEP">;
}>>;
}>[]>;
Thursday: import("../schema.js").Schema<import("../schema.js").InferShape<{
startTimeInMinutes: import("../schema.js").Schema<number>;
setpoints: import("../schema.js").Schema<import("../schema.js").InferShape<{
upperSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
lowerSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
}>>;
/** Without a mode the fan runs as the manufacturer set it. */
fanSetting: import("../schema.js").OptionalSchema<import("../schema.js").InferShape<{
mode: import("../schema.js").OptionalSchema<"ON" | "AUTO" | "CIRCULATE">;
}>>;
activityType: import("../schema.js").OptionalSchema<import("../schema.js").InferShape<{
type: import("../schema.js").EnumSchema<"AWAY" | "HOME" | "SLEEP">;
}>>;
}>[]>;
Friday: import("../schema.js").Schema<import("../schema.js").InferShape<{
startTimeInMinutes: import("../schema.js").Schema<number>;
setpoints: import("../schema.js").Schema<import("../schema.js").InferShape<{
upperSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
lowerSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
}>>;
/** Without a mode the fan runs as the manufacturer set it. */
fanSetting: import("../schema.js").OptionalSchema<import("../schema.js").InferShape<{
mode: import("../schema.js").OptionalSchema<"ON" | "AUTO" | "CIRCULATE">;
}>>;
activityType: import("../schema.js").OptionalSchema<import("../schema.js").InferShape<{
type: import("../schema.js").EnumSchema<"AWAY" | "HOME" | "SLEEP">;
}>>;
}>[]>;
Saturday: import("../schema.js").Schema<import("../schema.js").InferShape<{
startTimeInMinutes: import("../schema.js").Schema<number>;
setpoints: import("../schema.js").Schema<import("../schema.js").InferShape<{
upperSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
lowerSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
}>>;
/** Without a mode the fan runs as the manufacturer set it. */
fanSetting: import("../schema.js").OptionalSchema<import("../schema.js").InferShape<{
mode: import("../schema.js").OptionalSchema<"ON" | "AUTO" | "CIRCULATE">;
}>>;
activityType: import("../schema.js").OptionalSchema<import("../schema.js").InferShape<{
type: import("../schema.js").EnumSchema<"AWAY" | "HOME" | "SLEEP">;
}>>;
}>[]>;
Sunday: import("../schema.js").Schema<import("../schema.js").InferShape<{
startTimeInMinutes: import("../schema.js").Schema<number>;
setpoints: import("../schema.js").Schema<import("../schema.js").InferShape<{
upperSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
lowerSetpoint: import("../schema.js").OptionalSchema<import("../schema.js").Temperature>;
}>>;
/** Without a mode the fan runs as the manufacturer set it. */
fanSetting: import("../schema.js").OptionalSchema<import("../schema.js").InferShape<{
mode: import("../schema.js").OptionalSchema<"ON" | "AUTO" | "CIRCULATE">;
}>>;
activityType: import("../schema.js").OptionalSchema<import("../schema.js").InferShape<{
type: import("../schema.js").EnumSchema<"AWAY" | "HOME" | "SLEEP">;
}>>;
}>[]>;
}>>;
}>>;
note: string;
};
SetScheduleState: {
name: string;
payload: import("../schema.js").Schema<import("../schema.js").InferShape<{
scheduleEnabled: import("../schema.js").Schema<boolean>;
}>>;
note: string;
};
SetAdaptiveRecovery: {
name: string;
payload: import("../schema.js").Schema<import("../schema.js").InferShape<{
adaptiveRecoveryEnabled: import("../schema.js").Schema<boolean>;
}>>;
when: ({ options }: import("../types.js").Declared<any>) => boolean;
};
}, import("../schema.js").InferShape<{
supportedFanModes: import("../schema.js").Schema<("ON" | "AUTO" | "CIRCULATE")[]>;
/** The thermostat heats or cools ahead of an entry, to be at its temperature when it starts. */
supportsAdaptiveRecovery: import("../schema.js").Schema<boolean>;
maxEntryPerDay: import("../schema.js").OptionalSchema<number>;
}>, false>;

View file

@ -76,6 +76,8 @@ export interface CapabilityExtras {
topLevel?: Record<string, unknown>;
/** false: the capability has no properties object (the Alexa interface, a scene). */
properties?: false;
/** The properties the capability lists, where a declaration has some of those of the interface. Default: all. */
supported?: readonly string[];
}
/** A capability as declared on an endpoint: what discovery() and validate() of its descriptor are given. */
export interface Declared<O = unknown> {