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([[305],{9305:(e,t,n)=>{n.r(t),n.d(t,{Rdp21ConfigService:()=>c});var r,i=n(6440),a=n(624),o=n(6532),s=n(9647);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.c{constructor(){super()}GetServiceName(){return c.ServiceName}GetDimmerInputOutputParamAsync(e,t){var n;return l(this,void 0,void 0,(function*(){try{if(!e.Channels.any((e=>e.Number===t)))return new a.tp(s.w.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.W(e.Guid,t)),8e3,!1);if(null==r||null==r.Status)return new a.tp(s.w.OtherError,"Cannot get input/output parameters - unknown error.");if(r.Status!==i.qb.OK)return new a.tp(s.w.OtherError,`Cannot get input/output parameters - controller responded with error code: ${r.Status}.`);if(null==r.Data)return new a.tp(s.w.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.tp(s.w.OtherError,"Cannot get input/output parameters - unknown error.")}}))}SetDimmerInputOutputParamAsync(e,t){var n;return l(this,void 0,void 0,(function*(){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.c.ServiceName,"Failed to set input/output parameters - unknow error."),i.qb.FatalError):(a.Status!==i.qb.OK&&this._logger.Error(s.c.ServiceName,`Failed to set input/output parameters, response status: ${a.Status}`),a.Status)}catch(e){return i.qb.FatalError}}))}GetBrighteningTimeAsync(e,t){var n;return l(this,void 0,void 0,(function*(){try{if(!e.Channels.any((e=>e.Number===t)))return new a.tp(s.w.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 p(new o.W(e.Guid,t)),8e3,!1);return null==r||null==r.Status?new a.tp(s.w.OtherError,"Cannot get brightening time - unknown error."):r.Status!==i.qb.OK?new a.tp(s.w.OtherError,`Cannot get brightening time - controller responded with error code: ${r.Status}.`):null==r.Data?new a.tp(s.w.NoData,"Cannot get brightening time - no data in response."):r.Data.State}catch(e){return new a.tp(s.w.OtherError,"Cannot get brightening time - unknown error.")}}))}SetBrighteningTimeAsync(e,t,n){var r;return l(this,void 0,void 0,(function*(){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.c.ServiceName,"Failed to set brightening time - unknow error."),i.qb.FatalError):(o.Status!==i.qb.OK&&this._logger.Error(s.c.ServiceName,`Failed to set brightening time, response status: ${o.Status}`),o.Status)}catch(e){return i.qb.FatalError}}))}GetDimmingTimeAsync(e,t){var n;return l(this,void 0,void 0,(function*(){try{if(!e.Channels.any((e=>e.Number===t)))return new a.tp(s.w.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 g(new o.W(e.Guid,t)),8e3,!1);return null==r||null==r.Status?new a.tp(s.w.OtherError,"Cannot get dimming time - unknown error."):r.Status!==i.qb.OK?new a.tp(s.w.OtherError,`Cannot get dimming time - controller responded with error code: ${r.Status}.`):null==r.Data?new a.tp(s.w.NoData,"Cannot get dimming time - no data in response."):r.Data.State}catch(e){return new a.tp(s.w.OtherError,"Cannot get dimming time - unknown error.")}}))}SetDimmingTimeAsync(e,t,n){var r;return l(this,void 0,void 0,(function*(){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 S(a),8e3,!1);return null==o||null==o.Status?(this._logger.Error(s.c.ServiceName,"Failed to set dimming time - unknow error."),i.qb.FatalError):(o.Status!==i.qb.OK&&this._logger.Error(s.c.ServiceName,`Failed to set dimming time, response status: ${o.Status}`),o.Status)}catch(e){return i.qb.FatalError}}))}GetMinLevelAsync(e,t){var n;return l(this,void 0,void 0,(function*(){try{if(!e.Channels.any((e=>e.Number===t)))return new a.tp(s.w.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 b(new o.W(e.Guid,t)),8e3,!1);return null==r||null==r.Status?new a.tp(s.w.OtherError,"Cannot get mimimum light level - unknown error."):r.Status!==i.qb.OK?new a.tp(s.w.OtherError,`Cannot get mimimum light level - controller responded with error code: ${r.Status}.`):null==r.Data?new a.tp(s.w.NoData,"Cannot get mimimum light level - no data in response."):r.Data.State}catch(e){return new a.tp(s.w.OtherError,"Cannot get mimimum light level - unknown error.")}}))}SetMinLevelAsync(e,t,n){var r;return l(this,void 0,void 0,(function*(){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.c.ServiceName,"Failed to set mimimum light level - unknow error."),i.qb.FatalError):(o.Status!==i.qb.OK&&this._logger.Error(s.c.ServiceName,`Failed to set mimimum light level, response status: ${o.Status}`),o.Status)}catch(e){return i.qb.FatalError}}))}GetMaxLevelAsync(e,t){var n;return l(this,void 0,void 0,(function*(){try{if(!e.Channels.any((e=>e.Number===t)))return new a.tp(s.w.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 y(new o.W(e.Guid,t)),8e3,!1);return null==r||null==r.Status?new a.tp(s.w.OtherError,"Cannot get maximum light level - unknown error."):r.Status!==i.qb.OK?new a.tp(s.w.OtherError,`Cannot get maximum light level - controller responded with error code: ${r.Status}.`):null==r.Data?new a.tp(s.w.NoData,"Cannot get maximum light level - no data in response."):r.Data.State}catch(e){return new a.tp(s.w.OtherError,"Cannot get maximum light level - unknown error.")}}))}SetMaxLevelAsync(e,t,n){var r;return l(this,void 0,void 0,(function*(){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 E(a),8e3,!1);return null==o||null==o.Status?(this._logger.Error(s.c.ServiceName,"Failed to set maximum light level - unknow error."),i.qb.FatalError):(o.Status!==i.qb.OK&&this._logger.Error(s.c.ServiceName,`Failed to set maximum light level, response status: ${o.Status}`),o.Status)}catch(e){return i.qb.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.NE{constructor(e){super(),this.Resource="/extalife/device/parameters/input/output",this.Method=i.n$.Get,this.Data=e}}class v extends i.NE{constructor(e){super(),this.Resource="/extalife/device/parameters/input/output",this.Method=i.n$.Put,this.Data=e}}class p extends i.NE{constructor(e){super(),this.Resource="/extalife/device/parameters/brightening/time",this.Method=i.n$.Get,this.Data=e}}class w extends i.NE{constructor(e){super(),this.Resource="/extalife/device/parameters/brightening/time",this.Method=i.n$.Put,this.Data=e}}class g extends i.NE{constructor(e){super(),this.Resource="/extalife/device/parameters/dimming/time",this.Method=i.n$.Get,this.Data=e}}class S extends i.NE{constructor(e){super(),this.Resource="/extalife/device/parameters/dimming/time",this.Method=i.n$.Put,this.Data=e}}class b extends i.NE{constructor(e){super(),this.Resource="/extalife/device/parameters/min/level",this.Method=i.n$.Get,this.Data=e}}class C extends i.NE{constructor(e){super(),this.Resource="/extalife/device/parameters/min/level",this.Method=i.n$.Put,this.Data=e}}class y extends i.NE{constructor(e){super(),this.Resource="/extalife/device/parameters/max/level",this.Method=i.n$.Get,this.Data=e}}class E extends i.NE{constructor(e){super(),this.Resource="/extalife/device/parameters/max/level",this.Method=i.n$.Put,this.Data=e}}}}]);
//# sourceMappingURL=305-exalushome-extalife.bundle.js.map