UNPKG

lavva.exalushome.extalife

Version:

Library implementing communication and abstraction layers for ExtaLife API in ExalusHome system

2 lines 6.58 kB
"use strict";(self.webpackChunklavva_exalushome_extalife=self.webpackChunklavva_exalushome_extalife||[]).push([[420],{2420:(e,t,n)=>{n.r(t),n.d(t,{SbrConfigService:()=>w});var r=n(624),o=n(8308);class i{constructor(){this.DeviceGuid="",this.TimeInMiliseconds=0,this.ResetOnCrossToOn=!1}}class s{constructor(){this.DeviceGuid="",this.LightDelayInMiliseconds=0}}class a{constructor(){this.DeviceGuid="",this.LightDurationInMiliseconds=0}}var c=n(5046),u=n(6895),l=n(5564),d=n(4533),h=n(6440),v=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};class w{constructor(){this._connection=c.V.Get(u.c.ServiceName),this._logger=c.V.Get(l.m.ServiceName),this._controllerConfigurationService=c.V.Get(d.Q.ServiceName)}GetServiceName(){return w.ServiceName}SetAutoCloseTimeAsync(e,t,n){var o;return v(this,void 0,void 0,(function*(){try{if(t<6e4||t>36e5)return new r.tp(r.ud.WrongData,"Cannot set auto close time - invalid value. Time must be in range from 60_000 to 3_600_000 ms.");this._controllerConfigurationService.EnterConfigurationModeAsync();const i=yield null===(o=this._connection)||void 0===o?void 0:o.SendAndWaitForResponseAsync(new m(e,t,n),8e3,!1);return this._controllerConfigurationService.ExitConfigurationModeAsync(),null==i||null==i.Status?new r.tp(r.ud.UnknownError,"Cannot set auto close time - unknown error."):i.Status!==h.qb.OK?new r.tp(r.ud.UnknownError,`Cannot set auto close time - controller responded with error code: ${i.Status}.`):new r.tp(r.ud.Changed,"Auto close time set successfully.")}catch(e){return new r.tp(r.ud.UnknownError,"Cannot get auto close time - unknown error.")}}))}GetAutoCloseTimeAsync(e){var t;return v(this,void 0,void 0,(function*(){try{const n=yield null===(t=this._connection)||void 0===t?void 0:t.SendAndWaitForResponseAsync(new g(e),8e3,!1);return(null==n?void 0:n.Status)===h.qb.OK?n.Data:new r.tp(o.v.UnknownError,"Cannot get auto close time")}catch(e){return new r.tp(o.v.UnknownError,`Cannot get auto close time error: ${e}`)}}))}SetAlarmLightDelayAsync(e,t){var n;return v(this,void 0,void 0,(function*(){try{if(t<0||t>12e4)return new r.tp(r.ud.WrongData,"Cannot set light delay time - invalid value. Time must be in range from 60_000 to 3_600_000 ms.");this._controllerConfigurationService.EnterConfigurationModeAsync();const o=yield null===(n=this._connection)||void 0===n?void 0:n.SendAndWaitForResponseAsync(new f(e,t),8e3,!1);return this._controllerConfigurationService.ExitConfigurationModeAsync(),null==o||null==o.Status?new r.tp(r.ud.UnknownError,"Cannot set light delay time - unknown error."):o.Status!==h.qb.OK?new r.tp(r.ud.UnknownError,`Cannot set light delay time - controller responded with error code: ${o.Status}.`):new r.tp(r.ud.Changed,"Light delay set successfully.")}catch(e){return new r.tp(r.ud.UnknownError,"Cannot get light delay time - unknown error.")}}))}GetAlarmLightDelayAsync(e){var t;return v(this,void 0,void 0,(function*(){try{const n=yield null===(t=this._connection)||void 0===t?void 0:t.SendAndWaitForResponseAsync(new y(e),8e3,!1);return(null==n?void 0:n.Status)===h.qb.OK?n.Data:new r.tp(o.v.UnknownError,"Cannot get light delay time")}catch(e){return new r.tp(o.v.UnknownError,`Cannot get auto light delay error: ${e}`)}}))}SetAlarmLightDurationAsync(e,t){var n;return v(this,void 0,void 0,(function*(){try{if(t<0||t>36e5)return new r.tp(r.ud.WrongData,"Cannot set alarm light duration time - invalid value. Time must be in range from 60_000 to 3_600_000 ms.");this._controllerConfigurationService.EnterConfigurationModeAsync();const o=yield null===(n=this._connection)||void 0===n?void 0:n.SendAndWaitForResponseAsync(new C(e,t),8e3,!1);return this._controllerConfigurationService.ExitConfigurationModeAsync(),null==o||null==o.Status?new r.tp(r.ud.UnknownError,"Cannot set alarm light duration time - unknown error."):o.Status!==h.qb.OK?new r.tp(r.ud.UnknownError,`Cannot set alarm light duration time - controller responded with error code: ${o.Status}.`):new r.tp(r.ud.Changed,"Alarm light duration set successfully.")}catch(e){return new r.tp(r.ud.UnknownError,"Cannot get alarm light duration time - unknown error.")}}))}GetAlarmLightDurationAsync(e){var t;return v(this,void 0,void 0,(function*(){try{const n=yield null===(t=this._connection)||void 0===t?void 0:t.SendAndWaitForResponseAsync(new p(e),8e3,!1);return(null==n?void 0:n.Status)===h.qb.OK?n.Data:new r.tp(o.v.UnknownError,"Cannot get light delay time")}catch(e){return new r.tp(o.v.UnknownError,`Cannot get auto light delay error: ${e}`)}}))}GetServiceInfoAsync(e){var t;return v(this,void 0,void 0,(function*(){try{const n=yield null===(t=this._connection)||void 0===t?void 0:t.SendAndWaitForResponseAsync(new D(e),8e3,!1);return(null==n?void 0:n.Status)===h.qb.OK?n.Data:new r.tp(o.v.UnknownError,`Cannot get service info, response status: ${null==n?void 0:n.Status}`)}catch(e){return new r.tp(o.v.UnknownError,`Cannot get service info error: ${e}`)}}))}}w.ServiceName="SbrConfigService";class g extends h.NE{constructor(e){super(),this.Resource="/extalife/device/parameters/sbr/autoclosetime",this.Method=h.n$.Get,this.Data=e.GetDevice().Guid}}class m extends h.NE{constructor(e,t,n){super(),this.Resource="/extalife/device/parameters/sbr/autoclosetime",this.Method=h.n$.Put,this.Data=new i,this.Data.DeviceGuid=e.GetDevice().Guid,this.Data.TimeInMiliseconds=t,this.Data.ResetOnCrossToOn=n}}class y extends h.NE{constructor(e){super(),this.Resource="/extalife/device/parameters/sbr/alarmlightdelay",this.Method=h.n$.Get,this.Data=e.GetDevice().Guid}}class f extends h.NE{constructor(e,t){super(),this.Resource="/extalife/device/parameters/sbr/alarmlightdelay",this.Method=h.n$.Put,this.Data=new s,this.Data.DeviceGuid=e.GetDevice().Guid,this.Data.LightDelayInMiliseconds=t}}class p extends h.NE{constructor(e){super(),this.Resource="/extalife/device/parameters/sbr/lightduration",this.Method=h.n$.Get,this.Data=e.GetDevice().Guid}}class C extends h.NE{constructor(e,t){super(),this.Resource="/extalife/device/parameters/sbr/lightduration",this.Method=h.n$.Put,this.Data=new a,this.Data.DeviceGuid=e.GetDevice().Guid,this.Data.LightDurationInMiliseconds=t}}class D extends h.NE{constructor(e){super(),this.Resource="/extalife/device/parameters/sbr/serviceinfo",this.Method=h.n$.Get,this.Data=e.GetDevice().Guid}}}}]); //# sourceMappingURL=420-exalushome-extalife.bundle.js.map