bt-sensors-plugin-sk 1.1.0 → 1.2.0-beta.0.0.1.test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,65 @@
1
+ /*
2
+ object-assign
3
+ (c) Sindre Sorhus
4
+ @license MIT
5
+ */
6
+
7
+ /*!
8
+ Copyright (c) 2018 Jed Watson.
9
+ Licensed under the MIT License (MIT), see
10
+ http://jedwatson.github.io/classnames
11
+ */
12
+
13
+ /**
14
+ * @license React
15
+ * react-is.production.min.js
16
+ *
17
+ * Copyright (c) Facebook, Inc. and its affiliates.
18
+ *
19
+ * This source code is licensed under the MIT license found in the
20
+ * LICENSE file in the root directory of this source tree.
21
+ */
22
+
23
+ /**
24
+ * A better abstraction over CSS.
25
+ *
26
+ * @copyright Oleg Isonen (Slobodskoi) / Isonen 2014-present
27
+ * @website https://github.com/cssinjs/jss
28
+ * @license MIT
29
+ */
30
+
31
+ /** @license React v0.19.1
32
+ * scheduler.production.min.js
33
+ *
34
+ * Copyright (c) Facebook, Inc. and its affiliates.
35
+ *
36
+ * This source code is licensed under the MIT license found in the
37
+ * LICENSE file in the root directory of this source tree.
38
+ */
39
+
40
+ /** @license React v16.13.1
41
+ * react-is.production.min.js
42
+ *
43
+ * Copyright (c) Facebook, Inc. and its affiliates.
44
+ *
45
+ * This source code is licensed under the MIT license found in the
46
+ * LICENSE file in the root directory of this source tree.
47
+ */
48
+
49
+ /** @license React v16.14.0
50
+ * react-dom.production.min.js
51
+ *
52
+ * Copyright (c) Facebook, Inc. and its affiliates.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE file in the root directory of this source tree.
56
+ */
57
+
58
+ /** @license React v16.14.0
59
+ * react-jsx-runtime.production.min.js
60
+ *
61
+ * Copyright (c) Facebook, Inc. and its affiliates.
62
+ *
63
+ * This source code is licensed under the MIT license found in the
64
+ * LICENSE file in the root directory of this source tree.
65
+ */
package/public/540.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 540.js.LICENSE.txt */
2
+ "use strict";(self.webpackChunkbt_sensors_plugin_sk=self.webpackChunkbt_sensors_plugin_sk||[]).push([[540],{5287:(e,r,t)=>{var n=t(5228),o="function"==typeof Symbol&&Symbol.for,u=o?Symbol.for("react.element"):60103,f=o?Symbol.for("react.portal"):60106,l=o?Symbol.for("react.fragment"):60107,c=o?Symbol.for("react.strict_mode"):60108,i=o?Symbol.for("react.profiler"):60114,a=o?Symbol.for("react.provider"):60109,s=o?Symbol.for("react.context"):60110,p=o?Symbol.for("react.forward_ref"):60112,y=o?Symbol.for("react.suspense"):60113,d=o?Symbol.for("react.memo"):60115,h=o?Symbol.for("react.lazy"):60116,v="function"==typeof Symbol&&Symbol.iterator;function m(e){for(var r="https://reactjs.org/docs/error-decoder.html?invariant="+e,t=1;t<arguments.length;t++)r+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+e+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_={};function S(e,r,t){this.props=e,this.context=r,this.refs=_,this.updater=t||b}function k(){}function g(e,r,t){this.props=e,this.context=r,this.refs=_,this.updater=t||b}S.prototype.isReactComponent={},S.prototype.setState=function(e,r){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(m(85));this.updater.enqueueSetState(this,e,r,"setState")},S.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},k.prototype=S.prototype;var w=g.prototype=new k;w.constructor=g,n(w,S.prototype),w.isPureReactComponent=!0;var $={current:null},C=Object.prototype.hasOwnProperty,E={key:!0,ref:!0,__self:!0,__source:!0};function R(e,r,t){var n,o={},f=null,l=null;if(null!=r)for(n in void 0!==r.ref&&(l=r.ref),void 0!==r.key&&(f=""+r.key),r)C.call(r,n)&&!E.hasOwnProperty(n)&&(o[n]=r[n]);var c=arguments.length-2;if(1===c)o.children=t;else if(1<c){for(var i=Array(c),a=0;a<c;a++)i[a]=arguments[a+2];o.children=i}if(e&&e.defaultProps)for(n in c=e.defaultProps)void 0===o[n]&&(o[n]=c[n]);return{$$typeof:u,type:e,key:f,ref:l,props:o,_owner:$.current}}function x(e){return"object"==typeof e&&null!==e&&e.$$typeof===u}var P=/\/+/g,j=[];function O(e,r,t,n){if(j.length){var o=j.pop();return o.result=e,o.keyPrefix=r,o.func=t,o.context=n,o.count=0,o}return{result:e,keyPrefix:r,func:t,context:n,count:0}}function A(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>j.length&&j.push(e)}function I(e,r,t,n){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var l=!1;if(null===e)l=!0;else switch(o){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case u:case f:l=!0}}if(l)return t(n,e,""===r?"."+q(e,0):r),1;if(l=0,r=""===r?".":r+":",Array.isArray(e))for(var c=0;c<e.length;c++){var i=r+q(o=e[c],c);l+=I(o,i,t,n)}else if("function"==typeof(i=null===e||"object"!=typeof e?null:"function"==typeof(i=v&&e[v]||e["@@iterator"])?i:null))for(e=i.call(e),c=0;!(o=e.next()).done;)l+=I(o=o.value,i=r+q(o,c++),t,n);else if("object"===o)throw t=""+e,Error(m(31,"[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t,""));return l}function U(e,r,t){return null==e?0:I(e,"",r,t)}function q(e,r){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var r={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,(function(e){return r[e]}))}(e.key):r.toString(36)}function F(e,r){e.func.call(e.context,r,e.count++)}function L(e,r,t){var n=e.result,o=e.keyPrefix;e=e.func.call(e.context,r,e.count++),Array.isArray(e)?M(e,n,t,(function(e){return e})):null!=e&&(x(e)&&(e=function(e,r){return{$$typeof:u,type:e.type,key:r,ref:e.ref,props:e.props,_owner:e._owner}}(e,o+(!e.key||r&&r.key===e.key?"":(""+e.key).replace(P,"$&/")+"/")+t)),n.push(e))}function M(e,r,t,n,o){var u="";null!=t&&(u=(""+t).replace(P,"$&/")+"/"),U(e,L,r=O(r,u,n,o)),A(r)}var D={current:null};function V(){var e=D.current;if(null===e)throw Error(m(321));return e}var B={ReactCurrentDispatcher:D,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:$,IsSomeRendererActing:{current:!1},assign:n};r.Children={map:function(e,r,t){if(null==e)return e;var n=[];return M(e,n,null,r,t),n},forEach:function(e,r,t){if(null==e)return e;U(e,F,r=O(null,null,r,t)),A(r)},count:function(e){return U(e,(function(){return null}),null)},toArray:function(e){var r=[];return M(e,r,null,(function(e){return e})),r},only:function(e){if(!x(e))throw Error(m(143));return e}},r.Component=S,r.Fragment=l,r.Profiler=i,r.PureComponent=g,r.StrictMode=c,r.Suspense=y,r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=B,r.cloneElement=function(e,r,t){if(null==e)throw Error(m(267,e));var o=n({},e.props),f=e.key,l=e.ref,c=e._owner;if(null!=r){if(void 0!==r.ref&&(l=r.ref,c=$.current),void 0!==r.key&&(f=""+r.key),e.type&&e.type.defaultProps)var i=e.type.defaultProps;for(a in r)C.call(r,a)&&!E.hasOwnProperty(a)&&(o[a]=void 0===r[a]&&void 0!==i?i[a]:r[a])}var a=arguments.length-2;if(1===a)o.children=t;else if(1<a){i=Array(a);for(var s=0;s<a;s++)i[s]=arguments[s+2];o.children=i}return{$$typeof:u,type:e.type,key:f,ref:l,props:o,_owner:c}},r.createContext=function(e,r){return void 0===r&&(r=null),(e={$$typeof:s,_calculateChangedBits:r,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:a,_context:e},e.Consumer=e},r.createElement=R,r.createFactory=function(e){var r=R.bind(null,e);return r.type=e,r},r.createRef=function(){return{current:null}},r.forwardRef=function(e){return{$$typeof:p,render:e}},r.isValidElement=x,r.lazy=function(e){return{$$typeof:h,_ctor:e,_status:-1,_result:null}},r.memo=function(e,r){return{$$typeof:d,type:e,compare:void 0===r?null:r}},r.useCallback=function(e,r){return V().useCallback(e,r)},r.useContext=function(e,r){return V().useContext(e,r)},r.useDebugValue=function(){},r.useEffect=function(e,r){return V().useEffect(e,r)},r.useImperativeHandle=function(e,r,t){return V().useImperativeHandle(e,r,t)},r.useLayoutEffect=function(e,r){return V().useLayoutEffect(e,r)},r.useMemo=function(e,r){return V().useMemo(e,r)},r.useReducer=function(e,r,t){return V().useReducer(e,r,t)},r.useRef=function(e){return V().useRef(e)},r.useState=function(e){return V().useState(e)},r.version="16.14.0"},6540:(e,r,t)=>{e.exports=t(5287)}}]);
@@ -0,0 +1,8 @@
1
+ /** @license React v16.14.0
2
+ * react.production.min.js
3
+ *
4
+ * Copyright (c) Facebook, Inc. and its affiliates.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
package/public/893.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkbt_sensors_plugin_sk=self.webpackChunkbt_sensors_plugin_sk||[]).push([[893],{2995:(e,t,n)=>{n.r(t),n.d(t,{default:()=>v});var a=n(3490),s=n(4810),o=n(4147),r=n.n(o),l=n(7606),c=n(4952),i=n(3768),u=n(1431),d=n(9676),m=n(7041),f=n(3657),g=n(5027),p=n(7265),h=n(6890),E=n(8207);const w=e=>console.log.bind(console,e);var S;const v=e=>{const[t,n]=(0,o.useState)({}),[v,b]=(0,o.useState)({}),[y,A]=(0,o.useState)({}),[$,k]=(0,o.useState)({"ui:submitButtonOptions":{props:{disabled:!1,className:"btn btn-info"},norender:!0,submitText:"Submit"}}),[x,D]=(0,o.useState)([]),[C,T]=(0,o.useState)(),[j,_]=(0,o.useState)(new Map),[O,N]=(0,o.useState)({progress:0,maxTimeout:100,deviceCount:0,totalDevices:0}),[M,J]=(0,o.useState)("unknown"),[L,U]=(0,o.useState)();function B(e,t){console.log(`sending ${e}`),console.log(t);const n=new Headers;return n.append("Content-Type","application/json"),fetch(`/plugins/bt-sensors-plugin-sk/${e}`,{credentials:"include",method:"POST",body:JSON.stringify(t),headers:n})}async function H(e){return console.log(`fetching ${e}`),fetch(`/plugins/bt-sensors-plugin-sk/${e}`,{credentials:"include"})}async function I(){const e=await H("progress");if(200!=e.status)throw new Error(`Unable get progres: ${e.statusText} (${e.status}) `);const t=await e.json();return console.log(t),t}function P(){console.log("refreshing sensor map"),async function(){const e=await H("sensors");if(200!=e.status)throw new Error(`Unable get sensor data: ${e.statusText} (${e.status}) `);const t=await e.json();return console.log(t),t}().then((e=>{_(new Map(e.map((e=>[e.info.mac,e]))))})).catch((e=>{U(e)}))}return(0,o.useEffect)((()=>{H("sendPluginState").then((async e=>{const t=await e.json();J(t.state),console.log("Setting up eventsource");const n=new EventSource("/plugins/bt-sensors-plugin-sk/sse");return n.addEventListener("newsensor",(e=>{let t=JSON.parse(e.data);S.has(t.info.mac)||(console.log(`New sensor: ${t.info.mac}`),_(new Map(S.set(t.info.mac,t))))})),n.addEventListener("sensorchanged",(e=>{let t=JSON.parse(e.data);if(S.has(t.mac)){let e=S.get(t.mac);Object.assign(e.info,t),_(new Map(S))}})),n.addEventListener("progress",(e=>{const t=JSON.parse(e.data);N(t),console.log(t)})),n.addEventListener("pluginstate",(e=>{const t=JSON.parse(e.data);J(t.state)})),()=>n.close()})).catch((e=>{U(e)}))}),[]),(0,o.useEffect)((()=>{"started"==M?(P(),async function(){const e=await H("base");if(200!=e.status)throw new Error(`Unable get base data: ${e.statusText} (${e.status}) `);const t=await e.json();return console.log(t),t}().then((e=>{n(e.schema),b(e.data)})).catch((e=>{U(e)})),I().then((e=>{N(e)})).catch((e=>{U(e)}))):(_(new Map),n({}),b({}))}),[M]),(0,o.useEffect)((()=>{console.log(L)}),[L]),(0,o.useEffect)((()=>{S=j,D(Array.from(j.entries()).map((e=>{const t=j.get(e[0]),n=t.config,a=Object.keys(n).length>0;return r().createElement(h.A,{action:!0,onClick:()=>{t&&(n.mac_address=e[0],A(t.schema),T(n))}},r().createElement("div",{class:"d-flex justify-content-between align-items-center",style:a?{fontWeight:"normal"}:{fontStyle:"italic"}},`${t.info.name} MAC: ${t.info.mac} RSSI: ${s=t.info.RSSI,null==s?NaN:s}`,r().createElement("div",{class:"d-flex justify-content-between "},function(e){return null==e.info.lastContactDelta||e.info.lastContactDelta>e.config.discoveryTimeout?r().createElement(i.A,null):e.info.signalStrength>80?r().createElement(u.A,null):e.info.signalStrength>60?r().createElement(d.A,null):e.info.signalStrength>40?r().createElement(m.A,null):e.info.signalStrength>20?r().createElement(f.A,null):r().createElement(g.A,null)}(t))));var s})))}),[j]),"stopped"==M?r().createElement("h1",null,"Enable plugin to see configuration"):r().createElement("div",null,L?r().createElement("h2",{style:"color: red;"},L.message):"",r().createElement(a.Ay,{schema:t,validator:s.Ay,onChange:e=>b(e.formData),onSubmit:({formData:e},t)=>{T(null),B("sendBaseData",e).then((e=>{200!=e.status?U(new Error(`Unable to update base data: ${e.statusText} (${e.status})`)):(I().then((e=>{N(e)})).catch((e=>{U(e)})),P())}))},onError:w("errors"),formData:v}),r().createElement("p",null),r().createElement("p",null),O.deviceCount<O.totalDevices?r().createElement(E.A,{max:O.maxTimeout,now:O.progress}):"",r().createElement("h2",null,j.size>0?" Bluetooth Devices click to configure":""),r().createElement("p",null),r().createElement("div",{style:{paddingBottom:20},class:"d-flex flex-wrap justify-content-start align-items-start"},r().createElement(p.A,{style:{maxHeight:"300px",overflowY:"auto"}},x),r().createElement("div",{style:{paddingLeft:10,paddingTop:10,display:0==Object.keys(y).length?"none":""}},r().createElement(a.Ay,{schema:y,validator:s.Ay,uiSchema:$,onChange:e=>T(e.formData),onSubmit:({formData:e},t)=>{var n;console.log(e),B("sendSensorData",n=e).then((e=>{if(200!=e.status)throw new Error(e.statusText);j.get(n.mac_address).config=n})),A({}),alert("Changes saved")},onError:w("errors"),formData:C},r().createElement("div",null,r().createElement(l.A,{direction:"row",style:{spacing:5}},r().createElement(c.A,{type:"submit",color:"primary",variant:"contained"},"Save"),r().createElement(c.A,{variant:"contained",onClick:()=>{var e;e=C.mac_address,T(j.get(e).config)}},"Undo"),r().createElement(c.A,{variant:"contained",color:"secondary",onClick:e=>{return t=C.mac_address,void(window.confirm(`Delete configuration for ${t}?`)&&function(e){try{B("removeSensorData",{mac_address:e}).then((e=>{if(200!=e.status)throw new Error(e.statusText)})),S.delete(e),_(new Map(S)),A({})}catch{}}(t));var t}},"Delete")))))))}}}]);
package/public/main.js ADDED
@@ -0,0 +1 @@
1
+ (()=>{var e,r,t={9445:()=>{}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,o),a.exports}o.m=t,o.c=n,o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((r,t)=>(o.f[t](e,r),r)),[])),o.u=e=>e+".js",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="bt-sensors-plugin-sk:",o.l=(t,n,a,i)=>{if(e[t])e[t].push(n);else{var s,l;if(void 0!==a)for(var u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var p=u[c];if(p.getAttribute("src")==t||p.getAttribute("data-webpack")==r+a){s=p;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.setAttribute("data-webpack",r+a),s.src=t),e[t]=[n];var d=(r,n)=>{s.onerror=s.onload=null,clearTimeout(f);var o=e[t];if(delete e[t],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach((e=>e(n))),r)return r(n)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),l&&document.head.appendChild(s)}},(()=>{o.S={};var e={},r={};o.I=(t,n)=>{n||(n=[]);var a=r[t];if(a||(a=r[t]={}),!(n.indexOf(a)>=0)){if(n.push(a),e[t])return e[t];o.o(o.S,t)||(o.S[t]={});var i=o.S[t],s="bt-sensors-plugin-sk",l=[];return"default"===t&&((e,r,t,n)=>{var a=i[e]=i[e]||{},l=a[r];(!l||!l.loaded&&(1!=!l.eager?n:s>l.from))&&(a[r]={get:()=>o.e(159).then((()=>()=>o(6540))),from:s,eager:!1})})("react","16.14.0"),e[t]=l.length?Promise.all(l).then((()=>e[t]=1)):1}}})(),(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var r=o.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={792:0};o.f.j=(r,t)=>{var n=o.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var a=new Promise(((t,o)=>n=e[r]=[t,o]));t.push(n[2]=a);var i=o.p+o.u(r),s=new Error;o.l(i,(t=>{if(o.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var a=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;s.message="Loading chunk "+r+" failed.\n("+a+": "+i+")",s.name="ChunkLoadError",s.type=a,s.request=i,n[1](s)}}),"chunk-"+r,r)}};var r=(r,t)=>{var n,a,[i,s,l]=t,u=0;if(i.some((r=>0!==e[r]))){for(n in s)o.o(s,n)&&(o.m[n]=s[n]);l&&l(o)}for(r&&r(t);u<i.length;u++)a=i[u],o.o(e,a)&&e[a]&&e[a][0](),e[a]=0},t=self.webpackChunkbt_sensors_plugin_sk=self.webpackChunkbt_sensors_plugin_sk||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),o(9445)})();
@@ -0,0 +1 @@
1
+ var bt_sensors_plugin_sk;(()=>{"use strict";var e,r,t,n,o,a,i,u,s,l,f,d,c,p,h,v,g,b,m,y,w,k={3237:(e,r,t)=>{var n={"./PluginConfigurationPanel":()=>Promise.all([t.e(30),t.e(893)]).then((()=>()=>t(2995)))},o=(e,r)=>(t.R=r,r=t.o(n,e)?n[e]():Promise.resolve().then((()=>{throw new Error('Module "'+e+'" does not exist in container.')})),t.R=void 0,r),a=(e,r)=>{if(t.S){var n="default",o=t.S[n];if(o&&o!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[n]=e,t.I(n,r)}};t.d(r,{get:()=>o,init:()=>a})}},S={};function _(e){var r=S[e];if(void 0!==r)return r.exports;var t=S[e]={id:e,loaded:!1,exports:{}};return k[e](t,t.exports,_),t.loaded=!0,t.exports}_.m=k,_.c=S,_.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return _.d(r,{a:r}),r},_.d=(e,r)=>{for(var t in r)_.o(r,t)&&!_.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},_.f={},_.e=e=>Promise.all(Object.keys(_.f).reduce(((r,t)=>(_.f[t](e,r),r)),[])),_.u=e=>e+".js",_.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),_.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="bt-sensors-plugin-sk:",_.l=(t,n,o,a)=>{if(e[t])e[t].push(n);else{var i,u;if(void 0!==o)for(var s=document.getElementsByTagName("script"),l=0;l<s.length;l++){var f=s[l];if(f.getAttribute("src")==t||f.getAttribute("data-webpack")==r+o){i=f;break}}i||(u=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,_.nc&&i.setAttribute("nonce",_.nc),i.setAttribute("data-webpack",r+o),i.src=t),e[t]=[n];var d=(r,n)=>{i.onerror=i.onload=null,clearTimeout(c);var o=e[t];if(delete e[t],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach((e=>e(n))),r)return r(n)},c=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),u&&document.head.appendChild(i)}},_.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},_.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{_.S={};var e={},r={};_.I=(t,n)=>{n||(n=[]);var o=r[t];if(o||(o=r[t]={}),!(n.indexOf(o)>=0)){if(n.push(o),e[t])return e[t];_.o(_.S,t)||(_.S[t]={});var a=_.S[t],i="bt-sensors-plugin-sk",u=[];return"default"===t&&((e,r,t,n)=>{var o=a[e]=a[e]||{},u=o[r];(!u||!u.loaded&&(1!=!u.eager?n:i>u.from))&&(o[r]={get:()=>_.e(159).then((()=>()=>_(6540))),from:i,eager:!1})})("react","16.14.0"),e[t]=u.length?Promise.all(u).then((()=>e[t]=1)):1}}})(),(()=>{var e;_.g.importScripts&&(e=_.g.location+"");var r=_.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),_.p=e})(),t=e=>{var r=e=>e.split(".").map((e=>+e==e?+e:e)),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),n=t[1]?r(t[1]):[];return t[2]&&(n.length++,n.push.apply(n,r(t[2]))),t[3]&&(n.push([]),n.push.apply(n,r(t[3]))),n},n=(e,r)=>{e=t(e),r=t(r);for(var n=0;;){if(n>=e.length)return n<r.length&&"u"!=(typeof r[n])[0];var o=e[n],a=(typeof o)[0];if(n>=r.length)return"u"==a;var i=r[n],u=(typeof i)[0];if(a!=u)return"o"==a&&"n"==u||"s"==u||"u"==a;if("o"!=a&&"u"!=a&&o!=i)return o<i;n++}},o=e=>{var r=e[0],t="";if(1===e.length)return"*";if(r+.5){t+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var n=1,a=1;a<e.length;a++)n--,t+="u"==(typeof(u=e[a]))[0]?"-":(n>0?".":"")+(n=2,u);return t}var i=[];for(a=1;a<e.length;a++){var u=e[a];i.push(0===u?"not("+s()+")":1===u?"("+s()+" || "+s()+")":2===u?i.pop()+" "+i.pop():o(u))}return s();function s(){return i.pop().replace(/^\((.+)\)$/,"$1")}},a=(e,r)=>{if(0 in e){r=t(r);var n=e[0],o=n<0;o&&(n=-n-1);for(var i=0,u=1,s=!0;;u++,i++){var l,f,d=u<e.length?(typeof e[u])[0]:"";if(i>=r.length||"o"==(f=(typeof(l=r[i]))[0]))return!s||("u"==d?u>n&&!o:""==d!=o);if("u"==f){if(!s||"u"!=d)return!1}else if(s)if(d==f)if(u<=n){if(l!=e[u])return!1}else{if(o?l>e[u]:l<e[u])return!1;l!=e[u]&&(s=!1)}else if("s"!=d&&"n"!=d){if(o||u<=n)return!1;s=!1,u--}else{if(u<=n||f<d!=o)return!1;s=!1}else"s"!=d&&"n"!=d&&(s=!1,u--)}}var c=[],p=c.pop.bind(c);for(i=1;i<e.length;i++){var h=e[i];c.push(1==h?p()|p():2==h?p()&p():h?a(h,r):!p())}return!!p()},i=(e,r)=>e&&_.o(e,r),u=e=>(e.loaded=1,e.get()),s=e=>Object.keys(e).reduce(((r,t)=>(e[t].eager&&(r[t]=e[t]),r)),{}),l=(e,r,t)=>{var o=t?s(e[r]):e[r];return(r=Object.keys(o).reduce(((e,r)=>!e||n(e,r)?r:e),0))&&o[r]},f=(e,r,t,o)=>{var i=o?s(e[r]):e[r];return(r=Object.keys(i).reduce(((e,r)=>!a(t,r)||e&&!n(e,r)?e:r),0))&&i[r]},d=(e,r,t,n,a)=>{var i=e[t];return"No satisfying version ("+o(n)+")"+(a?" for eager consumption":"")+" of shared module "+t+" found in shared scope "+r+".\nAvailable versions: "+Object.keys(i).map((e=>e+" from "+i[e].from)).join(", ")},c=e=>{throw new Error(e)},h=(e,r,t)=>t?t():((e,r)=>c("Shared module "+r+" doesn't exist in shared scope "+e))(e,r),v=(p=e=>function(r,t,n,o,a){var i=_.I(r);return i&&i.then&&!n?i.then(e.bind(e,r,_.S[r],t,!1,o,a)):e(r,_.S[r],t,n,o,a)})(((e,r,t,n,o)=>i(r,t)?u(l(r,t,n)):h(e,t,o))),g=p(((e,r,t,n,o,a)=>{if(!i(r,t))return h(e,t,a);var s=f(r,t,o,n);return s?u(s):a?a():void c(d(r,e,t,o,n))})),b={},m={1490:()=>g("default","react",!1,[,[1,17,0,0],[1,16,8,0],1],(()=>_.e(540).then((()=>()=>_(6540))))),2085:()=>g("default","react",!1,[1,16,14,0],(()=>_.e(540).then((()=>()=>_(6540))))),2417:()=>g("default","react",!1,[0,16,8,0],(()=>_.e(540).then((()=>()=>_(6540))))),4147:()=>g("default","react",!1,[1,16,13,1],(()=>_.e(540).then((()=>()=>_(6540))))),4167:()=>v("default","react",!1,(()=>_.e(540).then((()=>()=>_(6540))))),4564:()=>g("default","react",!1,[0,16,14,0],(()=>_.e(540).then((()=>()=>_(6540))))),6932:()=>g("default","react",!1,[0,15,0,0],(()=>_.e(540).then((()=>()=>_(6540))))),7227:()=>g("default","react",!1,[0,16,6,0],(()=>_.e(540).then((()=>()=>_(6540))))),7920:()=>g("default","react",!1,[,[0,17],[1,16,14,0],1],(()=>_.e(540).then((()=>()=>_(6540))))),8271:()=>g("default","react",!1,[0,0,14,0],(()=>_.e(540).then((()=>()=>_(6540)))))},y={893:[1490,2085,2417,4147,4167,4564,6932,7227,7920,8271]},w={},_.f.consumes=(e,r)=>{_.o(y,e)&&y[e].forEach((e=>{if(_.o(b,e))return r.push(b[e]);if(!w[e]){var t=r=>{b[e]=0,_.m[e]=t=>{delete _.c[e],t.exports=r()}};w[e]=!0;var n=r=>{delete b[e],_.m[e]=t=>{throw delete _.c[e],r}};try{var o=m[e]();o.then?r.push(b[e]=o.then(t).catch(n)):t(o)}catch(e){n(e)}}}))},(()=>{var e={592:0};_.f.j=(r,t)=>{var n=_.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var o=new Promise(((t,o)=>n=e[r]=[t,o]));t.push(n[2]=o);var a=_.p+_.u(r),i=new Error;_.l(a,(t=>{if(_.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+o+": "+a+")",i.name="ChunkLoadError",i.type=o,i.request=a,n[1](i)}}),"chunk-"+r,r)}};var r=(r,t)=>{var n,o,[a,i,u]=t,s=0;if(a.some((r=>0!==e[r]))){for(n in i)_.o(i,n)&&(_.m[n]=i[n]);u&&u(_)}for(r&&r(t);s<a.length;s++)o=a[s],_.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=self.webpackChunkbt_sensors_plugin_sk=self.webpackChunkbt_sensors_plugin_sk||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})();var j=_(3237);bt_sensors_plugin_sk=j})();
@@ -18,35 +18,45 @@ class ATC extends BTSensor{
18
18
 
19
19
  async init() {
20
20
  await super.init()
21
- const md=this.addMetadatum('parser','','data parsing strategy')
22
- md.isParam=true
23
- md.enum=["ATC-LE","ATC-BE"]
21
+ this.addParameter(
22
+ "parser",
23
+ {
24
+ title:'data parsing strategy',
25
+ type: 'string',
26
+ enum:["ATC-LE","ATC-BE"]
27
+ }
28
+ )
24
29
  if (!this.parser){
25
30
  this.parser="ATC-LE"
26
31
  }
27
32
  this.initMetadata()
28
33
  }
29
34
  initMetadata(){
35
+
36
+ this.addDefaultPath('batteryStrength','sensors.batteryStrength')
37
+ .read=(buff)=>{return ((buff.readUInt8(12))/100)}
38
+
30
39
  if (this.parser=="ATC-LE"){
31
- this.addMetadatum('voltage', 'V', 'sensor battery voltage',
32
- (buff)=>{return ((buff.readUInt16LE(10))/1000)})
33
- this.addMetadatum('batteryStrength', 'ratio', 'sensor battery strength',
34
- (buff)=>{return ((buff.readUInt8(12))/100)})
35
- this.addMetadatum('temp','K', 'temperature',
36
- (buff)=>{return parseFloat((273.15+(buff.readInt16LE(6))/100).toFixed(2))})
37
- this.addMetadatum('humidity','ratio', 'humidity',
38
- (buff)=>{return ((buff.readUInt16LE(8))/10000)})
40
+ this.addDefaultPath('voltage','sensors.batteryVoltage')
41
+ .read=(buff)=>{return ((buff.readUInt16LE(10))/1000)}
42
+
43
+ this.addDefaultPath('temp', 'environment.temperature')
44
+ .read=(buff)=>{return parseFloat((273.15+(buff.readInt16LE(6))/100).toFixed(2))}
45
+
46
+ this.addDefaultPath('humidity','environment.humidity')
47
+ .read=(buff)=>{return ((buff.readUInt16LE(8))/10000)}
39
48
 
40
49
  } else{
41
- this.addMetadatum('voltage', 'V', 'sensor battery voltage',
42
- (buff)=>{return ((buff.readUInt16BE(10))/1000)})
43
- this.addMetadatum('batteryStrength', 'ratio', 'sensor battery strength',
44
- (buff)=>{return ((buff.readUInt8(9))/100)})
45
- this.addMetadatum('temp','K', 'temperature',
46
- (buff)=>{return parseFloat((273.15+(buff.readInt16BE(6))/10).toFixed(2))})
47
- this.addMetadatum('humidity','ratio', 'humidity',
48
- (buff)=>{return ((buff.readUInt8(8))/100)})
49
-
50
+
51
+ this.addDefaultPath('voltage','sensors.batteryVoltage')
52
+ .read=(buff)=>{return ((buff.readUInt16BE(10))/1000)}
53
+
54
+ this.addDefaultPath('temp', 'environment.temperature')
55
+ .read=(buff)=>{return parseFloat((273.15+(buff.readInt16BE(6))/100).toFixed(2))}
56
+
57
+ this.addDefaultPath('humidity','environment.humidity')
58
+ .read=(buff)=>{return ((buff.readUInt16BE(8))/10000)}
59
+
50
60
  }
51
61
  }
52
62
  propertiesChanged(props){
@@ -15,6 +15,10 @@ class BLACKLISTED extends BTSensor {
15
15
  await super.init();
16
16
  this.currentProperties.Name = `Unsupported device from ${this.getManufacturer()}`;
17
17
  }
18
+
19
+ initListen(){
20
+ //do nothing
21
+ }
18
22
  reasonForBlacklisting() {
19
23
  switch (this.getManufacturerID()) {
20
24
  case 0x004c:
@@ -1,4 +1,4 @@
1
- # BLUETOOTH SENSOR CLASS DEVELOPMENT (OUT OF DATE AS OF 1.1.0 release, NEW VERSION COMING IN 1.2.0)
1
+ # BLUETOOTH SENSOR CLASS DEVELOPMENT (OUT OF DATE AS OF 1.1.0 Beta release NEW VERSION COMING SOON)
2
2
 
3
3
  The goal of this project is to support as many mariner-useful sensors as possible. If there's anything we can do to make sensor class development easier, please let us know.<br><br>
4
4
 
@@ -146,11 +146,6 @@ module.exports=ATC</pre>
146
146
 
147
147
  The big difference here is in the connect() method. All it does is wait on propertiesChanged and when that event occurs, the device object parses the buffer and emits the data. NOTE: Both classes have the same metadata, so the ATC class "borrows" the metadata from the LYWSD03MMC class.<br>
148
148
 
149
- ## DEVICE MODULES
150
-
151
- To learn more about runtime loading of device modules, see (https://github.com/naugehyde/bt-sensors-plugin-sk/discussions/26)
152
-
153
-
154
149
  ## LET US KNOW
155
150
 
156
151
  When you're done working on your class and satisified that it's functioning properly, commit and request a merge (more git talk).<br>
@@ -39,9 +39,9 @@ class GoveeH510x extends BTSensor{
39
39
  this.initMetadata()
40
40
  }
41
41
  initMetadata(){
42
- this.addMetadatum('temp','K', 'temperature')
43
- this.addMetadatum('battery','ratio', 'battery strength')
44
- this.addMetadatum('humidity','ratio', 'humidity')
42
+ this.addDefaultPath("temp","environment.temperature")
43
+ this.addDefaultPath("humidity", "environment.humidity")
44
+ this.addDefaultPath("battery","sensors.batteryStrength")
45
45
  }
46
46
 
47
47
  emitValuesFrom(buffer){
@@ -25,9 +25,8 @@ class IBeacon extends BTSensor {
25
25
  propertiesChanged(props){
26
26
  super.propertiesChanged(props);
27
27
  const buff = this.getServiceData("0000356e-0000-1000-8000-00805f9b34fb");
28
- if (!buff)
29
- throw new Error("Unable to get service data for " + this.getDisplayName());
30
- this.emitData("battery", buff);
28
+ if (buff)
29
+ this.emitData("battery", buff);
31
30
  }
32
31
 
33
32
  getManufacturer(){
@@ -15,10 +15,10 @@ class Inkbird extends BTSensor{
15
15
 
16
16
  async init(){
17
17
  await super.init()
18
- this.addMetadatum('temp','K', 'temperature')
19
- this.addMetadatum('battery','ratio', 'battery strength')
18
+ this.addDefaultPath('temp','environment.temperature')
19
+ this.addDefaultPath('battery', 'sensors.batteryStrength')
20
20
  if (this.getName() == 'sps'){
21
- this.addMetadatum('humidity','ratio', 'humidity')
21
+ this.addDefaultPath('humidity','environment.humidity')
22
22
  }
23
23
  }
24
24
 
@@ -37,7 +37,7 @@ class Inkbird extends BTSensor{
37
37
  throw new Error("Unable to get manufacturer data for "+this.getDisplayName())
38
38
  this.emit("temp", parseFloat((273.15+(key_i & 0x8000 ? key_i - 0x10000 : key_i)/100).toFixed(2))) ;
39
39
  this.emit('battery', data[5]/100)
40
- if (this.getMetadata().has('humidity')){
40
+ if (this.getPath('humidity')) {
41
41
  this.emit("humidity", data.readUInt16LE(0)/100);
42
42
  }
43
43
  }
@@ -273,13 +273,20 @@ class MopekaTankSensor extends BTSensor{
273
273
  }
274
274
 
275
275
  initMetadata(){
276
- var md = this.addMetadatum("medium","","type of liquid in tank")
277
- md.isParam=true
278
- md.enum=Object.keys(Media)
276
+ this.addParameter("medium",
277
+ {
278
+ title:"type of liquid in tank",
279
+ enum: Object.keys(Media)
280
+ }
281
+ )
282
+ this.addParameter("tankHeight",
283
+ {
284
+ title:"height of tank (in mm)",
285
+ type:"number",
286
+ unit:"mm"
287
+ }
288
+ )
279
289
 
280
- md = this.addMetadatum("tankHeight","mm","height of tank (in mm)")
281
- md.isParam=true
282
-
283
290
  this.addMetadatum("battVolt","V","sensor battery in volts",
284
291
  ((buffer)=>{
285
292
  this.battVolt = (buffer.readUInt8(1)/32)
@@ -42,11 +42,20 @@ class RenogySensor extends BTSensor{
42
42
 
43
43
  async init(){
44
44
  await super.init()
45
- var md = this.addMetadatum('refreshInterval','','refresh interval')
46
- md.isParam = true
47
-
48
- md = this.addMetadatum('deviceID', '', 'ID of device')
49
- md.isParam = true
45
+ this.addParameter(
46
+ "refreshInterval",
47
+ {
48
+ title: 'refresh interval',
49
+ type: 'number'
50
+ }
51
+ )
52
+ this.addParameter(
53
+ "deviceID",
54
+ {
55
+ title: 'ID of device'
56
+ }
57
+ )
58
+
50
59
 
51
60
  await this.device.connect()
52
61
  const rw = await this.constructor.getReadWriteCharacteristics(this.device)
@@ -9,10 +9,14 @@ class UNKNOWN extends BTSensor{
9
9
  await super.init()
10
10
  if (!this.currentProperties.Name)
11
11
  this.currentProperties.Name= `Unknown device from ${this.getManufacturer()}`
12
- var md =this.addMetadatum("sensorClass",'',"Sensor Class")
13
- md.isParam=true
14
- md.enum=Array.from(this.constructor.classMap.keys())
15
- //md.enumNames=this.constructor.classMap
12
+ this.addParameter(
13
+ "sensorClass",
14
+ {
15
+ title: "Sensor Class",
16
+ enum:Array.from(this.constructor.classMap.keys())
17
+ }
18
+ )
19
+ this.listen()
16
20
 
17
21
  }
18
22
 
@@ -51,8 +51,12 @@ function sleep(x) {
51
51
 
52
52
  async init(){
53
53
  await super.init()
54
- const md =this.addMetadatum('encryptionKey','', "Encryption Key")
55
- md.isParam = true
54
+ this.addParameter(
55
+ "encryptionKey",
56
+ {
57
+ title:"Encryption Key"
58
+ }
59
+ )
56
60
  this.model_id=this.getManufacturerData(0x2e1)?.readUInt16LE(2)??"Unknown"
57
61
  }
58
62
  alarmReason(alarmValue){
@@ -23,7 +23,7 @@ class VictronBatteryMonitor extends VictronSensor{
23
23
  d.currentProperties.ManufacturerData={}
24
24
  d.currentProperties.ManufacturerData[0x02e1]=b
25
25
  d.initMetadata()
26
- d.getPathMetadata().forEach((datum,tag)=>{
26
+ Object.keys(d.getPaths()).forEach((tag)=>{
27
27
  d.on(tag,(v)=>console.log(`${tag}=${v}`))
28
28
  })
29
29
  b = d.decrypt(b)
@@ -51,6 +51,7 @@ class VictronBatteryMonitor extends VictronSensor{
51
51
  '6597ed8d-4bda-4c1e-af4b-551c4cf74769',)
52
52
  const alarmMD = this.addMetadatum('alarm','', 'alarm',
53
53
  (buff,offset=0)=>{return buff.readInt16LE(offset)})
54
+
54
55
  alarmMD.notify=true
55
56
 
56
57
  this.addMetadatum( 'consumed','C', 'amp-hours consumed',
@@ -95,7 +96,7 @@ class VictronBatteryMonitor extends VictronSensor{
95
96
  emitValuesFrom(decData){
96
97
  this.emitData("ttg",decData,0)
97
98
  this.emitData("voltage",decData,2);
98
- const alarm = this.getMetadatum("alarm").read(decData,4)
99
+ const alarm = this.getPath("alarm").read(decData,4)
99
100
  if (alarm>0){
100
101
  this.emit(
101
102
  `ALARM #${alarm} from ${this.getDisplayName()})`,
@@ -137,7 +138,8 @@ class VictronBatteryMonitor extends VictronSensor{
137
138
  })
138
139
  }
139
140
  emitGATT(){
140
- this.getPathMetadata().forEach( (datum, tag)=> {
141
+ Object.keys(this.getPaths()).forEach( (tag)=> {
142
+ const datum = this.getPaths()[tag]
141
143
  if (datum.gatt) {
142
144
  this.gattService.getCharacteristic(datum.gatt).then((gattCharacteristic)=>{
143
145
  gattCharacteristic.readValue().then((buffer)=>{
@@ -150,10 +152,10 @@ class VictronBatteryMonitor extends VictronSensor{
150
152
  }
151
153
  initGATTNotifications(){
152
154
  return new Promise((resolve,reject )=>{
153
-
154
- this.getPathMetadata().forEach((datum, tag)=> {
155
+ Object.keys(this.getPaths()).forEach( (tag)=> {
156
+ const datum = this.getPaths()[tag]
155
157
  if (datum.gatt) {
156
- this.gattService.getCharacteristic(datum.gatt).then(async (gattCharacteristic)=>{
158
+ this.gattService.getCharacteristic(datum.gatt).then(async (gattCharacteristic)=>{
157
159
  const buffer = await gattCharacteristic.readValue()
158
160
  this.emitData(tag, buffer)
159
161
 
@@ -47,7 +47,7 @@ class VictronDCEnergyMeter extends VictronSensor{
47
47
  emitValuesFrom(decData){
48
48
  this.emitData("meterType",decData,0)
49
49
  this.emitData("voltage",decData,2);
50
- const alarm = this.getMetadatum("alarm").read(decData,4)
50
+ const alarm = this.getPath("alarm").read(decData,4)
51
51
  if (alarm>0){
52
52
  this.emit(
53
53
  `ALARM #${alarm} from ${this.getDisplayName()})`,
@@ -35,7 +35,7 @@ class VictronInverter extends VictronSensor{
35
35
  this.NaNif(br.read_unsigned_int(15),0x7FFF)/100)
36
36
  this.addMetadatum('acCurrent',
37
37
  this.NaNif(br.read_unsigned_int(11),0x7FF)/10)
38
- const alarm = this.getMetadatum("alarmReason").read(decData)
38
+ const alarm = this.getPath("alarmReason").read(decData)
39
39
  if (alarm>0){
40
40
  this.emit(
41
41
  `ALARM #${alarm} from ${this.getDisplayName()})`,
@@ -31,7 +31,7 @@ class VictronInverterRS extends VictronSensor{
31
31
 
32
32
  emitValuesFrom(decData){
33
33
  super.emitValuesFrom(decData)
34
- const error = this.getMetadatum("chargerError").read(decData)
34
+ const error = this.getPath("chargerError").read(decData)
35
35
  if (error>0){
36
36
  this.emit(
37
37
  `Charger Error #${error} from ${this.getDisplayName()})`,
@@ -203,8 +203,17 @@ class XiaomiMiBeacon extends BTSensor{
203
203
 
204
204
  async init(){
205
205
  await super.init()
206
- const md = this.addMetadatum("encryptionKey", "", "encryptionKey (AKA bindKey) for decryption")
207
- md.isParam=true
206
+ const data = this.getServiceData(this.constructor.SERVICE_MIBEACON)
207
+ const frameControl = data[0] + (data[1] << 8)
208
+ this.deviceID = data[2] + (data[3] << 8)
209
+ this.isEncrypted = (frameControl >> 3) & 1
210
+ this.encryptionVersion = frameControl >> 12
211
+ this.addParameter(
212
+ "encryptionKey",
213
+ {
214
+ title: "encryptionKey (AKA bindKey) for decryption"
215
+ }
216
+ )
208
217
  this.addMetadatum('temp','K', 'temperature',
209
218
  (buff,offset)=>{return ((buff.readInt16LE(offset))/10) + 273.15})
210
219
  this.addMetadatum('humidity','ratio', 'humidity',
@@ -215,16 +224,16 @@ class XiaomiMiBeacon extends BTSensor{
215
224
  this.addMetadatum('voltage', 'V', 'sensor battery voltage',
216
225
  (buff,offset)=>{return ((buff.readUInt16LE(offset))/1000)})
217
226
 
218
- const data = this.getServiceData(this.constructor.SERVICE_MIBEACON)
219
- const frameControl = data[0] + (data[1] << 8)
220
- this.deviceID = data[2] + (data[3] << 8)
221
- this.isEncrypted = (frameControl >> 3) & 1
222
- this.encryptionVersion = frameControl >> 12
227
+
223
228
  }
224
229
 
225
230
  getName(){
226
231
  const dt = DEVICE_TYPES.get(this.deviceID)
227
- return this?.name??`${dt.name} ${dt.model}`
232
+ if (!dt)
233
+ return super.getName()
234
+ else
235
+ return this?.name??`${dt.name} ${dt.model}`
236
+
228
237
  }
229
238
 
230
239
  async disconnectGATTCharacteristic(){