lavva.exalushome.extalife
Version:
Library implementing communication and abstraction layers for ExtaLife API in ExalusHome system
339 lines • 11.2 kB
JavaScript
export var RemoteMode;
(function (RemoteMode) {
RemoteMode[RemoteMode["OnOff"] = 1] = "OnOff";
RemoteMode[RemoteMode["Bistable"] = 2] = "Bistable";
RemoteMode[RemoteMode["Monostable"] = 3] = "Monostable";
RemoteMode[RemoteMode["Timer"] = 4] = "Timer";
RemoteMode[RemoteMode["Local"] = 5] = "Local";
RemoteMode[RemoteMode["Central"] = 6] = "Central";
RemoteMode[RemoteMode["PixoBidi_1"] = 7] = "PixoBidi_1";
RemoteMode[RemoteMode["PixoBidi_12"] = 8] = "PixoBidi_12";
RemoteMode[RemoteMode["TwoButton"] = 9] = "TwoButton";
RemoteMode[RemoteMode["OneButton"] = 10] = "OneButton";
RemoteMode[RemoteMode["Comfort"] = 11] = "Comfort";
RemoteMode[RemoteMode["TimerDimmer"] = 12] = "TimerDimmer";
RemoteMode[RemoteMode["Gate"] = 13] = "Gate";
RemoteMode[RemoteMode["GateWay"] = 14] = "GateWay";
RemoteMode[RemoteMode["NXZFBidi"] = 15] = "NXZFBidi";
RemoteMode[RemoteMode["PXZFBidi"] = 16] = "PXZFBidi";
RemoteMode[RemoteMode["WSZFBidi"] = 17] = "WSZFBidi";
})(RemoteMode || (RemoteMode = {}));
export var DeviceType;
(function (DeviceType) {
DeviceType[DeviceType["OnOff"] = 1] = "OnOff";
DeviceType[DeviceType["Blind"] = 2] = "Blind";
DeviceType[DeviceType["Dimmer"] = 3] = "Dimmer";
DeviceType[DeviceType["Gate"] = 4] = "Gate";
DeviceType[DeviceType["Gateway"] = 5] = "Gateway";
DeviceType[DeviceType["Facade"] = 6] = "Facade";
})(DeviceType || (DeviceType = {}));
export class DeviceTypeMode {
}
DeviceTypeMode.AvailableModes = {
[DeviceType.OnOff]: {
[RemoteMode.OnOff]: RemoteMode.OnOff,
[RemoteMode.Bistable]: RemoteMode.Bistable,
[RemoteMode.Monostable]: RemoteMode.Monostable,
[RemoteMode.Timer]: RemoteMode.Timer
},
[DeviceType.Blind]: {
[RemoteMode.PixoBidi_1]: RemoteMode.PixoBidi_1,
[RemoteMode.PixoBidi_12]: RemoteMode.PixoBidi_12,
},
[DeviceType.Dimmer]: {
[RemoteMode.TwoButton]: RemoteMode.TwoButton,
[RemoteMode.OneButton]: RemoteMode.OneButton,
[RemoteMode.Comfort]: RemoteMode.Comfort,
[RemoteMode.TimerDimmer]: RemoteMode.TimerDimmer,
},
[DeviceType.Gate]: {
[RemoteMode.Gate]: RemoteMode.Gate,
[RemoteMode.Bistable]: RemoteMode.Bistable
},
[DeviceType.Gateway]: {
[RemoteMode.GateWay]: RemoteMode.GateWay,
[RemoteMode.Bistable]: RemoteMode.Bistable
},
[DeviceType.Facade]: {
[RemoteMode.NXZFBidi]: RemoteMode.NXZFBidi,
[RemoteMode.PXZFBidi]: RemoteMode.PXZFBidi,
[RemoteMode.WSZFBidi]: RemoteMode.WSZFBidi
}
};
class RemoteDeviceResponse {
constructor() {
this.DeviceGuid = "";
this.Channel = 0;
this.Guid = "";
this.Name = "";
this.RemoteChannelAmount = 0;
this.DeviceChannelAmount = 0;
this.PairingOption = new PairingOption();
this.OldSettingsOptional = new PairingOption();
this.DeviceType = DeviceType.OnOff;
}
}
class PairingOption {
constructor() {
this.Mode = RemoteMode.Bistable;
this.KeyOn = 0;
this.KeyOff = 0;
this.KeyBrightening = 0;
this.KeyDimmer = 0;
this.TimeOn = 0;
this.Channel = 0;
}
}
//Params
class OnOffParameters {
constructor(remoteChannels, options) {
this._remoteChannels = remoteChannels;
this._keyOn = options.KeyOn;
this._keyOff = options.KeyOff;
}
get KeyOn() {
return this._keyOn;
}
get KeyOff() {
return this._keyOff;
}
set KeyOn(value) {
this._keyOn = value;
}
set KeyOff(value) {
this._keyOff = value;
}
}
class ChannelParameters {
constructor(remoteChannels, options) {
this._remoteChannels = remoteChannels;
this._channel = options.Channel;
}
get Channel() {
return this._channel;
}
set Channel(value) {
this._channel = value;
}
}
class BistableMonostableParameters {
constructor(remoteChannels, options) {
this._remoteChannels = remoteChannels;
this._keyOn = options.KeyOn;
}
get KeyOn() {
return this._keyOn;
}
set KeyOn(value) {
this._keyOn = value;
}
}
class TimerParameters {
constructor(remoteChannels, options) {
this._remoteChannels = remoteChannels;
this._keyOn = options.KeyOn;
this._timeOn = options.TimeOn;
}
get KeyOn() {
return this._keyOn;
}
set KeyOn(value) {
this._keyOn = value;
}
get TimeOn() {
return this._timeOn;
}
set TimeOn(value) {
this._timeOn = value;
}
}
class DimmingBrighteningParameters {
constructor(remoteChannels, options) {
this._remoteChannels = remoteChannels;
this._keyOn = options.KeyOn;
this._keyOff = options.KeyOff;
this._keyBrightening = options.KeyBrightening;
this._keyDimmer = options.KeyDimmer;
}
get KeyOn() {
return this._keyOn;
}
set KeyOn(value) {
this._keyOn = value;
}
get KeyOff() {
return this._keyOff;
}
set KeyOff(value) {
this._keyOff = value;
}
get KeyBrightening() {
return this._keyBrightening;
}
set KeyBrightening(value) {
this._keyBrightening = value;
}
get KeyDimmer() {
return this._keyDimmer;
}
set KeyDimmer(value) {
this._keyDimmer = value;
}
}
class OnOffOptions {
constructor(remoteChannels, options) {
this.ModeParams = {
[RemoteMode.OnOff]: new OnOffParameters(remoteChannels, options),
[RemoteMode.Bistable]: new BistableMonostableParameters(remoteChannels, options),
[RemoteMode.Monostable]: new BistableMonostableParameters(remoteChannels, options),
[RemoteMode.Timer]: new TimerParameters(remoteChannels, options)
};
}
}
class BlindOptions {
constructor(remoteChannels, options) {
this.ModeParams = {
[RemoteMode.PixoBidi_1]: new ChannelParameters(remoteChannels, options),
[RemoteMode.PixoBidi_12]: new ChannelParameters(remoteChannels, options),
};
}
}
class DimmerOptions {
constructor(remoteChannels, options) {
this.ModeParams = {
[RemoteMode.TwoButton]: new OnOffParameters(remoteChannels, options),
[RemoteMode.OneButton]: new BistableMonostableParameters(remoteChannels, options),
[RemoteMode.Comfort]: new DimmingBrighteningParameters(remoteChannels, options),
[RemoteMode.TimerDimmer]: new TimerParameters(remoteChannels, options),
};
}
}
class GateOptions {
constructor(remoteChannels, options) {
this.ModeParams = {
[RemoteMode.Gate]: new BistableMonostableParameters(remoteChannels, options),
[RemoteMode.Bistable]: new BistableMonostableParameters(remoteChannels, options),
};
}
}
class GateWayOptions {
constructor(remoteChannels, options) {
this.ModeParams = {
[RemoteMode.GateWay]: new BistableMonostableParameters(remoteChannels, options),
[RemoteMode.Bistable]: new BistableMonostableParameters(remoteChannels, options),
};
}
}
class FacadeOptions {
constructor(remoteChannels, options) {
this.ModeParams = {
[RemoteMode.NXZFBidi]: new ChannelParameters(remoteChannels, options),
[RemoteMode.PXZFBidi]: new ChannelParameters(remoteChannels, options),
[RemoteMode.WSZFBidi]: null
};
}
}
export class RemoteDevice {
constructor(data) {
this._configs = {};
this._deviceGuid = "";
this._channel = 0;
this._guid = "";
this._name = "";
this._remoteChannelAmount = 0;
this._deviceChannelAmount = 0;
this._deviceType = DeviceType.OnOff;
this._remoteMode = RemoteMode.OnOff;
this._deviceGuid = data.DeviceGuid;
this._channel = data.Channel;
this._guid = data.Guid;
this._name = data.Name;
this._remoteChannelAmount = data.RemoteChannelAmount;
this._deviceChannelAmount = data.DeviceChannelAmount;
this._deviceType = data.DeviceType;
this._remoteMode = data.PairingOption.Mode;
this._rawCurrentRemoteOptions = data.PairingOption;
this._rawOldRemoteOptions = data.OldSettingsOptional;
switch (data.DeviceType) {
case DeviceType.OnOff:
this._configs.OnOffOptions = new OnOffOptions(this._remoteChannelAmount, data.PairingOption);
break;
case DeviceType.Blind:
this._configs.BlindOptions = new BlindOptions(this._remoteChannelAmount, data.PairingOption);
break;
case DeviceType.Dimmer:
this._configs.DimmerOptions = new DimmerOptions(this._remoteChannelAmount, data.PairingOption);
break;
case DeviceType.Gate:
this._configs.GateOptions = new GateOptions(this._remoteChannelAmount, data.PairingOption);
break;
case DeviceType.Gateway:
this._configs.GateWayOptions = new GateWayOptions(this._remoteChannelAmount, data.PairingOption);
break;
case DeviceType.Facade:
this._configs.FacadeOptions = new FacadeOptions(this._remoteChannelAmount, data.PairingOption);
break;
}
this._currentRemotePairingOptions = {
[DeviceType.OnOff]: this._configs.OnOffOptions,
[DeviceType.Blind]: this._configs.BlindOptions,
[DeviceType.Dimmer]: this._configs.DimmerOptions,
[DeviceType.Gate]: this._configs.GateOptions,
[DeviceType.Gateway]: this._configs.GateWayOptions,
[DeviceType.Facade]: this._configs.FacadeOptions
};
}
get DeviceGuid() {
return this._deviceGuid;
}
set DeviceGuid(value) {
this._deviceGuid = value;
}
get Channel() {
return this._channel;
}
set Channel(value) {
this._channel = value;
}
get Guid() {
return this._guid;
}
set Guid(value) {
this._guid = value;
}
get Name() {
return this._name;
}
set Name(value) {
this._name = value;
}
get RemoteChannelAmount() {
return this._remoteChannelAmount;
}
get DeviceChannelAmount() {
return this._deviceChannelAmount;
}
get DeviceType() {
return this._deviceType;
}
set DeviceType(value) {
this._deviceType = value;
}
get RemoteMode() {
return this._remoteMode;
}
set RemoteMode(value) {
this._remoteMode = value;
this._rawCurrentRemoteOptions.Mode = value;
}
get CurrentRemotePairingOptions() {
return this._currentRemotePairingOptions;
}
get RawCurrentRemoteOptions() {
return this._rawCurrentRemoteOptions;
}
get RawOldRemoteOptions() {
return this._rawOldRemoteOptions;
}
}
//# sourceMappingURL=RemoteParams.js.map