bt-sensors-plugin-sk 1.2.0-beta.0.1.3 → 1.2.0-beta.0.1.5
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/README.md +8 -1
- package/bt-sensors-plugin-sk.json.bak +121 -0
- package/index.js +2 -1
- package/package.json +1 -1
- package/public/159.js +1 -1
- package/public/239.js +11 -5
- package/public/540.js +1 -1
- package/public/778.js +1 -1
- package/public/main.js +1 -1
- package/public/remoteEntry.js +1 -1
- package/sensor_classes/BTHome/AbstractBTHomeSensor.js +53 -5
- package/sensor_classes/JBDBMS.js +19 -10
- package/sensor_classes/Renogy/RenogySensor.js +24 -22
- package/sensor_classes/RenogyRoverClient.js +5 -7
- package/sensor_classes/ShellySBHT003C.js +1 -1
- package/sensor_classes/ShellySBMO003Z.js +17 -2
- package/.vscode/launch.json +0 -7
- package/testqueue.js +0 -64
package/public/540.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
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],{
|
|
2
|
+
"use strict";(self.webpackChunkbt_sensors_plugin_sk=self.webpackChunkbt_sensors_plugin_sk||[]).push([[540],{15287:(e,r,t)=>{var n=t(45228),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"},96540:(e,r,t)=>{e.exports=t(15287)}}]);
|
package/public/778.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see 778.js.LICENSE.txt */
|
|
2
|
-
"use strict";(self.webpackChunkbt_sensors_plugin_sk=self.webpackChunkbt_sensors_plugin_sk||[]).push([[540,778],{
|
|
2
|
+
"use strict";(self.webpackChunkbt_sensors_plugin_sk=self.webpackChunkbt_sensors_plugin_sk||[]).push([[540,778],{15287:(e,r,t)=>{var n=t(45228),o="function"==typeof Symbol&&Symbol.for,u=o?Symbol.for("react.element"):60103,c=o?Symbol.for("react.portal"):60106,f=o?Symbol.for("react.fragment"):60107,l=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,b="function"==typeof Symbol&&Symbol.iterator;function v(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 m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_={};function g(e,r,t){this.props=e,this.context=r,this.refs=_,this.updater=t||m}function S(){}function k(e,r,t){this.props=e,this.context=r,this.refs=_,this.updater=t||m}g.prototype.isReactComponent={},g.prototype.setState=function(e,r){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(v(85));this.updater.enqueueSetState(this,e,r,"setState")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},S.prototype=g.prototype;var w=k.prototype=new S;w.constructor=k,n(w,g.prototype),w.isPureReactComponent=!0;var j={current:null},O=Object.prototype.hasOwnProperty,C={key:!0,ref:!0,__self:!0,__source:!0};function $(e,r,t){var n,o={},c=null,f=null;if(null!=r)for(n in void 0!==r.ref&&(f=r.ref),void 0!==r.key&&(c=""+r.key),r)O.call(r,n)&&!C.hasOwnProperty(n)&&(o[n]=r[n]);var l=arguments.length-2;if(1===l)o.children=t;else if(1<l){for(var i=Array(l),a=0;a<l;a++)i[a]=arguments[a+2];o.children=i}if(e&&e.defaultProps)for(n in l=e.defaultProps)void 0===o[n]&&(o[n]=l[n]);return{$$typeof:u,type:e,key:c,ref:f,props:o,_owner:j.current}}function E(e){return"object"==typeof e&&null!==e&&e.$$typeof===u}var P=/\/+/g,x=[];function R(e,r,t,n){if(x.length){var o=x.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>x.length&&x.push(e)}function I(e,r,t,n){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var f=!1;if(null===e)f=!0;else switch(o){case"string":case"number":f=!0;break;case"object":switch(e.$$typeof){case u:case c:f=!0}}if(f)return t(n,e,""===r?"."+U(e,0):r),1;if(f=0,r=""===r?".":r+":",Array.isArray(e))for(var l=0;l<e.length;l++){var i=r+U(o=e[l],l);f+=I(o,i,t,n)}else if("function"==typeof(i=null===e||"object"!=typeof e?null:"function"==typeof(i=b&&e[b]||e["@@iterator"])?i:null))for(e=i.call(e),l=0;!(o=e.next()).done;)f+=I(o=o.value,i=r+U(o,l++),t,n);else if("object"===o)throw t=""+e,Error(v(31,"[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t,""));return f}function q(e,r,t){return null==e?0:I(e,"",r,t)}function U(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&&(E(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,"$&/")+"/"),q(e,L,r=R(r,u,n,o)),A(r)}var N={current:null};function D(){var e=N.current;if(null===e)throw Error(v(321));return e}var T={ReactCurrentDispatcher:N,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:j,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;q(e,F,r=R(null,null,r,t)),A(r)},count:function(e){return q(e,(function(){return null}),null)},toArray:function(e){var r=[];return M(e,r,null,(function(e){return e})),r},only:function(e){if(!E(e))throw Error(v(143));return e}},r.Component=g,r.Fragment=f,r.Profiler=i,r.PureComponent=k,r.StrictMode=l,r.Suspense=y,r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T,r.cloneElement=function(e,r,t){if(null==e)throw Error(v(267,e));var o=n({},e.props),c=e.key,f=e.ref,l=e._owner;if(null!=r){if(void 0!==r.ref&&(f=r.ref,l=j.current),void 0!==r.key&&(c=""+r.key),e.type&&e.type.defaultProps)var i=e.type.defaultProps;for(a in r)O.call(r,a)&&!C.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:c,ref:f,props:o,_owner:l}},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.createFactory=function(e){var 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=E,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 D().useCallback(e,r)},r.useContext=function(e,r){return D().useContext(e,r)},r.useDebugValue=function(){},r.useEffect=function(e,r){return D().useEffect(e,r)},r.useImperativeHandle=function(e,r,t){return D().useImperativeHandle(e,r,t)},r.useLayoutEffect=function(e,r){return D().useLayoutEffect(e,r)},r.useMemo=function(e,r){return D().useMemo(e,r)},r.useReducer=function(e,r,t){return D().useReducer(e,r,t)},r.useRef=function(e){return D().useRef(e)},r.useState=function(e){return D().useState(e)},r.version="16.14.0"},45228:e=>{var r=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var r={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(r).map((function(e){return r[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,o){for(var u,c,f=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l<arguments.length;l++){for(var i in u=Object(arguments[l]))t.call(u,i)&&(f[i]=u[i]);if(r){c=r(u);for(var a=0;a<c.length;a++)n.call(u,c[a])&&(f[c[a]]=u[c[a]])}}return f}},96540:(e,r,t)=>{e.exports=t(15287)}}]);
|
package/public/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var e,r,t={
|
|
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(778).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,a,o,i,u,s,l,f,d,c,p,h,v,g,b,m,y,w,k={
|
|
1
|
+
var bt_sensors_plugin_sk;(()=>{"use strict";var e,r,t,n,a,o,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(239),t.e(159)]).then((()=>()=>t(62995)))},a=(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),o=(e,r)=>{if(t.S){var n="default",a=t.S[n];if(a&&a!==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:()=>a,init:()=>o})}},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,a,o)=>{if(e[t])e[t].push(n);else{var i,u;if(void 0!==a)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+a){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+a),i.src=t),e[t]=[n];var d=(r,n)=>{i.onerror=i.onload=null,clearTimeout(c);var a=e[t];if(delete e[t],i.parentNode&&i.parentNode.removeChild(i),a&&a.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 a=r[t];if(a||(a=r[t]={}),!(n.indexOf(a)>=0)){if(n.push(a),e[t])return e[t];_.o(_.S,t)||(_.S[t]={});var o=_.S[t],i="bt-sensors-plugin-sk",u=[];return"default"===t&&((e,r,t,n)=>{var a=o[e]=o[e]||{},u=a[r];(!u||!u.loaded&&(1!=!u.eager?n:i>u.from))&&(a[r]={get:()=>_.e(778).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 a=e[n],o=(typeof a)[0];if(n>=r.length)return"u"==o;var i=r[n],u=(typeof i)[0];if(o!=u)return"o"==o&&"n"==u||"s"==u||"u"==o;if("o"!=o&&"u"!=o&&a!=i)return a<i;n++}},a=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,o=1;o<e.length;o++)n--,t+="u"==(typeof(u=e[o]))[0]?"-":(n>0?".":"")+(n=2,u);return t}var i=[];for(o=1;o<e.length;o++){var u=e[o];i.push(0===u?"not("+s()+")":1===u?"("+s()+" || "+s()+")":2===u?i.pop()+" "+i.pop():a(u))}return s();function s(){return i.pop().replace(/^\((.+)\)$/,"$1")}},o=(e,r)=>{if(0 in e){r=t(r);var n=e[0],a=n<0;a&&(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&&!a:""==d!=a);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(a?l>e[u]:l<e[u])return!1;l!=e[u]&&(s=!1)}else if("s"!=d&&"n"!=d){if(a||u<=n)return!1;s=!1,u--}else{if(u<=n||f<d!=a)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?o(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 a=t?s(e[r]):e[r];return(r=Object.keys(a).reduce(((e,r)=>!e||n(e,r)?r:e),0))&&a[r]},f=(e,r,t,a)=>{var i=a?s(e[r]):e[r];return(r=Object.keys(i).reduce(((e,r)=>!o(t,r)||e&&!n(e,r)?e:r),0))&&i[r]},d=(e,r,t,n,o)=>{var i=e[t];return"No satisfying version ("+a(n)+")"+(o?" 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,a,o){var i=_.I(r);return i&&i.then&&!n?i.then(e.bind(e,r,_.S[r],t,!1,a,o)):e(r,_.S[r],t,n,a,o)})(((e,r,t,n,a)=>i(r,t)?u(l(r,t,n)):h(e,t,a))),g=p(((e,r,t,n,a,o)=>{if(!i(r,t))return h(e,t,o);var s=f(r,t,a,n);return s?u(s):o?o():void c(d(r,e,t,a,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))))),62085:()=>g("default","react",!1,[1,16,14,0],(()=>_.e(540).then((()=>()=>_(96540))))),64115:()=>g("default","react",!1,[,[1,19,0,0,,"rc",1],[1,18,0,0],[1,17,0,0,,"rc",1],[1,16,8,0],1,1,1],(()=>_.e(540).then((()=>()=>_(96540))))),64564:()=>g("default","react",!1,[0,16,14,0],(()=>_.e(540).then((()=>()=>_(96540))))),86528:()=>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={159:[21490,42417,44167,57920,62085,64115,64564,86528,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 a=m[e]();a.then?r.push(b[e]=a.then(t).catch(n)):t(a)}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 a=new Promise(((t,a)=>n=e[r]=[t,a]));t.push(n[2]=a);var o=_.p+_.u(r),i=new Error;_.l(o,(t=>{if(_.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var a=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+a+": "+o+")",i.name="ChunkLoadError",i.type=a,i.request=o,n[1](i)}}),"chunk-"+r,r)}};var r=(r,t)=>{var n,a,[o,i,u]=t,s=0;if(o.some((r=>0!==e[r]))){for(n in i)_.o(i,n)&&(_.m[n]=i[n]);u&&u(_)}for(r&&r(t);s<o.length;s++)a=o[s],_.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))})();var j=_(43237);bt_sensors_plugin_sk=j})();
|
|
@@ -49,10 +49,16 @@ class AbstractBTHomeSensor extends BTSensor {
|
|
|
49
49
|
static async identify(device) {
|
|
50
50
|
if (
|
|
51
51
|
(await this.hasBtHomeServiceData(device)) &&
|
|
52
|
-
(await this.hasName(
|
|
52
|
+
((await this.hasName(
|
|
53
53
|
device,
|
|
54
54
|
this.SHORTENED_LOCAL_NAME,
|
|
55
|
-
))
|
|
55
|
+
)) || (await this.hasNameAndAddress(
|
|
56
|
+
device,
|
|
57
|
+
this.SHORTENED_LOCAL_NAME,
|
|
58
|
+
)) || (await this.hasName(
|
|
59
|
+
device,
|
|
60
|
+
this.LOCAL_NAME,
|
|
61
|
+
)))
|
|
56
62
|
) {
|
|
57
63
|
return this;
|
|
58
64
|
}
|
|
@@ -111,6 +117,7 @@ class AbstractBTHomeSensor extends BTSensor {
|
|
|
111
117
|
*/
|
|
112
118
|
static async hasName(device, name) {
|
|
113
119
|
const deviceName = await this.getDeviceProp(device, "Name");
|
|
120
|
+
|
|
114
121
|
if (deviceName) {
|
|
115
122
|
if (deviceName === name) {
|
|
116
123
|
return true;
|
|
@@ -118,7 +125,36 @@ class AbstractBTHomeSensor extends BTSensor {
|
|
|
118
125
|
}
|
|
119
126
|
return false;
|
|
120
127
|
}
|
|
121
|
-
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Returns whether the specified device has a given name plus the last two bytes of its address.
|
|
131
|
+
*
|
|
132
|
+
* This method can be included in the {@link BTSensor#identify} method of inheriting sensor classes.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* static async identify(device) {
|
|
136
|
+
* if (await this.hasNameAndAddress(device)) {
|
|
137
|
+
* // Additional checks, if required
|
|
138
|
+
* return YourSensorClass;
|
|
139
|
+
* }
|
|
140
|
+
* return null;
|
|
141
|
+
* }
|
|
142
|
+
* @see BTSensor#identify
|
|
143
|
+
* @param device The Bluetooth device to check the name.
|
|
144
|
+
* @param name {string} The name to be checked for.
|
|
145
|
+
* @returns {Promise<boolean>} Returns `true`, if the device exposes BTHome service data, or `false`,
|
|
146
|
+
* if not.
|
|
147
|
+
*/
|
|
148
|
+
static async hasNameAndAddress(device, name) {
|
|
149
|
+
let deviceName = await this.getDeviceProp(device, "Name");
|
|
150
|
+
const address = (await this.getDeviceProp(device, "Address")).split(":")
|
|
151
|
+
if (deviceName) {
|
|
152
|
+
if (`${name}-${address[4]}${address[5]}`.localeCompare(deviceName, undefined, { sensitivity: 'base' } )==0)
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
122
158
|
* Returns measurement data for the given object ID from the given BTHomeData.
|
|
123
159
|
*
|
|
124
160
|
* @param btHomeData {BTHomeServiceData.BthomeServiceData}
|
|
@@ -159,7 +195,7 @@ class AbstractBTHomeSensor extends BTSensor {
|
|
|
159
195
|
)?.temperature;
|
|
160
196
|
if (tempCelsius) {
|
|
161
197
|
return Number.parseFloat(
|
|
162
|
-
(this.KELVIN_OFFSET + tempCelsius).toFixed(2),
|
|
198
|
+
(this.constructor.KELVIN_OFFSET + tempCelsius).toFixed(2),
|
|
163
199
|
);
|
|
164
200
|
}
|
|
165
201
|
return null;
|
|
@@ -204,11 +240,23 @@ class AbstractBTHomeSensor extends BTSensor {
|
|
|
204
240
|
parseMotion(btHomeData) {
|
|
205
241
|
const motion = this.getSensorDataByObjectId(
|
|
206
242
|
btHomeData,
|
|
207
|
-
BTHomeServiceData.BthomeObjectId.BINARY_MOTION
|
|
243
|
+
BTHomeServiceData.BthomeObjectId.BINARY_MOTION
|
|
208
244
|
)?.motion;
|
|
209
245
|
return motion.intValue==1
|
|
210
246
|
}
|
|
211
247
|
|
|
248
|
+
/**
|
|
249
|
+
* Extracts packet ID from the given BTHome data.
|
|
250
|
+
*
|
|
251
|
+
* @param btHomeData {BTHomeServiceData.BthomeServiceData} The BTHome data provided by the device.
|
|
252
|
+
* @returns {Number|null} The packet ID.
|
|
253
|
+
*/
|
|
254
|
+
parsePacketID(btHomeData) {
|
|
255
|
+
return this.getSensorDataByObjectId(
|
|
256
|
+
btHomeData,
|
|
257
|
+
BTHomeServiceData.BthomeObjectId.MISC_PACKET_ID,
|
|
258
|
+
).packetId
|
|
259
|
+
}
|
|
212
260
|
|
|
213
261
|
/**
|
|
214
262
|
* Extracts button press event from the given BTHome data.
|
package/sensor_classes/JBDBMS.js
CHANGED
|
@@ -5,7 +5,7 @@ function sleep(ms) {
|
|
|
5
5
|
});
|
|
6
6
|
}
|
|
7
7
|
class JBDBMS extends BTSensor {
|
|
8
|
-
static Domain = BTSensor.electrical
|
|
8
|
+
static Domain = BTSensor.SensorDomains.electrical
|
|
9
9
|
|
|
10
10
|
static TX_RX_SERVICE = "0000ff00-0000-1000-8000-00805f9b34fb"
|
|
11
11
|
static NOTIFY_CHAR_UUID = "0000ff01-0000-1000-8000-00805f9b34fb"
|
|
@@ -29,15 +29,18 @@ class JBDBMS extends BTSensor {
|
|
|
29
29
|
return await this.txChar.writeValueWithResponse(Buffer.from(this.jbdCommand(command)))
|
|
30
30
|
|
|
31
31
|
}
|
|
32
|
+
|
|
32
33
|
async initSchema(){
|
|
33
34
|
super.initSchema()
|
|
34
35
|
this.addDefaultParam("batteryID")
|
|
35
36
|
|
|
36
37
|
this.addDefaultPath('voltage','electrical.batteries.voltage')
|
|
37
|
-
.read=
|
|
38
|
+
.read=
|
|
39
|
+
(buffer)=>{return buffer.readUInt16BE(4) / 100}
|
|
38
40
|
|
|
39
|
-
this.addDefaultPath('
|
|
40
|
-
.read=
|
|
41
|
+
this.addDefaultPath('current','electrical.batteries.current')
|
|
42
|
+
.read=
|
|
43
|
+
(buffer)=>{return buffer.readInt16BE(6) / 100}
|
|
41
44
|
|
|
42
45
|
this.addDefaultPath('remainingCapacity','electrical.batteries.capacity.remaining')
|
|
43
46
|
.read=(buffer)=>{return buffer.readUInt16BE(8) / 100}
|
|
@@ -70,6 +73,7 @@ class JBDBMS extends BTSensor {
|
|
|
70
73
|
(buffer)=>{
|
|
71
74
|
return buffer.readUInt16BE(27+(i*2))/10
|
|
72
75
|
})
|
|
76
|
+
.default=`electrical.batteries.{batteryID}.Temperature${i+1}`
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
for (let i=0; i<this.numberOfCells; i++){
|
|
@@ -95,20 +99,23 @@ class JBDBMS extends BTSensor {
|
|
|
95
99
|
|
|
96
100
|
async initGATTNotifications(){
|
|
97
101
|
this.intervalID = setInterval(()=>{
|
|
102
|
+
|
|
98
103
|
this.emitGATT()
|
|
99
104
|
}, 1000*(this?.pollFreq??60) )
|
|
100
105
|
}
|
|
101
106
|
|
|
102
107
|
emitGATT(){
|
|
103
108
|
this.getAndEmitBatteryInfo()
|
|
104
|
-
|
|
109
|
+
setTimeout(()=>{this.getAndEmitCellVoltages()}, 10000)
|
|
105
110
|
}
|
|
106
111
|
|
|
112
|
+
|
|
107
113
|
async getNumberOfCellsAndTemps(){
|
|
108
114
|
var b = await this.getBuffer(0x3)
|
|
109
115
|
return {cells:b[25], temps:b[26]}
|
|
110
116
|
}
|
|
111
|
-
|
|
117
|
+
|
|
118
|
+
|
|
112
119
|
getBuffer(command){
|
|
113
120
|
|
|
114
121
|
return new Promise( async ( resolve, reject )=>{
|
|
@@ -122,9 +129,9 @@ class JBDBMS extends BTSensor {
|
|
|
122
129
|
}, 30000);
|
|
123
130
|
|
|
124
131
|
const valChanged = async (buffer) => {
|
|
125
|
-
this.debug(buffer)
|
|
126
132
|
buffer.copy(result,offset)
|
|
127
133
|
if (buffer[buffer.length-1]==0x77){
|
|
134
|
+
this.debug(result)
|
|
128
135
|
this.rxChar.removeAllListeners()
|
|
129
136
|
clearTimeout(timer)
|
|
130
137
|
resolve(result)
|
|
@@ -142,7 +149,7 @@ async initGATTConnection() {
|
|
|
142
149
|
}
|
|
143
150
|
|
|
144
151
|
getAndEmitBatteryInfo(){
|
|
145
|
-
|
|
152
|
+
this.getBuffer(0x03).then((buffer)=>{
|
|
146
153
|
(["current", "voltage", "remainingCapacity", "capacity","cycles", "protectionStatus", "SOC","FET",]).forEach((tag) =>
|
|
147
154
|
this.emitData( tag, buffer )
|
|
148
155
|
)
|
|
@@ -170,8 +177,10 @@ initGATTInterval(){
|
|
|
170
177
|
|
|
171
178
|
async stopListening(){
|
|
172
179
|
super.stopListening()
|
|
173
|
-
this.rxChar
|
|
174
|
-
|
|
180
|
+
if (this.rxChar)
|
|
181
|
+
this.rxChar.stopNotifications()
|
|
182
|
+
if (this.device)
|
|
183
|
+
await this.device.disconnect()
|
|
175
184
|
}
|
|
176
185
|
|
|
177
186
|
}
|
|
@@ -40,8 +40,8 @@ class RenogySensor extends BTSensor{
|
|
|
40
40
|
return null
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
async
|
|
44
|
-
await super.
|
|
43
|
+
async initSchema(){
|
|
44
|
+
await super.initSchema()
|
|
45
45
|
this.addParameter(
|
|
46
46
|
"refreshInterval",
|
|
47
47
|
{
|
|
@@ -54,16 +54,7 @@ class RenogySensor extends BTSensor{
|
|
|
54
54
|
{
|
|
55
55
|
title: 'ID of device'
|
|
56
56
|
}
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
await this.deviceConnect()
|
|
61
|
-
const rw = await this.constructor.getReadWriteCharacteristics(this.device)
|
|
62
|
-
|
|
63
|
-
this.readChar = rw.read
|
|
64
|
-
this.writeChar = rw.write
|
|
65
|
-
await this.readChar.startNotifications()
|
|
66
|
-
|
|
57
|
+
)
|
|
67
58
|
}
|
|
68
59
|
|
|
69
60
|
emitGATT(){
|
|
@@ -94,26 +85,37 @@ class RenogySensor extends BTSensor{
|
|
|
94
85
|
this.writeChar, this.getDeviceID(), writeReq, words)
|
|
95
86
|
}
|
|
96
87
|
|
|
97
|
-
|
|
98
|
-
|
|
88
|
+
initGATTInterval(){
|
|
89
|
+
this.emitGATT()
|
|
90
|
+
this.intervalID = setInterval(()=>{
|
|
91
|
+
this.emitGATT()
|
|
92
|
+
}, 1000*(this?.pollFreq??60) )
|
|
93
|
+
}
|
|
94
|
+
emitGATT(){
|
|
95
|
+
this.getAllEmitterFunctions().forEach(async (emitter)=>
|
|
99
96
|
await emitter()
|
|
100
97
|
)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}, 1000*(this?.refreshInterval??60) )
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async initGATTNotifications(){
|
|
101
|
+
|
|
106
102
|
}
|
|
107
103
|
|
|
104
|
+
async initGATTConnection() {
|
|
105
|
+
await this.deviceConnect()
|
|
106
|
+
const rw = await this.constructor.getReadWriteCharacteristics(this.device)
|
|
108
107
|
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
this.readChar = rw.read
|
|
109
|
+
this.writeChar = rw.write
|
|
110
|
+
await this.readChar.startNotifications()
|
|
111
|
+
|
|
111
112
|
}
|
|
113
|
+
|
|
112
114
|
usingGATT(){
|
|
113
115
|
return true
|
|
114
116
|
}
|
|
115
117
|
hasGATT(){
|
|
116
|
-
return
|
|
118
|
+
return true
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
async stopListening(){
|
|
@@ -8,10 +8,6 @@ const crc16Modbus = require('./Renogy/CRC.js')
|
|
|
8
8
|
|
|
9
9
|
class RenogyRoverClient extends RenogySensor {
|
|
10
10
|
|
|
11
|
-
async init(){
|
|
12
|
-
await super.init()
|
|
13
|
-
this.modelID=await this.retrieveModelID()
|
|
14
|
-
}
|
|
15
11
|
|
|
16
12
|
initSchema(){
|
|
17
13
|
//Buffer(73) [1, 3, 68, 32, 32, 82, 78, 71, 45, 67, 84, 82, 76, 45, 87, 78, 68, 51, 48, 7, 140, 0, 132, 0, 126, 0, 120, 0, 111, 0, 106, 100, 50, 0, 5, 0, 120, 0, 120, 0, 28, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 5, 0, 5, 2, 148, 0, 5, 206, 143, 34, 228, buffer: ArrayBuffer(8192), byteLength: 73, byteOffset: 6144, length: 73, Symbol(Symbol.toStringTag): 'Uint8Array']
|
|
@@ -84,7 +80,6 @@ class RenogyRoverClient extends RenogySensor {
|
|
|
84
80
|
})
|
|
85
81
|
}
|
|
86
82
|
|
|
87
|
-
|
|
88
83
|
async retrieveModelID(){
|
|
89
84
|
return new Promise( async ( resolve, reject )=>{
|
|
90
85
|
|
|
@@ -100,10 +95,13 @@ class RenogyRoverClient extends RenogySensor {
|
|
|
100
95
|
}
|
|
101
96
|
async initGATTConnection() {
|
|
102
97
|
await super.initGATTConnection()
|
|
103
|
-
this.batteryType = await this.retrieveBatteryType()
|
|
104
|
-
this.emit('batteryType', this.batteryType)
|
|
105
98
|
if (!this.deviceID)
|
|
106
99
|
this.deviceID = await this.retrieveDeviceID()
|
|
100
|
+
this.modelID=await this.retrieveModelID()
|
|
101
|
+
|
|
102
|
+
this.batteryType = await this.retrieveBatteryType()
|
|
103
|
+
this.emit('batteryType', this.batteryType)
|
|
104
|
+
|
|
107
105
|
|
|
108
106
|
}
|
|
109
107
|
|
|
@@ -2,7 +2,7 @@ const BTHomeServiceData = require("./BTHome/BTHomeServiceData");
|
|
|
2
2
|
const AbstractBTHomeSensor = require("./BTHome/AbstractBTHomeSensor");
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Sensor class representing the Shelly BLU
|
|
5
|
+
* Sensor class representing the Shelly BLU Motion.
|
|
6
6
|
*
|
|
7
7
|
* This sensor is publishing data utilising the BTHome format and inherits from {@link AbstractBTHomeSensor}.
|
|
8
8
|
*/
|
|
@@ -10,11 +10,16 @@ class ShellySBMO003Z extends AbstractBTHomeSensor {
|
|
|
10
10
|
static Domain = this.SensorDomains.environmental
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* The shortened local name as advertised by the Shelly BLU
|
|
13
|
+
* The shortened local name as advertised by the Shelly BLU Motion.
|
|
14
14
|
* @type {string}
|
|
15
15
|
*/
|
|
16
16
|
static SHORTENED_LOCAL_NAME = "SBMO-003Z";
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* The local name as advertised by the Shelly BLU Motion after pairing .
|
|
20
|
+
* @type {string}
|
|
21
|
+
*/
|
|
22
|
+
static LOCAL_NAME="Shelly BLU Motion";
|
|
18
23
|
|
|
19
24
|
initSchema() {
|
|
20
25
|
super.initSchema()
|
|
@@ -52,6 +57,16 @@ class ShellySBMO003Z extends AbstractBTHomeSensor {
|
|
|
52
57
|
)
|
|
53
58
|
.default="sensors.{macAndName}.button"
|
|
54
59
|
|
|
60
|
+
/*
|
|
61
|
+
this.addMetadatum(
|
|
62
|
+
"packetID",
|
|
63
|
+
null,
|
|
64
|
+
"packetID from sensor",
|
|
65
|
+
this.parsePacketID.bind(this)
|
|
66
|
+
)
|
|
67
|
+
.default="sensors.{macAndName}.packetID"
|
|
68
|
+
*/
|
|
69
|
+
|
|
55
70
|
}
|
|
56
71
|
}
|
|
57
72
|
|
package/.vscode/launch.json
DELETED
package/testqueue.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {createBluetooth} from 'node-ble'
|
|
4
|
-
|
|
5
|
-
import {AutoQueue} from "./Queue.js"
|
|
6
|
-
import {Variant} from 'dbus-next'
|
|
7
|
-
|
|
8
|
-
const {bluetooth, destroy} = createBluetooth()
|
|
9
|
-
const connectQueue = new AutoQueue()
|
|
10
|
-
const adapter = await bluetooth.getAdapter("hci0")
|
|
11
|
-
await adapter.startDiscovery()
|
|
12
|
-
|
|
13
|
-
function deviceConnect(mac) {
|
|
14
|
-
|
|
15
|
-
/* CAUTION: HACK AHEAD
|
|
16
|
-
|
|
17
|
-
Bluez for some cockamamie reason (It's 2025 for chrissake.
|
|
18
|
-
BLUETOOTH ISN'T JUST FOR DESKTOPS ANYMORE, BLUEZ DEVS!)
|
|
19
|
-
SUSPENDS scanning while connected to a device.
|
|
20
|
-
|
|
21
|
-
The next line of code gives the scanner a kick in the arse,
|
|
22
|
-
starting it up again so, I dunno, another device might be able
|
|
23
|
-
to connect and sensor classes could maybe get beacon updates.
|
|
24
|
-
|
|
25
|
-
You know, the little things.
|
|
26
|
-
*/
|
|
27
|
-
adapter.waitDevice(mac,(30000)).then((device) =>{
|
|
28
|
-
|
|
29
|
-
return connectQueue.enqueue( async ()=>{
|
|
30
|
-
console.log("Connecting to "+mac)
|
|
31
|
-
try {await device.connect()} catch {(e)=>console.log(e)}
|
|
32
|
-
try {
|
|
33
|
-
console.log("Connected to "+mac)
|
|
34
|
-
console.log("Stopping discovery for "+mac)
|
|
35
|
-
|
|
36
|
-
await adapter.helper.callMethod('StopDiscovery')
|
|
37
|
-
console.log("Discovery stopped for "+mac)
|
|
38
|
-
await adapter.helper.callMethod('SetDiscoveryFilter', {
|
|
39
|
-
Transport: new Variant('s', "le")
|
|
40
|
-
})
|
|
41
|
-
console.log("Starting discovery for "+mac)
|
|
42
|
-
await adapter.helper.callMethod('StartDiscovery')
|
|
43
|
-
console.log("Discovery started for "+mac)
|
|
44
|
-
|
|
45
|
-
} catch (e){
|
|
46
|
-
//probably ignorable error. probably.
|
|
47
|
-
console.log(e)
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
})
|
|
51
|
-
/* END HACK*/
|
|
52
|
-
}
|
|
53
|
-
setInterval( ()=>{
|
|
54
|
-
deviceConnect("D1:06:00:C6:16:4A")
|
|
55
|
-
}, 5000)
|
|
56
|
-
setInterval( ()=>{
|
|
57
|
-
|
|
58
|
-
for (const mac of (["D1:06:01:46:49:39","A4:C1:38:3E:7E:94"])){
|
|
59
|
-
try { deviceConnect(mac) } catch { (e)=>console.log(e) }
|
|
60
|
-
}
|
|
61
|
-
}, 10000)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|