messages: pure builders for every event the bridge sends
src/messages builds Response, StateReport, DeferredResponse, ErrorResponse, ChangeReport and the scene, doorbell and simple events from plain values; messageId and times are parameters, so a test compares whole objects. StateBuilder collects properties checked by the descriptors, AlexaError and AlexaErrors carry the payload fields of an error type. AlexaStatusMessage and AlexaErrorResponse move to src/compat and are written on the builders. On the wire, against 1.5.2: a DeferredResponse has no context key, a ChangeReport has no correlationToken, the namespace of an ErrorResponse follows its type, and a ChangeReport without a changed property is not published: send() resolves "" and the bridge reports an error that names the endpoint. 143 tests pass (108 before). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
2558e21787
commit
46fa06728c
68 changed files with 3410 additions and 1208 deletions
26
dist/esm/compat/AlexaErrorResponse.d.ts
vendored
Normal file
26
dist/esm/compat/AlexaErrorResponse.d.ts
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import type { MqttClient } from "mqtt";
|
||||
import type { ErrorResponseMessage } from "../messages/types.js";
|
||||
/** An ErrorResponse as 1.x builds it: device.getErrorMessage(token), setErrorMessage(), send(). */
|
||||
export declare class AlexaErrorResponse {
|
||||
private readonly correlationToken;
|
||||
private readonly rootTopic;
|
||||
private readonly endpointId;
|
||||
private readonly mqttClient;
|
||||
private error;
|
||||
private namespace?;
|
||||
private readonly messageId;
|
||||
/** Where a failed publish is reported (set by the Device that built this message, 1.5.2): send() never rejects. */
|
||||
onPublishError?: (err: Error) => void;
|
||||
constructor(correlationToken: string, rootTopic: string, endpointId: string, mqttClient: MqttClient);
|
||||
/**
|
||||
* The error to answer with. otherParams are the fields the type adds to the payload (validRange). The header
|
||||
* carries the namespace the type is documented under, Alexa.ThermostatController for THERMOSTAT_IS_OFF;
|
||||
* options.namespace names another.
|
||||
*/
|
||||
setErrorMessage(type: string, message: string, otherParams?: Record<string, any>, options?: {
|
||||
namespace?: string;
|
||||
}): void;
|
||||
toJSON(): ErrorResponseMessage;
|
||||
/** Resolves with the topic published to, or "" when the publish failed. Never rejects. */
|
||||
send(sendAsync?: boolean): Promise<string>;
|
||||
}
|
||||
50
dist/esm/compat/AlexaErrorResponse.js
vendored
Normal file
50
dist/esm/compat/AlexaErrorResponse.js
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import { randomUUID } from "crypto";
|
||||
import { errorResponse } from "../messages/build.js";
|
||||
import { AlexaErrors } from "../messages/errors.js";
|
||||
/** An ErrorResponse as 1.x builds it: device.getErrorMessage(token), setErrorMessage(), send(). */
|
||||
export class AlexaErrorResponse {
|
||||
constructor(correlationToken, rootTopic, endpointId, mqttClient) {
|
||||
this.correlationToken = correlationToken;
|
||||
this.rootTopic = rootTopic;
|
||||
this.endpointId = endpointId;
|
||||
this.mqttClient = mqttClient;
|
||||
// Sent when setErrorMessage() was not called: 1.x published an empty payload, which is no ErrorResponse to Alexa
|
||||
this.error = AlexaErrors.of("INTERNAL_ERROR", "the device answered with an error and did not say which");
|
||||
// One id for the message, however often toJSON() is called
|
||||
this.messageId = randomUUID();
|
||||
}
|
||||
/**
|
||||
* The error to answer with. otherParams are the fields the type adds to the payload (validRange). The header
|
||||
* carries the namespace the type is documented under, Alexa.ThermostatController for THERMOSTAT_IS_OFF;
|
||||
* options.namespace names another.
|
||||
*/
|
||||
setErrorMessage(type, message, otherParams = {}, options = {}) {
|
||||
this.error = AlexaErrors.of(type, message, otherParams);
|
||||
this.namespace = options.namespace;
|
||||
}
|
||||
toJSON() {
|
||||
const { type, alexaMessage, extra } = this.error;
|
||||
return errorResponse({
|
||||
endpointId: this.endpointId,
|
||||
messageId: this.messageId,
|
||||
correlationToken: this.correlationToken,
|
||||
type,
|
||||
message: alexaMessage,
|
||||
extra,
|
||||
namespace: this.namespace ?? this.error.namespace,
|
||||
});
|
||||
}
|
||||
/** Resolves with the topic published to, or "" when the publish failed. Never rejects. */
|
||||
send(sendAsync = false) {
|
||||
const topic = `${this.rootTopic}/${this.endpointId}/${sendAsync ? "deferredResponse" : "alexaResponce"}`; // "alexaResponce" is how Alex2MQTT and Alex2ESP spell the topic
|
||||
return new Promise((resolve) => {
|
||||
this.mqttClient.publish(topic, JSON.stringify(this.toJSON()), (err) => {
|
||||
if (!err)
|
||||
return resolve(topic);
|
||||
if (this.onPublishError)
|
||||
this.onPublishError(err); // -> the bridge's "error" event (when somebody listens)
|
||||
resolve(""); // 1.5.1 rejected here, and an un-caught send() then killed the host on any broker hiccup
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
61
dist/esm/compat/AlexaStatusMessage.d.ts
vendored
Normal file
61
dist/esm/compat/AlexaStatusMessage.d.ts
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import type { MqttClient } from "mqtt";
|
||||
import type { ChangeCause, Property } from "../messages/types.js";
|
||||
import { TemperatureSensorScale } from "./enums.js";
|
||||
import type { EndpointHealth, PowerController } from "./enums.js";
|
||||
/**
|
||||
* A Response, StateReport, DeferredResponse or ChangeReport as 1.x builds it: device.getStatusMessage() or
|
||||
* device.getChangeReport(), the add...Prop() calls, send(). The values are not checked.
|
||||
*/
|
||||
export declare class AlexaStatusMessage {
|
||||
private readonly correlationToken;
|
||||
private readonly rootTopic;
|
||||
private readonly endpointId;
|
||||
private readonly mqttClient;
|
||||
private readonly isResponse;
|
||||
private readonly isDeferred;
|
||||
private readonly changeCause;
|
||||
private readonly state;
|
||||
private readonly messageId;
|
||||
private estimatedDeferralInSeconds?;
|
||||
/** Where a failed publish is reported (set by the Device that built this message, 1.5.2): send() never rejects. */
|
||||
onPublishError?: (err: Error) => void;
|
||||
constructor(correlationToken: string, rootTopic: string, endpointId: string, mqttClient: MqttClient, isResponse?: boolean, isDeferred?: boolean, changeCause?: ChangeCause | null);
|
||||
private addProperty;
|
||||
/** ChangeReport: the add*Prop calls that follow describe what CHANGED (the default for a change report). */
|
||||
changed(): this;
|
||||
/** ChangeReport: the add*Prop calls that follow describe the other, unchanged properties (context). */
|
||||
unchanged(): this;
|
||||
/** True for a ChangeReport (Device.getChangeReport). */
|
||||
isChangeReport(): boolean;
|
||||
/**
|
||||
* The message as it will be published (for tests and logging). A DeferredResponse has no context. Throws
|
||||
* MessageError for a ChangeReport without a changed property.
|
||||
*/
|
||||
toJSON(): {
|
||||
event: any;
|
||||
context?: {
|
||||
properties: Property[];
|
||||
};
|
||||
};
|
||||
addModeControllerProp(instance: string, value: string, uncertaintyInMs?: number): this;
|
||||
addThermostatModeProp(mode: string, uncertaintyInMs?: number): this;
|
||||
addEstimatedDeferralTime(seconds: number): this;
|
||||
addThermostatControllerProp(name: "lowerSetpoint" | "upperSetpoint" | "targetSetpoint", scale: TemperatureSensorScale, value: number, uncertaintyInMs?: number): this;
|
||||
/** Alexa.EndpointHealth connectivity: EndpointHealth.OK / UNREACHABLE (the plain strings "OK" / "UNREACHABLE" are accepted too). */
|
||||
addHealthProp(health: EndpointHealth | `${EndpointHealth}`, uncertaintyInMs?: number): this;
|
||||
addPowerControllerProp(power: PowerController, uncertaintyInMs?: number): this;
|
||||
addTemperatureSensorProp(scale: TemperatureSensorScale, value: number, uncertaintyInMs?: number): this;
|
||||
addBrightnessControllerProp(brightness: number, uncertaintyInMs?: number): this;
|
||||
addColorTemperatureControllerProp(colorTemp: number, uncertaintyInMs?: number): this;
|
||||
addToggleControllerProp(state: PowerController, instance: string, uncertaintyInMs?: number): this;
|
||||
/** A property built by the caller. It goes to the context, also in a ChangeReport after changed(). */
|
||||
addContextProp(prop: Property): this;
|
||||
/**
|
||||
* Publish: a Response/StateReport to <root>/<endpoint>/alexaResponce (sendAsync: deferredResponse), a ChangeReport
|
||||
* to <root>/changeReport (Alex2MQTT adds the user's token and posts it to the Alexa event gateway). Resolves with
|
||||
* the topic, or "" when nothing was published: the publish failed, or the message is a ChangeReport without a
|
||||
* changed property, which Alex2MQTT would drop. The error then goes to the bridge's "error" event (when listened
|
||||
* to). Never rejects (1.5.1 did, so an un-caught send() could kill the host).
|
||||
*/
|
||||
send(sendAsync?: boolean): Promise<string>;
|
||||
}
|
||||
128
dist/esm/compat/AlexaStatusMessage.js
vendored
Normal file
128
dist/esm/compat/AlexaStatusMessage.js
vendored
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
import { randomUUID } from "crypto";
|
||||
import { changeReport, deferredResponse, response } from "../messages/build.js";
|
||||
import { StateBuilder } from "../messages/StateBuilder.js";
|
||||
import { AlexaInterfaceType, TemperatureSensorScale } from "./enums.js";
|
||||
// The 1.x helpers report every temperature in Celsius, whatever scale the device works in
|
||||
function celsius(scale, value) {
|
||||
return { value: scale === TemperatureSensorScale.FAHRENHEIT ? (value - 32) * (5 / 9) : value, scale: "CELSIUS" };
|
||||
}
|
||||
/**
|
||||
* A Response, StateReport, DeferredResponse or ChangeReport as 1.x builds it: device.getStatusMessage() or
|
||||
* device.getChangeReport(), the add...Prop() calls, send(). The values are not checked.
|
||||
*/
|
||||
export class AlexaStatusMessage {
|
||||
constructor(correlationToken, rootTopic, endpointId, mqttClient, isResponse = false, isDeferred = false, changeCause = null) {
|
||||
this.correlationToken = correlationToken;
|
||||
this.rootTopic = rootTopic;
|
||||
this.endpointId = endpointId;
|
||||
this.mqttClient = mqttClient;
|
||||
this.isResponse = isResponse;
|
||||
this.isDeferred = isDeferred;
|
||||
this.changeCause = changeCause;
|
||||
// One id for the message, however often toJSON() is called
|
||||
this.messageId = randomUUID();
|
||||
this.state = new StateBuilder({ target: changeCause ? "change" : "context" });
|
||||
}
|
||||
addProperty(namespace, name, value, uncertaintyInMilliseconds = 0, instance) {
|
||||
this.state.setRaw(namespace, name, value, { instance, uncertaintyInMilliseconds });
|
||||
return this;
|
||||
}
|
||||
/** ChangeReport: the add*Prop calls that follow describe what CHANGED (the default for a change report). */
|
||||
changed() {
|
||||
this.state.changed();
|
||||
return this;
|
||||
}
|
||||
/** ChangeReport: the add*Prop calls that follow describe the other, unchanged properties (context). */
|
||||
unchanged() {
|
||||
this.state.unchanged();
|
||||
return this;
|
||||
}
|
||||
/** True for a ChangeReport (Device.getChangeReport). */
|
||||
isChangeReport() {
|
||||
return this.changeCause !== null;
|
||||
}
|
||||
/**
|
||||
* The message as it will be published (for tests and logging). A DeferredResponse has no context. Throws
|
||||
* MessageError for a ChangeReport without a changed property.
|
||||
*/
|
||||
toJSON() {
|
||||
const { endpointId, messageId, correlationToken } = this;
|
||||
if (this.changeCause) {
|
||||
return changeReport({ endpointId, messageId, cause: this.changeCause, changed: this.state.change, context: this.state.context });
|
||||
}
|
||||
if (this.isDeferred) {
|
||||
return deferredResponse({ endpointId, messageId, correlationToken, estimatedDeferralInSeconds: this.estimatedDeferralInSeconds });
|
||||
}
|
||||
const name = this.isResponse ? "Response" : "StateReport";
|
||||
return response({ name, endpointId, messageId, correlationToken, context: this.state.context });
|
||||
}
|
||||
addModeControllerProp(instance, value, uncertaintyInMs = 0) {
|
||||
return this.addProperty(AlexaInterfaceType.MODE_CONTROLLER, "mode", value, uncertaintyInMs, instance);
|
||||
}
|
||||
addThermostatModeProp(mode, uncertaintyInMs = 0) {
|
||||
return this.addProperty(AlexaInterfaceType.THERMOSTAT_CONTROLLER, "thermostatMode", mode, uncertaintyInMs);
|
||||
}
|
||||
addEstimatedDeferralTime(seconds) {
|
||||
if (this.isDeferred) {
|
||||
this.estimatedDeferralInSeconds = seconds;
|
||||
}
|
||||
else {
|
||||
console.warn("[AlexaStatusMessage.ts] Attempted to add estimated deferral time, but message is not marked as DeferredResponse.");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
addThermostatControllerProp(name, scale, value, uncertaintyInMs = 0) {
|
||||
return this.addProperty(AlexaInterfaceType.THERMOSTAT_CONTROLLER, name, celsius(scale, value), uncertaintyInMs);
|
||||
}
|
||||
/** Alexa.EndpointHealth connectivity: EndpointHealth.OK / UNREACHABLE (the plain strings "OK" / "UNREACHABLE" are accepted too). */
|
||||
addHealthProp(health, uncertaintyInMs = 0) {
|
||||
return this.addProperty(AlexaInterfaceType.ENDPOINT_HEALTH, "connectivity", { value: health }, uncertaintyInMs);
|
||||
}
|
||||
addPowerControllerProp(power, uncertaintyInMs = 0) {
|
||||
return this.addProperty(AlexaInterfaceType.POWER_CONTROLLER, "powerState", power, uncertaintyInMs);
|
||||
}
|
||||
addTemperatureSensorProp(scale, value, uncertaintyInMs = 0) {
|
||||
return this.addProperty(AlexaInterfaceType.TEMPERATURE_SENSOR, "temperature", celsius(scale, value), uncertaintyInMs);
|
||||
}
|
||||
addBrightnessControllerProp(brightness, uncertaintyInMs = 0) {
|
||||
return this.addProperty(AlexaInterfaceType.BRIGHTNESS_CONTROLLER, "brightness", brightness, uncertaintyInMs);
|
||||
}
|
||||
addColorTemperatureControllerProp(colorTemp, uncertaintyInMs = 0) {
|
||||
return this.addProperty(AlexaInterfaceType.COLOR_TEMPERATURE_CONTROLLER, "colorTemperatureInKelvin", colorTemp, uncertaintyInMs);
|
||||
}
|
||||
addToggleControllerProp(state, instance, uncertaintyInMs = 0) {
|
||||
return this.addProperty(AlexaInterfaceType.TOGGLE_CONTROLLER, "toggleState", state, uncertaintyInMs, instance);
|
||||
}
|
||||
/** A property built by the caller. It goes to the context, also in a ChangeReport after changed(). */
|
||||
addContextProp(prop) {
|
||||
this.state.add(prop, "context");
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Publish: a Response/StateReport to <root>/<endpoint>/alexaResponce (sendAsync: deferredResponse), a ChangeReport
|
||||
* to <root>/changeReport (Alex2MQTT adds the user's token and posts it to the Alexa event gateway). Resolves with
|
||||
* the topic, or "" when nothing was published: the publish failed, or the message is a ChangeReport without a
|
||||
* changed property, which Alex2MQTT would drop. The error then goes to the bridge's "error" event (when listened
|
||||
* to). Never rejects (1.5.1 did, so an un-caught send() could kill the host).
|
||||
*/
|
||||
send(sendAsync = false) {
|
||||
const topic = this.changeCause
|
||||
? `${this.rootTopic}/changeReport`
|
||||
: `${this.rootTopic}/${this.endpointId}/${sendAsync ? "deferredResponse" : "alexaResponce"}`; // "alexaResponce" is how Alex2MQTT and Alex2ESP spell the topic
|
||||
return new Promise((resolve) => {
|
||||
const failed = (err) => {
|
||||
if (this.onPublishError)
|
||||
this.onPublishError(err); // -> the bridge's "error" event (when somebody listens)
|
||||
resolve(""); // 1.5.1 rejected here, and an un-caught send() then killed the host on any broker hiccup
|
||||
};
|
||||
let payload;
|
||||
try {
|
||||
payload = JSON.stringify(this.toJSON());
|
||||
}
|
||||
catch (err) {
|
||||
return failed(err);
|
||||
}
|
||||
this.mqttClient.publish(topic, payload, (err) => (err ? failed(err) : resolve(topic)));
|
||||
});
|
||||
}
|
||||
}
|
||||
94
dist/esm/compat/enums.d.ts
vendored
94
dist/esm/compat/enums.d.ts
vendored
|
|
@ -181,7 +181,7 @@ export declare const EndpointHealth: import("../index.js").InterfaceDescriptor<{
|
|||
name: string;
|
||||
value: import("../index.js").Schema<import("../registry/schema.js").InferShape<{
|
||||
value: import("../registry/schema.js").EnumSchema<"OK" | "UNREACHABLE">;
|
||||
reason: import("../registry/schema.js").OptionalSchema<"WIFI_BAD_PASSWORD" | "WIFI_AP_NOT_FOUND" | "WIFI_ROUTER_UNREACHABLE" | "WIFI_AP_CHANNEL_QUALITY_LOW" | "INTERNET_UNREACHABLE" | "CAPTIVE_PORTAL_CHECK_FAILED" | "UNKNOWN">;
|
||||
reason: import("../registry/schema.js").OptionalSchema<"UNKNOWN" | "WIFI_BAD_PASSWORD" | "WIFI_AP_NOT_FOUND" | "WIFI_ROUTER_UNREACHABLE" | "WIFI_AP_CHANNEL_QUALITY_LOW" | "INTERNET_UNREACHABLE" | "CAPTIVE_PORTAL_CHECK_FAILED">;
|
||||
}>>;
|
||||
note: string;
|
||||
};
|
||||
|
|
@ -190,4 +190,96 @@ export declare const EndpointHealth: import("../index.js").InterfaceDescriptor<{
|
|||
readonly UNREACHABLE: "UNREACHABLE";
|
||||
};
|
||||
export type EndpointHealth = (typeof Connectivity)[keyof typeof Connectivity];
|
||||
/** The modes of a thermostat the 1.x helpers know. */
|
||||
export declare enum ThermostatMode {
|
||||
OFF = "OFF",
|
||||
HEAT = "HEAT",
|
||||
COOL = "COOL",
|
||||
AUTO = "AUTO",
|
||||
ECO = "ECO",
|
||||
CUSTOM = "CUSTOM"
|
||||
}
|
||||
/** The scale of a temperature given to addTemperatureSensorProp() and addThermostatControllerProp(). */
|
||||
export declare enum TemperatureSensorScale {
|
||||
CELSIUS = "CELSIUS",
|
||||
FAHRENHEIT = "FAHRENHEIT"
|
||||
}
|
||||
/** The error types of alexa-errorresponse.html, "Error type values". */
|
||||
export declare enum AlexaErrorType {
|
||||
ALREADY_IN_OPERATION = "ALREADY_IN_OPERATION",
|
||||
AUTHORIZATION_REQUIRED = "AUTHORIZATION_REQUIRED",
|
||||
BRIDGE_UNREACHABLE = "BRIDGE_UNREACHABLE",
|
||||
BYPASS_NEEDED = "BYPASS_NEEDED",
|
||||
CLOUD_CONTROL_DISABLED = "CLOUD_CONTROL_DISABLED",
|
||||
CHILD_LOCK = "CHILD_LOCK",
|
||||
CONFIGURATION_UPDATE_NOT_ALLOWED = "CONFIGURATION_UPDATE_NOT_ALLOWED",
|
||||
COOK_DURATION_TOO_LONG = "COOK_DURATION_TOO_LONG",
|
||||
COOLING_LOCKOUT_TEMPERATURE_VALUE_OUT_OF_RANGE = "COOLING_LOCKOUT_TEMPERATURE_VALUE_OUT_OF_RANGE",
|
||||
COOLING_STAGES_EXCEEDS_LIMIT = "COOLING_STAGES_EXCEEDS_LIMIT",
|
||||
DATA_DELETION_NOT_SUPPORTED = "DATA_DELETION_NOT_SUPPORTED",
|
||||
DATA_RETRIEVAL_NOT_SUPPORTED = "DATA_RETRIEVAL_NOT_SUPPORTED",
|
||||
DEVICE_STUCK = "DEVICE_STUCK",
|
||||
DISABLED_BY_USER = "DISABLED_BY_USER",
|
||||
DO_NOT_DISTURB_MODE = "DO_NOT_DISTURB_MODE",
|
||||
DOOR_CLOSED_TOO_LONG = "DOOR_CLOSED_TOO_LONG",
|
||||
DOOR_OPEN = "DOOR_OPEN",
|
||||
DUAL_SETPOINTS_UNSUPPORTED = "DUAL_SETPOINTS_UNSUPPORTED",
|
||||
ENDPOINT_BUSY = "ENDPOINT_BUSY",
|
||||
ENDPOINT_CONTROL_UNAVAILABLE = "ENDPOINT_CONTROL_UNAVAILABLE",
|
||||
ENDPOINT_LOW_POWER = "ENDPOINT_LOW_POWER",
|
||||
ENDPOINT_UNREACHABLE = "ENDPOINT_UNREACHABLE",
|
||||
EXCEEDED_PIN_ATTEMPTS = "EXCEEDED_PIN_ATTEMPTS",
|
||||
EXPIRED_AUTHORIZATION_CREDENTIAL = "EXPIRED_AUTHORIZATION_CREDENTIAL",
|
||||
FAILED_TO_BOOTSTRAP_COMMISSIONING_PROCESS = "FAILED_TO_BOOTSTRAP_COMMISSIONING_PROCESS",
|
||||
FIRMWARE_OUT_OF_DATE = "FIRMWARE_OUT_OF_DATE",
|
||||
HARDWARE_MALFUNCTION = "HARDWARE_MALFUNCTION",
|
||||
HEATING_LOCKOUT_TEMPERATURE_VALUE_OUT_OF_RANGE = "HEATING_LOCKOUT_TEMPERATURE_VALUE_OUT_OF_RANGE",
|
||||
HEATING_STAGES_EXCEEDS_LIMIT = "HEATING_STAGES_EXCEEDS_LIMIT",
|
||||
INSUFFICIENT_PERMISSIONS = "INSUFFICIENT_PERMISSIONS",
|
||||
INSUFFICIENT_RESOURCE = "INSUFFICIENT_RESOURCE",
|
||||
INSUFFICIENT_SPACE = "INSUFFICIENT_SPACE",
|
||||
INTERNAL_ERROR = "INTERNAL_ERROR",
|
||||
INVALID_AUTHORIZATION_CREDENTIAL = "INVALID_AUTHORIZATION_CREDENTIAL",
|
||||
INVALID_AUXILIARY_HEATING_SYSTEM_TYPE = "INVALID_AUXILIARY_HEATING_SYSTEM_TYPE",
|
||||
INVALID_DIRECTIVE = "INVALID_DIRECTIVE",
|
||||
INVALID_SYSTEM_TYPE = "INVALID_SYSTEM_TYPE",
|
||||
INVALID_TARGET_STATE = "INVALID_TARGET_STATE",
|
||||
INVALID_TEMPERATURE_SCALE = "INVALID_TEMPERATURE_SCALE",
|
||||
INVALID_TERMINAL_CONNECTION = "INVALID_TERMINAL_CONNECTION",
|
||||
INVALID_VALUE = "INVALID_VALUE",
|
||||
MAINTENANCE_REQUIRED = "MAINTENANCE_REQUIRED",
|
||||
MAX_COMMISSIONING_LIMIT_REACHED = "MAX_COMMISSIONING_LIMIT_REACHED",
|
||||
MISSING_SETUP_INFORMATION = "MISSING_SETUP_INFORMATION",
|
||||
NO_SUCH_ENDPOINT = "NO_SUCH_ENDPOINT",
|
||||
NOT_CALIBRATED = "NOT_CALIBRATED",
|
||||
NOT_IN_OPERATION = "NOT_IN_OPERATION",
|
||||
NOT_READY = "NOT_READY",
|
||||
NOT_SUPPORTED_IN_CURRENT_MODE = "NOT_SUPPORTED_IN_CURRENT_MODE",
|
||||
NOT_SUPPORTED_WITH_CURRENT_BATTERY_CHARGE_STATE = "NOT_SUPPORTED_WITH_CURRENT_BATTERY_CHARGE_STATE",
|
||||
OBSTACLE_DETECTED = "OBSTACLE_DETECTED",
|
||||
PARTNER_APPLICATION_REDIRECTION = "PARTNER_APPLICATION_REDIRECTION",
|
||||
PIN_SETUP_REQUIRED = "PIN_SETUP_REQUIRED",
|
||||
POWER_LEVEL_NOT_SUPPORTED = "POWER_LEVEL_NOT_SUPPORTED",
|
||||
PREHEAT_REQUIRED = "PREHEAT_REQUIRED",
|
||||
PROBE_REQUIRED = "PROBE_REQUIRED",
|
||||
RATE_LIMIT_EXCEEDED = "RATE_LIMIT_EXCEEDED",
|
||||
REMOTE_START_NOT_SUPPORTED = "REMOTE_START_NOT_SUPPORTED",
|
||||
REMOVE_PROBE = "REMOVE_PROBE",
|
||||
REMOTE_START_DISABLED = "REMOTE_START_DISABLED",
|
||||
REQUESTED_SETPOINTS_TOO_CLOSE = "REQUESTED_SETPOINTS_TOO_CLOSE",
|
||||
SAFETY_BEAM_BREACHED = "SAFETY_BEAM_BREACHED",
|
||||
SUBSCRIPTION_REQUIRED = "SUBSCRIPTION_REQUIRED",
|
||||
TEMPERATURE_VALUE_OUT_OF_RANGE = "TEMPERATURE_VALUE_OUT_OF_RANGE",
|
||||
THERMOSTAT_IS_OFF = "THERMOSTAT_IS_OFF",
|
||||
TOO_MANY_FAILED_ATTEMPTS = "TOO_MANY_FAILED_ATTEMPTS",
|
||||
TRIPLE_SETPOINTS_UNSUPPORTED = "TRIPLE_SETPOINTS_UNSUPPORTED",
|
||||
UNABLE_TO_CHARGE = "UNABLE_TO_CHARGE",
|
||||
UNAUTHORIZED = "UNAUTHORIZED",
|
||||
UNCLEARED_ALARM = "UNCLEARED_ALARM",
|
||||
UNSUPPORTED_THERMOSTAT_MODE = "UNSUPPORTED_THERMOSTAT_MODE",
|
||||
UNCLEARED_TROUBLE = "UNCLEARED_TROUBLE",
|
||||
UNWILLING_TO_SET_SCHEDULE = "UNWILLING_TO_SET_SCHEDULE",
|
||||
UNWILLING_TO_SET_VALUE = "UNWILLING_TO_SET_VALUE",
|
||||
VALUE_OUT_OF_RANGE = "VALUE_OUT_OF_RANGE"
|
||||
}
|
||||
export {};
|
||||
|
|
|
|||
95
dist/esm/compat/enums.js
vendored
95
dist/esm/compat/enums.js
vendored
|
|
@ -158,3 +158,98 @@ const Connectivity = { OK: "OK", UNREACHABLE: "UNREACHABLE" };
|
|||
export const PowerController = Object.assign(PowerControllerInterface, PowerState);
|
||||
/** The Alexa.EndpointHealth interface, for device.add(). EndpointHealth.OK and EndpointHealth.UNREACHABLE are the 1.x enum of connectivity values. */
|
||||
export const EndpointHealth = Object.assign(EndpointHealthInterface, Connectivity);
|
||||
/** The modes of a thermostat the 1.x helpers know. */
|
||||
export var ThermostatMode;
|
||||
(function (ThermostatMode) {
|
||||
ThermostatMode["OFF"] = "OFF";
|
||||
ThermostatMode["HEAT"] = "HEAT";
|
||||
ThermostatMode["COOL"] = "COOL";
|
||||
ThermostatMode["AUTO"] = "AUTO";
|
||||
ThermostatMode["ECO"] = "ECO";
|
||||
ThermostatMode["CUSTOM"] = "CUSTOM";
|
||||
})(ThermostatMode || (ThermostatMode = {}));
|
||||
/** The scale of a temperature given to addTemperatureSensorProp() and addThermostatControllerProp(). */
|
||||
export var TemperatureSensorScale;
|
||||
(function (TemperatureSensorScale) {
|
||||
TemperatureSensorScale["CELSIUS"] = "CELSIUS";
|
||||
TemperatureSensorScale["FAHRENHEIT"] = "FAHRENHEIT";
|
||||
})(TemperatureSensorScale || (TemperatureSensorScale = {}));
|
||||
/** The error types of alexa-errorresponse.html, "Error type values". */
|
||||
export var AlexaErrorType;
|
||||
(function (AlexaErrorType) {
|
||||
AlexaErrorType["ALREADY_IN_OPERATION"] = "ALREADY_IN_OPERATION";
|
||||
AlexaErrorType["AUTHORIZATION_REQUIRED"] = "AUTHORIZATION_REQUIRED";
|
||||
AlexaErrorType["BRIDGE_UNREACHABLE"] = "BRIDGE_UNREACHABLE";
|
||||
AlexaErrorType["BYPASS_NEEDED"] = "BYPASS_NEEDED";
|
||||
AlexaErrorType["CLOUD_CONTROL_DISABLED"] = "CLOUD_CONTROL_DISABLED";
|
||||
AlexaErrorType["CHILD_LOCK"] = "CHILD_LOCK";
|
||||
AlexaErrorType["CONFIGURATION_UPDATE_NOT_ALLOWED"] = "CONFIGURATION_UPDATE_NOT_ALLOWED";
|
||||
AlexaErrorType["COOK_DURATION_TOO_LONG"] = "COOK_DURATION_TOO_LONG";
|
||||
AlexaErrorType["COOLING_LOCKOUT_TEMPERATURE_VALUE_OUT_OF_RANGE"] = "COOLING_LOCKOUT_TEMPERATURE_VALUE_OUT_OF_RANGE";
|
||||
AlexaErrorType["COOLING_STAGES_EXCEEDS_LIMIT"] = "COOLING_STAGES_EXCEEDS_LIMIT";
|
||||
AlexaErrorType["DATA_DELETION_NOT_SUPPORTED"] = "DATA_DELETION_NOT_SUPPORTED";
|
||||
AlexaErrorType["DATA_RETRIEVAL_NOT_SUPPORTED"] = "DATA_RETRIEVAL_NOT_SUPPORTED";
|
||||
AlexaErrorType["DEVICE_STUCK"] = "DEVICE_STUCK";
|
||||
AlexaErrorType["DISABLED_BY_USER"] = "DISABLED_BY_USER";
|
||||
AlexaErrorType["DO_NOT_DISTURB_MODE"] = "DO_NOT_DISTURB_MODE";
|
||||
AlexaErrorType["DOOR_CLOSED_TOO_LONG"] = "DOOR_CLOSED_TOO_LONG";
|
||||
AlexaErrorType["DOOR_OPEN"] = "DOOR_OPEN";
|
||||
AlexaErrorType["DUAL_SETPOINTS_UNSUPPORTED"] = "DUAL_SETPOINTS_UNSUPPORTED";
|
||||
AlexaErrorType["ENDPOINT_BUSY"] = "ENDPOINT_BUSY";
|
||||
AlexaErrorType["ENDPOINT_CONTROL_UNAVAILABLE"] = "ENDPOINT_CONTROL_UNAVAILABLE";
|
||||
AlexaErrorType["ENDPOINT_LOW_POWER"] = "ENDPOINT_LOW_POWER";
|
||||
AlexaErrorType["ENDPOINT_UNREACHABLE"] = "ENDPOINT_UNREACHABLE";
|
||||
AlexaErrorType["EXCEEDED_PIN_ATTEMPTS"] = "EXCEEDED_PIN_ATTEMPTS";
|
||||
AlexaErrorType["EXPIRED_AUTHORIZATION_CREDENTIAL"] = "EXPIRED_AUTHORIZATION_CREDENTIAL";
|
||||
AlexaErrorType["FAILED_TO_BOOTSTRAP_COMMISSIONING_PROCESS"] = "FAILED_TO_BOOTSTRAP_COMMISSIONING_PROCESS";
|
||||
AlexaErrorType["FIRMWARE_OUT_OF_DATE"] = "FIRMWARE_OUT_OF_DATE";
|
||||
AlexaErrorType["HARDWARE_MALFUNCTION"] = "HARDWARE_MALFUNCTION";
|
||||
AlexaErrorType["HEATING_LOCKOUT_TEMPERATURE_VALUE_OUT_OF_RANGE"] = "HEATING_LOCKOUT_TEMPERATURE_VALUE_OUT_OF_RANGE";
|
||||
AlexaErrorType["HEATING_STAGES_EXCEEDS_LIMIT"] = "HEATING_STAGES_EXCEEDS_LIMIT";
|
||||
AlexaErrorType["INSUFFICIENT_PERMISSIONS"] = "INSUFFICIENT_PERMISSIONS";
|
||||
AlexaErrorType["INSUFFICIENT_RESOURCE"] = "INSUFFICIENT_RESOURCE";
|
||||
AlexaErrorType["INSUFFICIENT_SPACE"] = "INSUFFICIENT_SPACE";
|
||||
AlexaErrorType["INTERNAL_ERROR"] = "INTERNAL_ERROR";
|
||||
AlexaErrorType["INVALID_AUTHORIZATION_CREDENTIAL"] = "INVALID_AUTHORIZATION_CREDENTIAL";
|
||||
AlexaErrorType["INVALID_AUXILIARY_HEATING_SYSTEM_TYPE"] = "INVALID_AUXILIARY_HEATING_SYSTEM_TYPE";
|
||||
AlexaErrorType["INVALID_DIRECTIVE"] = "INVALID_DIRECTIVE";
|
||||
AlexaErrorType["INVALID_SYSTEM_TYPE"] = "INVALID_SYSTEM_TYPE";
|
||||
AlexaErrorType["INVALID_TARGET_STATE"] = "INVALID_TARGET_STATE";
|
||||
AlexaErrorType["INVALID_TEMPERATURE_SCALE"] = "INVALID_TEMPERATURE_SCALE";
|
||||
AlexaErrorType["INVALID_TERMINAL_CONNECTION"] = "INVALID_TERMINAL_CONNECTION";
|
||||
AlexaErrorType["INVALID_VALUE"] = "INVALID_VALUE";
|
||||
AlexaErrorType["MAINTENANCE_REQUIRED"] = "MAINTENANCE_REQUIRED";
|
||||
AlexaErrorType["MAX_COMMISSIONING_LIMIT_REACHED"] = "MAX_COMMISSIONING_LIMIT_REACHED";
|
||||
AlexaErrorType["MISSING_SETUP_INFORMATION"] = "MISSING_SETUP_INFORMATION";
|
||||
AlexaErrorType["NO_SUCH_ENDPOINT"] = "NO_SUCH_ENDPOINT";
|
||||
AlexaErrorType["NOT_CALIBRATED"] = "NOT_CALIBRATED";
|
||||
AlexaErrorType["NOT_IN_OPERATION"] = "NOT_IN_OPERATION";
|
||||
AlexaErrorType["NOT_READY"] = "NOT_READY";
|
||||
AlexaErrorType["NOT_SUPPORTED_IN_CURRENT_MODE"] = "NOT_SUPPORTED_IN_CURRENT_MODE";
|
||||
AlexaErrorType["NOT_SUPPORTED_WITH_CURRENT_BATTERY_CHARGE_STATE"] = "NOT_SUPPORTED_WITH_CURRENT_BATTERY_CHARGE_STATE";
|
||||
AlexaErrorType["OBSTACLE_DETECTED"] = "OBSTACLE_DETECTED";
|
||||
AlexaErrorType["PARTNER_APPLICATION_REDIRECTION"] = "PARTNER_APPLICATION_REDIRECTION";
|
||||
AlexaErrorType["PIN_SETUP_REQUIRED"] = "PIN_SETUP_REQUIRED";
|
||||
AlexaErrorType["POWER_LEVEL_NOT_SUPPORTED"] = "POWER_LEVEL_NOT_SUPPORTED";
|
||||
AlexaErrorType["PREHEAT_REQUIRED"] = "PREHEAT_REQUIRED";
|
||||
AlexaErrorType["PROBE_REQUIRED"] = "PROBE_REQUIRED";
|
||||
AlexaErrorType["RATE_LIMIT_EXCEEDED"] = "RATE_LIMIT_EXCEEDED";
|
||||
AlexaErrorType["REMOTE_START_NOT_SUPPORTED"] = "REMOTE_START_NOT_SUPPORTED";
|
||||
AlexaErrorType["REMOVE_PROBE"] = "REMOVE_PROBE";
|
||||
AlexaErrorType["REMOTE_START_DISABLED"] = "REMOTE_START_DISABLED";
|
||||
AlexaErrorType["REQUESTED_SETPOINTS_TOO_CLOSE"] = "REQUESTED_SETPOINTS_TOO_CLOSE";
|
||||
AlexaErrorType["SAFETY_BEAM_BREACHED"] = "SAFETY_BEAM_BREACHED";
|
||||
AlexaErrorType["SUBSCRIPTION_REQUIRED"] = "SUBSCRIPTION_REQUIRED";
|
||||
AlexaErrorType["TEMPERATURE_VALUE_OUT_OF_RANGE"] = "TEMPERATURE_VALUE_OUT_OF_RANGE";
|
||||
AlexaErrorType["THERMOSTAT_IS_OFF"] = "THERMOSTAT_IS_OFF";
|
||||
AlexaErrorType["TOO_MANY_FAILED_ATTEMPTS"] = "TOO_MANY_FAILED_ATTEMPTS";
|
||||
AlexaErrorType["TRIPLE_SETPOINTS_UNSUPPORTED"] = "TRIPLE_SETPOINTS_UNSUPPORTED";
|
||||
AlexaErrorType["UNABLE_TO_CHARGE"] = "UNABLE_TO_CHARGE";
|
||||
AlexaErrorType["UNAUTHORIZED"] = "UNAUTHORIZED";
|
||||
AlexaErrorType["UNCLEARED_ALARM"] = "UNCLEARED_ALARM";
|
||||
AlexaErrorType["UNSUPPORTED_THERMOSTAT_MODE"] = "UNSUPPORTED_THERMOSTAT_MODE";
|
||||
AlexaErrorType["UNCLEARED_TROUBLE"] = "UNCLEARED_TROUBLE";
|
||||
AlexaErrorType["UNWILLING_TO_SET_SCHEDULE"] = "UNWILLING_TO_SET_SCHEDULE";
|
||||
AlexaErrorType["UNWILLING_TO_SET_VALUE"] = "UNWILLING_TO_SET_VALUE";
|
||||
AlexaErrorType["VALUE_OUT_OF_RANGE"] = "VALUE_OUT_OF_RANGE";
|
||||
})(AlexaErrorType || (AlexaErrorType = {}));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue