bt-sensors-plugin-sk 1.2.5-1 → 1.2.6-beta
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.
- package/BTSensor.js +74 -38
- package/DistanceManager.js +249 -0
- package/Mixin.js +19 -0
- package/OutOfRangeDevice.js +46 -0
- package/README.md +14 -0
- package/classLoader.js +7 -2
- package/connectUUID.exp +26 -0
- package/index.js +49 -3
- package/package.json +8 -6
- package/public/159.js +1 -1
- package/public/540.js +1 -1
- package/public/681.js +3 -9
- package/public/681.js.LICENSE.txt +2 -0
- package/public/764.js +1 -0
- package/public/images/ATC.jpeg +0 -0
- package/public/images/Aranet4.webp +0 -0
- package/public/images/BP108B.webp +0 -0
- package/public/images/GoveeH5074.jpg +0 -0
- package/public/images/GoveeH5075.webp +0 -0
- package/public/images/GoveeH510x.jpg +0 -0
- package/public/images/InkbirdTH3.webp +0 -0
- package/public/images/JBDBMS.webp +0 -0
- package/public/images/Junctek.webp +0 -0
- package/public/images/KilovaultHLXPlus.jpg +0 -0
- package/public/images/LancolVoltageMeter.webp +0 -0
- package/public/images/LiTimeLiFePo4Battery.avif +0 -0
- package/public/images/MercurySmartcraft.jpg +0 -0
- package/public/images/MopekaTankSensor.jpg +0 -0
- package/public/images/RemoranWave3.jpeg +0 -0
- package/public/images/RenogyInverter.jpg +0 -0
- package/public/images/RenogyRoverClient.jpg +0 -0
- package/public/images/RenogySmartLiFePo4Battery.webp +0 -0
- package/public/images/RuuviTag.jpg +0 -0
- package/public/images/ShellyBLUHT.webp +0 -0
- package/public/images/ShellyBLUMotion.webp +0 -0
- package/public/images/ShellyBluDoorWindow.webp +0 -0
- package/public/images/Skanbatt.jpg +0 -0
- package/public/images/SmartBatteryProtect.webp +0 -0
- package/public/images/SmartBatterySense.webp +0 -0
- package/public/images/SwitchBotMeterPlus.webp +0 -0
- package/public/images/SwitchBotTH.webp +0 -0
- package/public/images/TopbandBattery.webp +0 -0
- package/public/images/Ultrasonic.jpg +0 -0
- package/public/images/VictronBlueSmartACCharger.jpg +0 -0
- package/public/images/VictronBlueSolarMPPT.jpeg +0 -0
- package/public/images/VictronCerboGX.webp +0 -0
- package/public/images/VictronInverterRS.webp +0 -0
- package/public/images/VictronLynxSmartBMS.webp +0 -0
- package/public/images/VictronMultiPlus-II.webp +0 -0
- package/public/images/VictronOrionTrIsolated.webp +0 -0
- package/public/images/VictronOrionTrNonIsolated.webp +0 -0
- package/public/images/VictronPhoenixInverter.webp +0 -0
- package/public/images/VictronPhoenixSmart1600.webp +0 -0
- package/public/images/VictronSmartBatteryProtect.jpg +0 -0
- package/public/images/VictronSmartIP43.webp +0 -0
- package/public/images/VictronSmartLithiumBattery.jpg +0 -0
- package/public/images/VictronSmartSolarMPPT.webp +0 -0
- package/public/images/VictronVEBus.webp +0 -0
- package/public/images/iBeacon.jpg +0 -0
- package/public/main.js +1 -1
- package/public/remoteEntry.js +1 -1
- package/readUUID.exp +23 -0
- package/sensor_classes/ATC.js +3 -2
- package/sensor_classes/Aranet2.js +3 -1
- package/sensor_classes/Aranet4.js +1 -2
- package/sensor_classes/BankManager.js +1 -1
- package/sensor_classes/Beacon/AbstractBeaconMixin.js +85 -0
- package/sensor_classes/Beacon/Eddystone.js +77 -0
- package/sensor_classes/Beacon/iBeacon.js +58 -0
- package/sensor_classes/EctiveBMS.js +270 -0
- package/sensor_classes/FeasyComBeacon.js +68 -0
- package/sensor_classes/GobiusCTankMeter.js +4 -3
- package/sensor_classes/GoveeH5074.js +2 -0
- package/sensor_classes/GoveeH5075.js +2 -0
- package/sensor_classes/GoveeH510x.js +1 -0
- package/sensor_classes/Inkbird.js +1 -0
- package/sensor_classes/JBDBMS.js +1 -0
- package/sensor_classes/Junctek.js +14 -6
- package/sensor_classes/KilovaultHLXPlus.js +1 -0
- package/sensor_classes/LancolVoltageMeter.js +2 -0
- package/sensor_classes/MercurySmartcraft.js +1 -0
- package/sensor_classes/MopekaTankSensor.js +3 -200
- package/sensor_classes/RemoranWave3.js +2 -0
- package/sensor_classes/Renogy/RenogySensor.js +1 -0
- package/sensor_classes/RenogyBattery.js +3 -4
- package/sensor_classes/RenogyInverter.js +3 -6
- package/sensor_classes/RenogyRoverClient.js +3 -0
- package/sensor_classes/RuuviTag.js +6 -3
- package/sensor_classes/ShellySBDW002C.js +3 -1
- package/sensor_classes/ShellySBHT003C.js +7 -0
- package/sensor_classes/ShellySBMO003Z.js +3 -2
- package/sensor_classes/ShenzhenLiOnBMS.js +4 -0
- package/sensor_classes/SwitchBotMeterPlus.js +1 -1
- package/sensor_classes/SwitchBotTH.js +2 -1
- package/sensor_classes/UNKNOWN.js +2 -1
- package/sensor_classes/UltrasonicWindMeter.js +3 -0
- package/sensor_classes/Victron/VictronConstants.js +2 -0
- package/sensor_classes/Victron/VictronIdentifier.js +24 -0
- package/sensor_classes/Victron/VictronSensor.js +43 -54
- package/sensor_classes/VictronACCharger.js +1 -6
- package/sensor_classes/VictronBatteryMonitor.js +37 -26
- package/sensor_classes/VictronDCDCConverter.js +1 -4
- package/sensor_classes/VictronDCEnergyMeter.js +1 -4
- package/sensor_classes/VictronGXDevice.js +1 -4
- package/sensor_classes/VictronInverter.js +2 -3
- package/sensor_classes/VictronInverterRS.js +2 -4
- package/sensor_classes/VictronLynxSmartBMS.js +1 -4
- package/sensor_classes/VictronOrionXS.js +1 -3
- package/sensor_classes/VictronSmartBatteryProtect.js +1 -4
- package/sensor_classes/VictronSmartLithium.js +1 -4
- package/sensor_classes/VictronSolarCharger.js +1 -3
- package/sensor_classes/VictronVEBus.js +1 -4
- package/sensor_classes/XiaomiMiBeacon.js +5 -2
- package/sensor_classes/iBeaconSensor.js +40 -0
- package/src/components/PluginConfigurationPanel.js +53 -17
- package/Screenshot 2025-06-12 at 9.33.57/342/200/257AM.png +0 -0
- package/bt-sensors-plugin-sk copy.json +0 -170
- package/bt-sensors-plugin-sk.json.bak +0 -121
- package/diff.txt +0 -2860
- package/public/847.js +0 -1
- package/sensor_classes/IBeacon.js +0 -45
- package/vsl_patch_17_06_25.patch +0 -13
- /package/public/images/{Aranet2_HOME_F_900x900_90OVA5J.original.webp → Aranet2.webp} +0 -0
- /package/public/images/{Bank Manager All-in-onewc.webp → BankManager.webp} +0 -0
- /package/public/images/{Gobius_C.png → GobiusCTankMeter.png} +0 -0
- /package/public/images/{Victron-SmartShunt.jpg → VictronSmartShunt.jpg} +0 -0
- /package/public/images/{smartsolarMPPT7515.png → VictronSmartSolarMPPT7515.png} +0 -0
|
@@ -19,6 +19,8 @@ object-assign
|
|
|
19
19
|
|
|
20
20
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
21
21
|
|
|
22
|
+
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
23
|
+
|
|
22
24
|
/**
|
|
23
25
|
* @license React
|
|
24
26
|
* react-is.production.min.js
|
package/public/764.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunkbt_sensors_plugin_sk=self.webpackChunkbt_sensors_plugin_sk||[]).push([[764],{62995:(e,t,n)=>{"use strict";n.r(t),n.d(t,{BTConfig:()=>A,default:()=>k});var a=n(73490),s=n(74810),r=n(40334),o=n(64147),c=n.n(o),i=n(86452),l=n(27606),u=n(82096),m=n(95027),d=n(86038),g=n(47041),f=n(39676),h=n(71431),p=n(3768),E=n(43540),w=n(38250),y=n(31008),S=n(20455),b=n(23399);const v=e=>console.log.bind(console,e);function A(e){const t=(0,u.A)(e=>({root:{"& > *":{margin:e.spacing(1)}}})),[n,A]=(0,o.useState)({}),[k,C]=(0,o.useState)({}),[D,$]=(0,o.useState)({}),[_,N]=(0,o.useState)({"ui:options":{label:!1},paths:{enableMarkdownInDescription:!0},title:{"ui:widget":"hidden"}}),[x,T]=(0,o.useState)(),[O,j]=(0,o.useState)(new Map),[M,U]=(0,o.useState)({progress:0,maxTimeout:100,deviceCount:0,totalDevices:0}),[J,L]=(0,o.useState)("unknown"),[I,K]=(0,o.useState)(),P=t();function R(e,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 B(e,t={}){let n;try{const a=Object.keys(t).length?"?"+new URLSearchParams(t).toString():"";n=await fetch(`/plugins/bt-sensors-plugin-sk/${e}${a}`,{credentials:"include",method:"GET"})}catch(e){n={status:500,statusText:e.toString()}}return n}function G(e){return Object.keys(e.configCopy).length>0}function W(e){const t=G(e);return c().createElement(S.A,{action:!0,onClick:()=>{e.config.mac_address=e.info.mac,$(e.schema),T(e.config)}},c().createElement("div",{class:"d-flex justify-content-between align-items-center",style:t?{fontWeight:"normal"}:{fontStyle:"italic"}},`${e._changesMade?"*":""}${e.info.name} MAC: ${e.info.mac} RSSI: ${n=e.info.RSSI,null==n?NaN:n}`,c().createElement("div",{class:"d-flex justify-content-between "},function(e){return null==e.info.lastContactDelta||e.info.lastContactDelta>e.config.discoveryTimeout?c().createElement(p.A,null):e.info.signalStrength>80?c().createElement(h.A,null):e.info.signalStrength>60?c().createElement(f.A,null):e.info.signalStrength>40?c().createElement(g.A,null):e.info.signalStrength>20?c().createElement(d.A,null):c().createElement(m.A,null)}(e))));var n}function H(e){window.open(e,"_blank","noreferrer")}return(0,o.useEffect)(()=>{let e=null;return B("getPluginState").then(async t=>{if(404==t.status)throw L("unknown"),new Error("unable to get plugin state");const n=await t.json();e=new EventSource("/plugins/bt-sensors-plugin-sk/sse",{withCredentials:!0}),e.addEventListener("newsensor",e=>{!function(e){let t=JSON.parse(e.data);console.log(`New sensor: ${t.info.mac}`),j(e=>(e.set(t.info.mac,t),new Map(e)))}(e)}),e.addEventListener("sensorchanged",e=>{!function(e){console.log("sensorchanged");const t=JSON.parse(e.data);j(e=>{const n=e.get(t.mac);return n&&Object.assign(n.info,t),new Map(e)})}(e)}),e.addEventListener("progress",e=>{const t=JSON.parse(e.data);U(t)}),e.addEventListener("pluginstate",e=>{const t=JSON.parse(e.data);L(t.state)}),L(n.state),(async()=>{const e=await async function(){const e=await B("getSensors");if(200!=e.status)throw new Error(`Unable get sensor data: ${e.statusText} (${e.status}) `);return await e.json()}();j(new Map(e.map(e=>[e.info.mac,e])))})()}).catch(e=>{K(e)}),()=>{console.log("Closing connection to SSE"),e.close()}},[]),(0,o.useEffect)(()=>{if(!x||!O)return;const e=O.get(x.mac_address);e&&D&&x&&Object.hasOwn(x,"params")&&"UNKNOWN"==e.info.class&&x.params.sensorClass&&"UNKNOWN"!=x.params.sensorClass&&async function(e,t){const n=await B("getSensorInfo",{mac_address:e,class:t});if(200!=n.status)throw new Error(`Unable get sensor info: ${n.statusText} (${n.status}) `);return await n.json()}(x.mac_address,x.params.sensorClass).then(e=>{$(e.schema)})},[x]),(0,o.useEffect)(()=>{"started"==J?(async function(){const e=await B("getBaseData");if(200!=e.status)throw new Error(`Unable to get base data: ${e.statusText} (${e.status}) `);const t=await e.json();return t.schema.htmlDescription=c().createElement("div",null,(0,r.Ay)(t.schema.htmlDescription),c().createElement("p",null)),t}().then(e=>{A(e.schema),C(e.data)}).catch(e=>{K(e)}),async function(){const e=await B("getProgress");if(200!=e.status)throw new Error(`Unable to get progress: ${e.statusText} (${e.status}) `);return await e.json()}().then(e=>{U(e)}).catch(e=>{K(e)})):(A({}),C({}))},[J]),"stopped"==J||"unknown"==J?c().createElement("h3",null,"Enable plugin to see configuration"):c().createElement("div",null,c().createElement("div",{className:P.root},c().createElement(i.A,{variant:"contained",onClick:()=>{H("https://github.com/naugehyde/bt-sensors-plugin-sk/tree/1.2.0-beta#configuration")}},"Documentation"),c().createElement(i.A,{variant:"contained",onClick:()=>{H("https://github.com/naugehyde/bt-sensors-plugin-sk/issues/new/choose")}},"Report Issue"),c().createElement(i.A,{variant:"contained",onClick:()=>{H("https://discord.com/channels/1170433917761892493/1295425963466952725")}},"Discord Thread"),c().createElement("p",null),c().createElement("p",null)),c().createElement("hr",{style:{width:"100%",height:"1px",color:"gray","background-color":"gray","text-align":"left","margin-left":0}}),I?c().createElement("h2",{style:"color: red;"},I):"",c().createElement(a.Ay,{schema:n,validator:s.Ay,uiSchema:{"ui:field":"LayoutGridField","ui:layoutGrid":{"ui:row":[{"ui:row":{className:"row",children:[{"ui:columns":{className:"col-xs-4",children:["adapter","transport","duplicateData","discoveryTimeout","discoveryInterval"]}}]}}]}},onChange:e=>C(e.formData),onSubmit:({formData:e},t)=>{var n;n=e,j(new Map),R("updateBaseData",n).then(e=>{200!=e.status&&K(new Error(`Unable to update base data: ${e.statusText} (${e.status})`))}),$({})},onError:v("errors"),formData:k}),c().createElement("hr",{style:{width:"100%",height:"1px",color:"gray","background-color":"gray","text-align":"left","margin-left":0}}),c().createElement("p",null),c().createElement("p",null),M.deviceCount<M.totalDevices?c().createElement(b.A,{max:M.maxTimeout,now:M.progress}):"",c().createElement("p",null),c().createElement(w.A,{defaultActiveKey:"_configured",id:"domain-tabs",className:"mb-3"},function(){const e=[...new Set(O.entries().map(e=>e[1].info.domain))].sort(),t=Array.from(O.entries()).filter(e=>G(e[1]));let n={};return n._configured=0==t.length?"Select a device from its domain tab (Electrical etc.) and configure it.":t.map(e=>W(O.get(e[0]))),e.forEach(e=>{var t;n[e]=(t=e,Array.from(O.entries()).filter(e=>e[1].info.domain===t)).map(e=>W(O.get(e[0])))}),Object.keys(n).map(e=>function(e,t){let n=e.slice("_"===e.charAt(0)?1:0);return c().createElement(y.A,{eventKey:e,title:`${n.charAt(0).toUpperCase()}${n.slice(1)}${"string"==typeof t?"":" ("+t.length+")"}`},c().createElement(E.A,{style:{maxHeight:"300px",overflowY:"auto"}},t))}(e,n[e]))}()),c().createElement("div",{style:{paddingLeft:10,paddingTop:10,display:0==Object.keys(D).length?"none":""}},c().createElement(l.A,{container:!0,direction:"column",style:{spacing:5}},c().createElement(l.A,{item:!0},c().createElement("h2",null,D?.title),c().createElement("p",null)),c().createElement(l.A,{item:!0},(0,r.Ay)(D?.htmlDescription))),c().createElement(a.Ay,{schema:D,validator:s.Ay,uiSchema:_,onChange:e=>{const t=O.get(e.formData.mac_address);t&&(t._changesMade=!0,t.config=e.formData,T(e.formData))},onSubmit:({formData:e},t)=>{var n;R("updateSensorData",n=e).then(e=>{if(200!=e.status)throw new Error(e.statusText);j(e=>(e.delete(n.mac_address),new Map(e))),$({})}),alert("Changes saved")},onError:v("errors"),formData:x},c().createElement("div",{className:P.root},c().createElement(i.A,{type:"submit",color:"primary",variant:"contained"},"Save"),c().createElement(i.A,{variant:"contained",onClick:()=>{var e;e=x.mac_address,O.get(e)._changesMade=!1,O.get(e).config=JSON.parse(JSON.stringify(O.get(e).configCopy)),T(O.get(e).config)}},"Undo"),c().createElement(i.A,{variant:"contained",color:"secondary",onClick:e=>function(e){const t=O.get(e);(!G(t)||window.confirm(`Delete configuration for ${t.info.name}?`))&&function(e){try{R("removeSensorData",{mac_address:e}).then(e=>{if(200!=e.status)throw new Error(e.statusText)}),j(t=>(t.delete(e),new Map(t))),$({})}catch{}}(e)}(x.mac_address)},"Delete")))))}const k=A},95098:()=>{}}]);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/public/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var e,r,t={49445:()=>{}},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((
|
|
1
|
+
(()=>{var e,r,t={49445:()=>{}},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(96540)),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(49445)})();
|
package/public/remoteEntry.js
CHANGED
|
@@ -1 +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={43237:(e,r,t)=>{var n={"./PluginConfigurationPanel":()=>Promise.all([t.e(681),t.e(
|
|
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={43237:(e,r,t)=>{var n={"./PluginConfigurationPanel":()=>Promise.all([t.e(681),t.e(764)]).then(()=>()=>t(62995))},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].call(t.exports,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(()=>()=>_(96540)),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={21490:()=>g("default","react",!1,[,[1,17,0,0],[1,16,8,0],1],()=>_.e(540).then(()=>()=>_(96540))),42417:()=>g("default","react",!1,[0,16,8,0],()=>_.e(540).then(()=>()=>_(96540))),44167:()=>v("default","react",!1,()=>_.e(540).then(()=>()=>_(96540))),57920:()=>g("default","react",!1,[,[0,17],[1,16,14,0],1],()=>_.e(540).then(()=>()=>_(96540))),61104:()=>g("default","react",!1,[,[1,16,0,0,,0],[1,15,0,0],[2,0,14,0],1,1],()=>_.e(540).then(()=>()=>_(96540))),62085:()=>g("default","react",!1,[1,16,14,0],()=>_.e(540).then(()=>()=>_(96540))),64147:()=>g("default","react",!1,[1,16,13,1],()=>_.e(540).then(()=>()=>_(96540))),87227:()=>g("default","react",!1,[0,16,6,0],()=>_.e(540).then(()=>()=>_(96540))),96932:()=>g("default","react",!1,[0,15,0,0],()=>_.e(540).then(()=>()=>_(96540))),98271:()=>g("default","react",!1,[0,0,14,0],()=>_.e(540).then(()=>()=>_(96540)))},y={764:[21490,42417,44167,57920,61104,62085,64147,87227,96932,98271]},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=_(43237);bt_sensors_plugin_sk=j})();
|
package/readUUID.exp
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/expect -f
|
|
2
|
+
|
|
3
|
+
set device [lindex $argv 0];
|
|
4
|
+
set uuid [lindex $argv 1];
|
|
5
|
+
set notifies [lindex $argv 2];
|
|
6
|
+
set timeout 60
|
|
7
|
+
spawn bluetoothctl
|
|
8
|
+
send -- "scan on\r"
|
|
9
|
+
expect $device
|
|
10
|
+
send -- "connect $device\r"
|
|
11
|
+
expect "ServicesResolved: yes"
|
|
12
|
+
send -- "scan off\r"
|
|
13
|
+
expect "Discovering: no"
|
|
14
|
+
send -- "menu gatt\r"
|
|
15
|
+
expect "Menu gatt:"
|
|
16
|
+
send -- "select-attribute $uuid\r"
|
|
17
|
+
expect "service"
|
|
18
|
+
send -- "read\r"
|
|
19
|
+
expect "Attribute"
|
|
20
|
+
send -- "back\r"
|
|
21
|
+
expect "Menu main:"
|
|
22
|
+
send -- "disconnect\r"
|
|
23
|
+
expect "disconnected"
|
package/sensor_classes/ATC.js
CHANGED
|
@@ -92,13 +92,14 @@ class ATC extends BTSensor{
|
|
|
92
92
|
this.emitData("voltage", buff)
|
|
93
93
|
this.emitData("batteryStrength", buff)
|
|
94
94
|
|
|
95
|
-
}
|
|
95
|
+
}
|
|
96
|
+
static ImageFile= "ATC.jpeg"
|
|
96
97
|
getManufacturer(){
|
|
97
98
|
return "ATC1441 (custom firmware see: https://github.com/atc1441)"
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
getDescription(){
|
|
101
|
-
return `<div><p><img src
|
|
102
|
+
return `<div><p><img src=${this.getImageSrc()}${this.getImageFile()} alt="ATC/LYWSD03MMC image" style="float: left; margin-right: 10px;" />
|
|
102
103
|
Xiaomi LYWSD03MMC custom firmware provided by <b>ATC1441</b>.
|
|
103
104
|
For more information, see: <a href=https://github.com/atc1441/ATC_MiThermometer?tab=readme-ov-file#atc_mithermometer target="_blank">ATC_MiThermometer</a><div>`
|
|
104
105
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const OutOfRangeDevice = require('../../OutOfRangeDevice')
|
|
2
|
+
const DistanceManager = require('../../DistanceManager')
|
|
3
|
+
|
|
4
|
+
function getDistances(distanceManager, mac, txPower, rssi ){
|
|
5
|
+
const accuracy = (Math.min(1,+(txPower/rssi).toFixed(3)))
|
|
6
|
+
return {
|
|
7
|
+
avgDistance: +distanceManager.getDistance(mac, txPower, DistanceManager.METHOD_AVG, true).toFixed(2),
|
|
8
|
+
weightedAveDistance: +distanceManager.getDistance(mac, txPower, DistanceManager.METHOD_WEIGHTED_AVG, true).toFixed(2),
|
|
9
|
+
sampledDistance: +distanceManager.getDistance(mac, txPower, DistanceManager.METHOD_LAST_FEW_SAMPLES, true).toFixed(2),
|
|
10
|
+
accuracy: accuracy
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class AbstractBeaconMixin {
|
|
16
|
+
|
|
17
|
+
constructor(obj){
|
|
18
|
+
this.elapsedTimeSinceLastContact=this.elapsedTimeSinceLastContact.bind(obj)
|
|
19
|
+
this.initSchema=this.initSchema.bind(obj)
|
|
20
|
+
this.initListen=this.initListen.bind(obj)
|
|
21
|
+
this.propertiesChanged=this.propertiesChanged.bind(obj)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
initListen() {
|
|
25
|
+
if (this.device instanceof OutOfRangeDevice){
|
|
26
|
+
this.emit("onBoard",false)
|
|
27
|
+
//{message:`Crew Member: ${this.crewMember} evidently not on board.`})
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
initSchema() {
|
|
32
|
+
this.addDefaultParam("id")
|
|
33
|
+
.examples=["captain_keyring", "firstMate_keyring"]
|
|
34
|
+
this.addParameter(
|
|
35
|
+
"crewMember",
|
|
36
|
+
{
|
|
37
|
+
title:'crew member associated with beacon',
|
|
38
|
+
default: "Captain"
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
this.addParameter(
|
|
42
|
+
"presenceThreshhold",
|
|
43
|
+
{
|
|
44
|
+
title:'distance in meters beyond which presence on board should not be presumed',
|
|
45
|
+
type: 'integer',
|
|
46
|
+
default: 20
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
this.addParameter(
|
|
50
|
+
"lastContactThreshhold",
|
|
51
|
+
{
|
|
52
|
+
title:'time in seconds beyond which presence on board should not be presumed',
|
|
53
|
+
type: 'integer',
|
|
54
|
+
default: 30
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
this.addMetadatum("approxDistance","","approximate sensor distance from server")
|
|
58
|
+
.default="sensors.{macAndName}.distance.approximate"
|
|
59
|
+
|
|
60
|
+
this.addMetadatum("onBoard","","boolean indicating crew member likely presence on board")
|
|
61
|
+
.default="manifest.crew.{crewMember}.onBoard"
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
elapsedTimeSinceLastContact(lc){
|
|
65
|
+
if (Number.isNaN(lc) || lc > this.lastContactThreshhold){
|
|
66
|
+
this.emit("onBoard",false)
|
|
67
|
+
}
|
|
68
|
+
return lc
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
propertiesChanged(props){
|
|
72
|
+
if(Object.hasOwn(props,"RSSI")){
|
|
73
|
+
const mac = this.getMacAddress()
|
|
74
|
+
const rssi = props.RSSI.value
|
|
75
|
+
this.constructor.DistanceManagerSingleton.addSample(mac, rssi)
|
|
76
|
+
const distances= getDistances(this.constructor.DistanceManagerSingleton, mac, this.getTxPower(), rssi)
|
|
77
|
+
if (distances){
|
|
78
|
+
this.emit("approxDistance", distances)
|
|
79
|
+
this.emit("onBoard", distances.avgDistance<this?.presenceThreshhold??20)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
module.exports=AbstractBeaconMixin
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const AbstractBeaconMixin = require("./AbstractBeaconMixin")
|
|
2
|
+
|
|
3
|
+
function getTxPower(){
|
|
4
|
+
return (this.app.getSelfPath(this._txPowerPath)?.value??0)-41
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Eddystone extends AbstractBeaconMixin {
|
|
9
|
+
static ServiceUUID= "0000feaa-0000-1000-8000-00805f9b34fb"
|
|
10
|
+
|
|
11
|
+
constructor( obj ){
|
|
12
|
+
super(obj)
|
|
13
|
+
obj.getTxPower=getTxPower.bind(obj)
|
|
14
|
+
}
|
|
15
|
+
initSchema(){
|
|
16
|
+
super.initSchema()
|
|
17
|
+
this.addMetadatum("eddystone.voltage","v","sensor voltage as reported by Eddystone protocol",
|
|
18
|
+
(array)=>{ return array.readUInt16BE(2)/1000}
|
|
19
|
+
)
|
|
20
|
+
.default="sensors.{macAndName}.eddystone.voltage"
|
|
21
|
+
|
|
22
|
+
this.addMetadatum("eddystone.temperature","K","sensor temperature as reported by Eddystone protocol",
|
|
23
|
+
(array)=>{ return 273.15+(array.readInt16BE(5)/1000)}
|
|
24
|
+
)
|
|
25
|
+
.examples=["sensors.{macAndName}.eddystone.temperature"]
|
|
26
|
+
|
|
27
|
+
this.addMetadatum("eddystone.advertCount","","number of advertisements sent by device",
|
|
28
|
+
(array)=>{ return array.readUIntBE(7,3) }
|
|
29
|
+
)
|
|
30
|
+
.examples=["sensors.{macAndName}.eddystone.advertisements"]
|
|
31
|
+
|
|
32
|
+
this.addMetadatum("eddystone.timePowered","s","times since powered up (in seconds)",
|
|
33
|
+
(array)=>{ return array.readUIntBE(11,3)/10 }
|
|
34
|
+
)
|
|
35
|
+
.examples=["sensors.{macAndName}.eddystone.timePowered"]
|
|
36
|
+
|
|
37
|
+
this.addMetadatum("eddystone.url","","Eddystone URL",
|
|
38
|
+
(array)=>{ return array.toString('utf8',3) }
|
|
39
|
+
)
|
|
40
|
+
.examples=["sensors.{macAndName}.eddystone.url"]
|
|
41
|
+
|
|
42
|
+
this.addMetadatum("eddystone.txPower","db","signal strength at zero meters (db)",
|
|
43
|
+
(array)=>{ return array.readInt8(1) }
|
|
44
|
+
)
|
|
45
|
+
.default="sensors.{macAndName}.eddystone.txPower"
|
|
46
|
+
|
|
47
|
+
if (this._paths && this._paths["eddystone.txPower"])
|
|
48
|
+
this._txPowerPath=this.preparePath(this._paths["eddystone.txPower"])
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
propertiesChanged(props){
|
|
53
|
+
super.propertiesChanged(props)
|
|
54
|
+
if (Object.hasOwn(props,"ServiceData")) {
|
|
55
|
+
const sd = this.valueIfVariant(props.ServiceData)[Eddystone.ServiceUUID]
|
|
56
|
+
|
|
57
|
+
if (sd) {
|
|
58
|
+
const buff=sd.value;
|
|
59
|
+
if (buff && buff.length>0 && buff[0]==0x20) {
|
|
60
|
+
|
|
61
|
+
this.emitData("eddystone.voltage", buff)
|
|
62
|
+
this.emitData("eddystone.temperature",buff)
|
|
63
|
+
this.emitData("eddystone.advertCount",buff)
|
|
64
|
+
this.emitData("eddystone.timePowered",buff)
|
|
65
|
+
} else
|
|
66
|
+
|
|
67
|
+
if (buff && buff.length>0 && buff[0]==0x10) {
|
|
68
|
+
this.emitData("eddystone.url", buff)
|
|
69
|
+
this.emitData("eddystone.txPower", buff)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
module.exports=Eddystone
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const AbstractBeaconMixin = require('./AbstractBeaconMixin')
|
|
2
|
+
function getTxPower(){
|
|
3
|
+
return (this.app.getSelfPath(this._txPowerPath)?.value??0)
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
class iBeacon extends AbstractBeaconMixin {
|
|
7
|
+
static ManufacturerID= 0x004c
|
|
8
|
+
constructor( obj ){
|
|
9
|
+
super(obj)
|
|
10
|
+
obj.getTxPower=getTxPower.bind(obj)
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
initSchema(){
|
|
14
|
+
super.initSchema()
|
|
15
|
+
this.addMetadatum("iBeacon.uuid","","sensor UUID",
|
|
16
|
+
(array)=>{
|
|
17
|
+
let s = ''
|
|
18
|
+
array.slice(2,18).forEach((v)=>{s+= v.toString('16').padStart(2,'0')})
|
|
19
|
+
return s
|
|
20
|
+
})
|
|
21
|
+
.default="sensors.{macAndName}.iBeacon.uuid"
|
|
22
|
+
|
|
23
|
+
this.addMetadatum("iBeacon.major","","sensor major ID",
|
|
24
|
+
(array)=>{return array.readUInt16BE(18)}
|
|
25
|
+
)
|
|
26
|
+
.examples=["sensors.{macAndName}.iBeacon.major"]
|
|
27
|
+
|
|
28
|
+
this.addMetadatum("iBeacon.minor","","sensor minor ID",
|
|
29
|
+
(array)=>{return array.readUInt16BE(20)}
|
|
30
|
+
)
|
|
31
|
+
.examples=["sensors.{macAndName}.iBeacon.minor"]
|
|
32
|
+
|
|
33
|
+
this.addMetadatum("iBeacon.txPower","db","signal strength at one meter (db)",
|
|
34
|
+
(array)=>{return array.readInt8(22)}
|
|
35
|
+
)
|
|
36
|
+
.default="sensors.{macAndName}.iBeacon.txPower"
|
|
37
|
+
|
|
38
|
+
if (this._paths && this._paths["iBeacon.txPower"])
|
|
39
|
+
this._txPowerPath=this.preparePath(this._paths["iBeacon.txPower"])
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
propertiesChanged(props){
|
|
43
|
+
super.propertiesChanged(props)
|
|
44
|
+
if (Object.hasOwn(props,"ManufacturerData")){
|
|
45
|
+
const md = this.valueIfVariant(props.ManufacturerData)[ iBeacon.ManufacturerID]
|
|
46
|
+
if (md){
|
|
47
|
+
const buff=md.value
|
|
48
|
+
if (buff && buff.length>0 && buff[0]==0x02) {
|
|
49
|
+
this.emitData("iBeacon.uuid", buff)
|
|
50
|
+
this.emitData("iBeacon.major", buff)
|
|
51
|
+
this.emitData("iBeacon.minor", buff)
|
|
52
|
+
this.emitData("iBeacon.txPower", buff)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
module.exports=iBeacon
|