lavva.exalushome.extalife
Version:
Library implementing communication and abstraction layers for ExtaLife API in ExalusHome system
2 lines • 9.17 kB
JavaScript
"use strict";(self.webpackChunklavva_exalushome_extalife=self.webpackChunklavva_exalushome_extalife||[]).push([[119],{9119:(e,t,n)=>{n.r(t),n.d(t,{Rdp21ConfigService:()=>c});var r,i=n(4756),a=n(6823),o=n(9592),s=n(7946);class u{constructor(){this.Channel=0,this.InputModeDimmer=r.Monostable}}!function(e){e[e.Monostable=0]="Monostable",e[e.Time=1]="Time",e[e.Bistable=2]="Bistable"}(r||(r={}));var l=function(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{u(r.next(e))}catch(e){a(e)}}function s(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((r=r.apply(e,t||[])).next())}))};class c extends s.y{constructor(){super()}GetServiceName(){return c.ServiceName}GetDimmerInputOutputParamAsync(e,t){return l(this,void 0,void 0,(function*(){var n;try{if(!e.Channels.any((e=>e.Number===t)))return new a.ZR(s.S.InvalidChannelNumber,`Cannot get input/output parameters - invalid channel number, channel: ${t}`);const r=yield null===(n=this._connection)||void 0===n?void 0:n.SendAndWaitForResponseAsync(new m(new o.z(e.Guid,t)),8e3,!1);if(null==r||null==r.Status)return new a.ZR(s.S.OtherError,"Cannot get input/output parameters - unknown error.");if(r.Status!==i.nW.OK)return new a.ZR(s.S.OtherError,`Cannot get input/output parameters - controller responded with error code: ${r.Status}.`);if(null==r.Data)return new a.ZR(s.S.NoData,"Cannot get input/output parameters - no data in response.");const l=r.Data.first(),c=new u;return c.Channel=l.Channel,c.InputModeDimmer=l.InputModeDimmer,c}catch(e){return new a.ZR(s.S.OtherError,"Cannot get input/output parameters - unknown error.")}}))}SetDimmerInputOutputParamAsync(e,t){return l(this,void 0,void 0,(function*(){var n;try{const r=new h;r.DeviceGuid=e.Guid,r.Channel=t.Channel,r.InputModeDimmer=t.InputModeDimmer;const a=yield null===(n=this._connection)||void 0===n?void 0:n.SendAndWaitForResponseAsync(new v(r),8e3,!1);return null==a||null==a.Status?(this._logger.Error(s.y.ServiceName,"Failed to set input/output parameters - unknow error."),i.nW.FatalError):(a.Status!==i.nW.OK&&this._logger.Error(s.y.ServiceName,`Failed to set input/output parameters, response status: ${a.Status}`),a.Status)}catch(e){return i.nW.FatalError}}))}GetBrighteningTimeAsync(e,t){return l(this,void 0,void 0,(function*(){var n;try{if(!e.Channels.any((e=>e.Number===t)))return new a.ZR(s.S.InvalidChannelNumber,`Cannot get brightening time - invalid channel number, channel: ${t}`);const r=yield null===(n=this._connection)||void 0===n?void 0:n.SendAndWaitForResponseAsync(new S(new o.z(e.Guid,t)),8e3,!1);return null==r||null==r.Status?new a.ZR(s.S.OtherError,"Cannot get brightening time - unknown error."):r.Status!==i.nW.OK?new a.ZR(s.S.OtherError,`Cannot get brightening time - controller responded with error code: ${r.Status}.`):null==r.Data?new a.ZR(s.S.NoData,"Cannot get brightening time - no data in response."):r.Data.State}catch(e){return new a.ZR(s.S.OtherError,"Cannot get brightening time - unknown error.")}}))}SetBrighteningTimeAsync(e,t,n){return l(this,void 0,void 0,(function*(){var r;try{const a=new d;a.DeviceGuid=e.Guid,a.Channel=t,a.State=n;const o=yield null===(r=this._connection)||void 0===r?void 0:r.SendAndWaitForResponseAsync(new g(a),8e3,!1);return null==o||null==o.Status?(this._logger.Error(s.y.ServiceName,"Failed to set brightening time - unknow error."),i.nW.FatalError):(o.Status!==i.nW.OK&&this._logger.Error(s.y.ServiceName,`Failed to set brightening time, response status: ${o.Status}`),o.Status)}catch(e){return i.nW.FatalError}}))}GetDimmingTimeAsync(e,t){return l(this,void 0,void 0,(function*(){var n;try{if(!e.Channels.any((e=>e.Number===t)))return new a.ZR(s.S.InvalidChannelNumber,`Cannot get dimming time - invalid channel number, channel: ${t}`);const r=yield null===(n=this._connection)||void 0===n?void 0:n.SendAndWaitForResponseAsync(new p(new o.z(e.Guid,t)),8e3,!1);return null==r||null==r.Status?new a.ZR(s.S.OtherError,"Cannot get dimming time - unknown error."):r.Status!==i.nW.OK?new a.ZR(s.S.OtherError,`Cannot get dimming time - controller responded with error code: ${r.Status}.`):null==r.Data?new a.ZR(s.S.NoData,"Cannot get dimming time - no data in response."):r.Data.State}catch(e){return new a.ZR(s.S.OtherError,"Cannot get dimming time - unknown error.")}}))}SetDimmingTimeAsync(e,t,n){return l(this,void 0,void 0,(function*(){var r;try{const a=new d;a.DeviceGuid=e.Guid,a.Channel=t,a.State=n;const o=yield null===(r=this._connection)||void 0===r?void 0:r.SendAndWaitForResponseAsync(new w(a),8e3,!1);return null==o||null==o.Status?(this._logger.Error(s.y.ServiceName,"Failed to set dimming time - unknow error."),i.nW.FatalError):(o.Status!==i.nW.OK&&this._logger.Error(s.y.ServiceName,`Failed to set dimming time, response status: ${o.Status}`),o.Status)}catch(e){return i.nW.FatalError}}))}GetMinLevelAsync(e,t){return l(this,void 0,void 0,(function*(){var n;try{if(!e.Channels.any((e=>e.Number===t)))return new a.ZR(s.S.InvalidChannelNumber,`Cannot get mimimum light level - invalid channel number, channel: ${t}`);const r=yield null===(n=this._connection)||void 0===n?void 0:n.SendAndWaitForResponseAsync(new y(new o.z(e.Guid,t)),8e3,!1);return null==r||null==r.Status?new a.ZR(s.S.OtherError,"Cannot get mimimum light level - unknown error."):r.Status!==i.nW.OK?new a.ZR(s.S.OtherError,`Cannot get mimimum light level - controller responded with error code: ${r.Status}.`):null==r.Data?new a.ZR(s.S.NoData,"Cannot get mimimum light level - no data in response."):r.Data.State}catch(e){return new a.ZR(s.S.OtherError,"Cannot get mimimum light level - unknown error.")}}))}SetMinLevelAsync(e,t,n){return l(this,void 0,void 0,(function*(){var r;try{const a=new d;a.DeviceGuid=e.Guid,a.Channel=t,a.State=n;const o=yield null===(r=this._connection)||void 0===r?void 0:r.SendAndWaitForResponseAsync(new C(a),8e3,!1);return null==o||null==o.Status?(this._logger.Error(s.y.ServiceName,"Failed to set mimimum light level - unknow error."),i.nW.FatalError):(o.Status!==i.nW.OK&&this._logger.Error(s.y.ServiceName,`Failed to set mimimum light level, response status: ${o.Status}`),o.Status)}catch(e){return i.nW.FatalError}}))}GetMaxLevelAsync(e,t){return l(this,void 0,void 0,(function*(){var n;try{if(!e.Channels.any((e=>e.Number===t)))return new a.ZR(s.S.InvalidChannelNumber,`Cannot get maximum light level - invalid channel number, channel: ${t}`);const r=yield null===(n=this._connection)||void 0===n?void 0:n.SendAndWaitForResponseAsync(new R(new o.z(e.Guid,t)),8e3,!1);return null==r||null==r.Status?new a.ZR(s.S.OtherError,"Cannot get maximum light level - unknown error."):r.Status!==i.nW.OK?new a.ZR(s.S.OtherError,`Cannot get maximum light level - controller responded with error code: ${r.Status}.`):null==r.Data?new a.ZR(s.S.NoData,"Cannot get maximum light level - no data in response."):r.Data.State}catch(e){return new a.ZR(s.S.OtherError,"Cannot get maximum light level - unknown error.")}}))}SetMaxLevelAsync(e,t,n){return l(this,void 0,void 0,(function*(){var r;try{const a=new d;a.DeviceGuid=e.Guid,a.Channel=t,a.State=n;const o=yield null===(r=this._connection)||void 0===r?void 0:r.SendAndWaitForResponseAsync(new f(a),8e3,!1);return null==o||null==o.Status?(this._logger.Error(s.y.ServiceName,"Failed to set maximum light level - unknow error."),i.nW.FatalError):(o.Status!==i.nW.OK&&this._logger.Error(s.y.ServiceName,`Failed to set maximum light level, response status: ${o.Status}`),o.Status)}catch(e){return i.nW.FatalError}}))}}c.ServiceName="Rdp21ConfigService";class d{constructor(){this.Channel=0,this.DeviceGuid="",this.State=0,this.StateOptional=0}}class h extends u{constructor(){super(...arguments),this.DeviceGuid=""}}class m extends i.CP{constructor(e){super(),this.Resource="/extalife/device/parameters/input/output",this.Method=i.IT.Get,this.Data=e}}class v extends i.CP{constructor(e){super(),this.Resource="/extalife/device/parameters/input/output",this.Method=i.IT.Put,this.Data=e}}class S extends i.CP{constructor(e){super(),this.Resource="/extalife/device/parameters/brightening/time",this.Method=i.IT.Get,this.Data=e}}class g extends i.CP{constructor(e){super(),this.Resource="/extalife/device/parameters/brightening/time",this.Method=i.IT.Put,this.Data=e}}class p extends i.CP{constructor(e){super(),this.Resource="/extalife/device/parameters/dimming/time",this.Method=i.IT.Get,this.Data=e}}class w extends i.CP{constructor(e){super(),this.Resource="/extalife/device/parameters/dimming/time",this.Method=i.IT.Put,this.Data=e}}class y extends i.CP{constructor(e){super(),this.Resource="/extalife/device/parameters/min/level",this.Method=i.IT.Get,this.Data=e}}class C extends i.CP{constructor(e){super(),this.Resource="/extalife/device/parameters/min/level",this.Method=i.IT.Put,this.Data=e}}class R extends i.CP{constructor(e){super(),this.Resource="/extalife/device/parameters/max/level",this.Method=i.IT.Get,this.Data=e}}class f extends i.CP{constructor(e){super(),this.Resource="/extalife/device/parameters/max/level",this.Method=i.IT.Put,this.Data=e}}}}]);
//# sourceMappingURL=119-exalushome-extalife.bundle.js.map