UNPKG

lavva.exalushome.extalife

Version:

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

2 lines 5.09 kB
"use strict";(self.webpackChunklavva_exalushome_extalife=self.webpackChunklavva_exalushome_extalife||[]).push([[500],{500:(e,n,t)=>{t.r(n),t.d(n,{SsrConfigService:()=>w});var r=t(1701);class a extends r.l{}var s=t(7460),i=t(624),o=t(6440),u=t(7418),l=t(2160),c=function(e,n,t,r){return new(t||(t=Promise))((function(a,s){function i(e){try{u(r.next(e))}catch(e){s(e)}}function o(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){var n;e.done?a(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,o)}u((r=r.apply(e,n||[])).next())}))};class d extends r.l{constructor(){super()}RunAutomaticCalibrationAsync(e,n){var t;return c(this,void 0,void 0,(function*(){try{if(!e.Channels.any((e=>e.Number===n)))return new i.tp(r.J.InvalidChannelNumber,`Cannot calibrate blind - invalid channel number: ${n}`);const c=new u.LO;if(c.Action=u.IC.Stop,(yield e.Channels.first((e=>e.Number==n)).ExecuteTaskAsync(c))!==l.G.Executed)return new i.tp(r.J.DeviceNotResponding,"Cannot calibrate blind - device is not responding.");const d=yield null===(t=this._connection)||void 0===t?void 0:t.SendAndWaitForResponseAsync(new h(e.Guid),8e3,!1);if(null==d||null==d.Status)return new i.tp(r.J.OtherError,"Cannot calibrate blind - calibration request failed for an unknown reason.");switch(d.Status){case o.qb.OK:var a=new s.nv;return a.CalibrationStatus=s.oQ.AutoLernInProgress,a.Channel=n,a.StateReliability=s.op.Confident,a;case o.qb.Error:return new i.tp(r.J.CalibrationsIsCurrentlyRunning,"Cannot calibrate blind - calibration is currently running.");default:return new i.tp(r.J.OtherError,`Cannot calibrate blind - calibration request failed - request status code: ${d.Status}`)}}catch(e){return new i.tp(r.J.OtherError,`Cannot calibrate blind - fatal error: ${e}`)}}))}GetHeadSensorStatusAsync(e,n){var t;return c(this,void 0,void 0,(function*(){try{if(!e.Channels.any((e=>e.Number===n)))return new i.tp(r.J.InvalidChannelNumber,`Cannot get head sensor status - invalid channel number: ${n}`);const a=yield null===(t=this._connection)||void 0===t?void 0:t.SendAndWaitForResponseAsync(new v(e.Guid,n),8e3,!1);return null==a||null==a.Status?new i.tp(r.J.OtherError,"Cannot get head sensor status - request failed for an unknown reason."):a.Status!=o.qb.OK?new i.tp(r.J.OtherError,`Cannot get head sensor status - request failed - request status code: ${a.Status}`):null==a.Data?new i.tp(r.J.NoData,"Cannot get head sensor status - request failed - no data received."):a.Data}catch(e){return new i.tp(r.J.OtherError,`Cannot get head sensor status - fatal error: ${e}`)}}))}SwitchHeadSensorStatusAsync(e,n,t){var r;return c(this,void 0,void 0,(function*(){try{if(!n.Channels.any((e=>e.Number===t)))return o.qb.WrongData;const a=yield null===(r=this._connection)||void 0===r?void 0:r.SendAndWaitForResponseAsync(new b(n.Guid,t,e),8e3,!1);return null==a||null==a.Status?o.qb.FatalError:a.Status}catch(e){return o.qb.FatalError}}))}ChangeMovementDirectionAsync(e,n){var t;return c(this,void 0,void 0,(function*(){try{if(!e.Channels.any((e=>e.Number===n)))return o.qb.WrongData;const r=yield null===(t=this._connection)||void 0===t?void 0:t.SendAndWaitForResponseAsync(new f(e.Guid,n),8e3,!1);return null==r||null==r.Status?o.qb.FatalError:r.Status}catch(e){return o.qb.FatalError}}))}GetWorkLogAsync(e,n){var t;return c(this,void 0,void 0,(function*(){try{if(!e.Channels.any((e=>e.Number===n)))return new i.tp(r.J.InvalidChannelNumber,`Cannot get head sensor status - invalid channel number: ${n}`);const a=yield null===(t=this._connection)||void 0===t?void 0:t.SendAndWaitForResponseAsync(new C(e.Guid,n),8e3,!1);return null==a||null==a.Status?new i.tp(r.J.OtherError,"Cannot get work log - request failed for an unknown reason."):a.Status!=o.qb.OK?new i.tp(r.J.OtherError,`Cannot get work log - request failed - request status code: ${a.Status}`):null==a.Data?new i.tp(r.J.NoData,"Cannot get work log - request failed - no data received."):a.Data}catch(e){return new i.tp(r.J.OtherError,`Cannot get work log - fatal error: ${e}`)}}))}}class h extends o.NE{constructor(e){super(),this.Resource="/extafree2/blind/calibration/auto",this.Method=o.n$.Get,this.Data=e}}class v extends o.NE{constructor(e,n){super(),this.Resource="/extalife/device/blind/head/sensor/status",this.Method=o.n$.Get,this.Data={DeviceGuid:e,Channel:n}}}class b extends o.NE{constructor(e,n,t){super(),this.Resource="/extalife/device/blind/head/sensor/switch",this.Method=o.n$.Put,this.Data={DeviceGuid:e,Channel:n,Enable:t}}}class f extends o.NE{constructor(e,n){super(),this.Resource="/extalife/device/blind/direction/reverse",this.Method=o.n$.Post,this.Data={DeviceGuid:e,Channel:n}}}class C extends o.NE{constructor(e,n){super(),this.Resource="/extalife/device/blind/work/log",this.Method=o.n$.Get,this.Data={DeviceGuid:e,Channel:n}}}class w extends a{constructor(){super(),this._services={Ssr_4_0_0_0:new d}}GetServiceName(){return w.ServiceName}VersionedConfigurationOptions(){return{"^4.0.0.0":this._services.Ssr_4_0_0_0}}}w.ServiceName="SsrConfigService"}}]); //# sourceMappingURL=500-exalushome-extalife.bundle.js.map