initial release of Alex2Node

This commit is contained in:
David 2025-04-20 21:19:57 +00:00
parent 0804bd7397
commit 4eb2a84d72
20 changed files with 2047 additions and 3 deletions

41
src/ActionMapping.ts Normal file
View file

@ -0,0 +1,41 @@
export enum AlexaActions {
Open = "Alexa.Actions.Open",
Close = "Alexa.Actions.Close",
Raise = "Alexa.Actions.Raise",
Lower = "Alexa.Actions.Lower",
SetEcoOn = "Alexa.Actions.SetEcoOn",
SetEcoOff = "Alexa.Actions.SetEcoOff",
}
interface Directive {
name: string;
payload?: string;
}
export class ActionMapping {
type: string = "ActionsToDirective";
actions: AlexaActions[];
directive: Directive;
constructor(
actions: AlexaActions[],
directiveName: string,
directivePayload: string | undefined
) {
this.actions = actions;
this.directive = {
name: directiveName,
};
if (directivePayload) {
this.directive.payload = directivePayload;
}
}
toJSON(): object {
return {
"@type": this.type,
actions: this.actions,
directive: this.directive,
};
}
}