UNPKG

lavva.exalushome

Version:

Library implementing communication and abstraction layers for ExalusHome system

214 lines (213 loc) 6.22 kB
import { IDeviceTask } from "../Devices/IDeviceTask"; import { AstronomicalClockArgument, AstronomicalClockWithOffsetArgument, ConditionInfoArgument, DayOfWeekArgument, DeviceStateArgument, SimpleTimeSpanArgument, TimeArgument } from "./LeftArgumentTypes"; import { DelayTask, LockExecutionTask, NotifyTask } from "./SceneTaskTypes"; import { SequenceRequestData } from "./ScenesBuilder"; export interface ISequenceInfo { get Guid(): string; get Icon(): string; get DeviceGuid(): string; get Name(): string; get IsDisabled(): boolean; get DoesHaveTriggers(): boolean | undefined; } export interface ISequence extends IRawSequence { Tasks: ISequenceTasks; Guid: string; ObjectType: number; Name: string; Icon: string; AtMeetCondition: boolean; ExecuteOnce: boolean; IsDisabled: boolean; HandledType: HandledType; ConditionType: ConditionsTypes; /** * Timeout in milliseconds */ ConditionTimeout: number; LeftArgumentType: ArgumentType; RightArgumentType: ArgumentType; LeftArgument: ILeftArgument; RightArgument: ISequence | null; get DoesHaveTriggers(): boolean; } export interface IRawSequence { _rawRequestData: SequenceRequestData; } export interface ISequenceTasks { ControllerTasks: ISceneTask[]; } export interface ILeftArgument { HandledType: ArgumentTypeNum; Argument: LeftArgumentTypes | null; } export interface ISceneTask { /** * Generated by library - changes with each request! */ TaskId: string; Guid: string; TaskType: SceneTaskType; Task: SceneTasks; } export declare enum SceneTaskTypeNum { Unknown = -1, DeviceTask = 0, DelayTask = 1, NotifyTask = 2, LockExecution = 3 } export declare enum SceneTaskType { Unknown = "Unknown", DeviceTask = "DeviceTask", DelayTask = "DelayTask", NotifyTask = "NotifyTask", LockExecution = "LockExecution" } export type SceneTasks = { "DeviceTask": IDeviceTask; "DelayTask": DelayTask; "NotifyTask": NotifyTask; "LockExecution": LockExecutionTask; }; export type LeftArgumentTypes = { "ArgumentAsAstronomicalClock": AstronomicalClockArgument; "ArgumentAsAstronomicalClockWithOffset": AstronomicalClockWithOffsetArgument; "ArgumentAsBoolean": boolean; "ArgumentAsDaysOfWeek": DayOfWeekArgument[]; "ArgumentAsDayOfWeek": DayOfWeekArgument; "ArgumentAsInt": number; "ArgumentAsTimeout": number; "ArgumentAsTimeSpan": SimpleTimeSpanArgument; "ArgumentAsTime": TimeArgument; "ArgumentAsDeviceState": DeviceStateArgument; "ArgumentAsConditionInfo": ConditionInfoArgument; }; export declare enum HandledType { Unknown = 0, Second = 1, Minute = 2, Hour = 3, Day = 4, DayOfWeek = 5, Month = 6, Year = 7, Date = 8, Time = 9, WeatherType = 11, CompareNumbers = 12, CompareBooleans = 13, DeviceState = 14, Timer = 15, Temperature = 17, DaysOfWeek = 18, AstronomicalClockWithOffset = 19, SceneExecuted = 20 } export declare enum ConditionsTypes { Unknown = 0, Equal = 1, NotEqueal = 2, BiggerThan = 3, SmallerThan = 4, BiggerThanOrEqual = 5, SmallerThanOrEqual = 6, OneOfBothIsTrue = 7, BothAreTrue = 8 } export declare enum DeviceStateType { Unknown = 0, BatteryState = 1, BinarySensor = 2, BlindPosition = 3, Brightness = 4, ButtonState = 5, ChannelOnOff = 6, DoorBell = 7, Energy = 8, FloodSensor = 9, GatePosition = 10, HeatSensor = 11, LightBrightness = 12, LightColor = 13, LightTemperature = 14, MeasuredCurrent = 15, MeasuredPower = 16, MeasuredVoltage = 17, ReedState = 18, SmokeSensor = 19, Temperature = 20, BlindsControlButton = 21, Movement = 22, WindSpeed = 24, Humidity = 25, AirPressure = 26, WindThreshold = 31, FacadeControlButton = 36 } export declare enum ArgumentTypeNum { Null = 0, Condition = 1, ConditionGroup = 2, ArgumentAsInt = 3, ArgumentAsTimeSpan = 4, ArgumentAsBoolean = 5, ArgumentAsTimeout = 6, ArgumentAsDayOfWeek = 7, ArgumentAsDaysOfWeek = 8, ArgumentAsAstronomicalClock = 9, ArgumentAsTime = 10, ArgumentAsDeviceState = 11, ArgumentAsNumber = 12, ArgumentAsAstronomicalClockWithOffset = 13, ArgumentAsConditionInfo = 14 } export declare enum ArgumentType { Null = "Null", Condition = "Condition", ConditionGroup = "ConditionGroup", ArgumentAsInt = "ArgumentAsInt", ArgumentAsTimeSpan = "ArgumentAsTimeSpan", ArgumentAsBoolean = "ArgumentAsBoolean", ArgumentAsTimeout = "ArgumentAsTimeout", ArgumentAsDayOfWeek = "ArgumentAsDayOfWeek", ArgumentAsDaysOfWeek = "ArgumentAsDaysOfWeek", ArgumentAsAstronomicalClock = "ArgumentAsAstronomicalClock", ArgumentAsTime = "ArgumentAsTime", ArgumentAsDeviceState = "ArgumentAsDeviceState", ArgumentAsNumber = "ArgumentAsNumber", ArgumentAsAstronomicalClockWithOffset = "ArgumentAsAstronomicalClockWithOffset", ArgumentAsConditionInfo = "ArgumentAsConditionInfo" } export declare enum SupportedTaskTypes { DeviceTask = "DeviceTask", DelayTask = "DelayTask", LockExecutionTask = "LockExecutionTask", NotifyTaskAppNotify = "NotifyTaskAppNotify", NotifyTaskEmailNotify = "NotifyTaskEmailNotify" } export type ScenesUtils = { GetSunRiseTime: () => Date; GetSunSetTime: () => Date; /** * Parsing lux value to linear scale - returns value between 0.0 and 1.0 * @param luxValue */ ParseLuxToLinearScale(luxValue: number): number; /** * Parsing linear scale (between 0.0 and 1.0) to lux in range 0 to 100_000 * If scale is incorrect (below 0 or above 1) returns undefined * @param linearScaleVal */ ParseLinearScaleToLux(linearScaleVal: number): number | undefined; }; export declare class ScenesUsedIn { Guid: string; SceneName: string; ConditionsAsSceneExecuted: string[]; ConditionsAsSceneLock: string[]; } export declare class UnsupportedScenesDeviceState extends Error { message: string; constructor(message: string); }