bt-sensors-plugin-sk 1.2.6-beta-4 → 1.2.6-beta-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/BTSensor.js +4 -4
- package/README.md +5 -1
- package/index.js +9 -0
- package/package.json +1 -1
- package/sensor_classes/JikongBMS.js +30 -5
package/BTSensor.js
CHANGED
|
@@ -267,16 +267,16 @@ class BTSensor extends EventEmitter {
|
|
|
267
267
|
|
|
268
268
|
debug(message){
|
|
269
269
|
if (this._app)
|
|
270
|
-
this._app.debug(message)
|
|
270
|
+
this._app.debug(`${this.getName()}) ${message}`)
|
|
271
271
|
else
|
|
272
|
-
console.log(message)
|
|
272
|
+
console.log(`${this.getName()}) ${message}`)
|
|
273
273
|
this._debugLog.push({timestamp:Date.now(), message:message})
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
setError(message){
|
|
277
277
|
if (this._app){
|
|
278
|
-
this._app.debug(message)
|
|
279
|
-
this._app.setPluginError(message)
|
|
278
|
+
this._app.debug(`${this.getName()}) ${message}`)
|
|
279
|
+
this._app.setPluginError(`${this.getName()}) ${message}`)
|
|
280
280
|
}
|
|
281
281
|
else
|
|
282
282
|
console.log(message)
|
package/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Bluetooth Sensors for [Signal K](http://www.signalk.org)
|
|
2
2
|
|
|
3
3
|
## WHAT'S NEW
|
|
4
|
+
# Version 1.2.6-beta-5
|
|
5
|
+
|
|
6
|
+
- JikongBMS fixes
|
|
7
|
+
|
|
4
8
|
# Version 1.2.6-beta-4
|
|
5
9
|
|
|
6
10
|
- Improved reconnect logic for connected devices
|
|
@@ -111,12 +115,12 @@ It's pretty easy to write and deploy your own sensor class for any currently uns
|
|
|
111
115
|
|Redodo| Rebranded LiTime |
|
|
112
116
|
|Kilovault| [Kilovault HLX+ smart batteries ](https://sunwatts.com/content/manual/KiloVault_HLX_PLUS_Datasheet_06252021%20%281%29.pdf?srsltid=AfmBOooY-cGnC_Qm6V1T9Vg5oZzBCJurS0AOGoWqWeyy-dwz2vA-l1Jb) (Note: Kilovault appears to be out of business as of March 2024) |
|
|
113
117
|
|[Lancol](www.Lancol.com)| [Micro 10C 12V Car Battery Monitor](https://www.lancol.com/product/12v-bluetooth-4-0-battery-tester-micro-10-c/)|
|
|
118
|
+
|[Jikong](https://jikongbms.com/)| https://jikongbms.com/product/ |
|
|
114
119
|
|[Junctek](https://www.junteks.com)|[Junctek BMS](https://www.junteks.com/pages/product/index) |
|
|
115
120
|
|[Remoran](https://remoran.eu)| [Remoran Wave.3](https://remoran.eu/wave.html)|
|
|
116
121
|
|[AC DC Systems](https://marinedcac.com) | [Bank Manager] hybrid (Pb and Li) charger(https://marinedcac.com/pages/bankmanager)|
|
|
117
122
|
|[Ective](https://ective.de/)| Also Topband(?), Skanbatt and others |
|
|
118
123
|
|
|
119
|
-
|
|
120
124
|
### Environmental
|
|
121
125
|
| Manufacturer | Devices |
|
|
122
126
|
|--------------|----------|
|
package/index.js
CHANGED
|
@@ -85,6 +85,9 @@ class MissingSensor {
|
|
|
85
85
|
isActive(){
|
|
86
86
|
return false
|
|
87
87
|
}
|
|
88
|
+
isConnected(){return false}
|
|
89
|
+
|
|
90
|
+
|
|
88
91
|
elapsedTimeSinceLastContact(){
|
|
89
92
|
return NaN
|
|
90
93
|
}
|
|
@@ -94,6 +97,12 @@ class MissingSensor {
|
|
|
94
97
|
prepareConfig(){
|
|
95
98
|
|
|
96
99
|
}
|
|
100
|
+
getErrorLog(){
|
|
101
|
+
return []
|
|
102
|
+
}
|
|
103
|
+
getDebugLog(){
|
|
104
|
+
return []
|
|
105
|
+
}
|
|
97
106
|
|
|
98
107
|
}
|
|
99
108
|
module.exports = function (app) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bt-sensors-plugin-sk",
|
|
3
|
-
"version": "1.2.6-beta-
|
|
3
|
+
"version": "1.2.6-beta-5",
|
|
4
4
|
"description": "Bluetooth Sensors for Signalk - see https://www.npmjs.com/package/bt-sensors-plugin-sk#supported-sensors for a list of supported sensors",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"dependencies": {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { ThemeProvider } = require("react-bootstrap");
|
|
1
2
|
const BTSensor = require("../BTSensor");
|
|
2
3
|
let FakeDevice,FakeGATTService,FakeGATTCharacteristic;
|
|
3
4
|
|
|
@@ -108,6 +109,7 @@ class JikongBMS extends BTSensor {
|
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
|
|
112
|
+
pollFreq=20
|
|
111
113
|
async initSchema() {
|
|
112
114
|
super.initSchema();
|
|
113
115
|
this.addDefaultParam("batteryID");
|
|
@@ -452,26 +454,49 @@ class JikongBMS extends BTSensor {
|
|
|
452
454
|
this.debug(`${this.getName()}::initGATTConnection`);
|
|
453
455
|
|
|
454
456
|
await super.initGATTConnection(isReconnecting);
|
|
455
|
-
|
|
456
|
-
|
|
457
|
+
const gattServer = await this.getGATTServer();
|
|
458
|
+
|
|
459
|
+
this.rxService = await gattServer.getPrimaryService(
|
|
457
460
|
this.constructor.RX_SERVICE
|
|
458
461
|
);
|
|
462
|
+
|
|
463
|
+
if (this.rxChar)
|
|
464
|
+
try {
|
|
465
|
+
await this.rxChar.stopNotifications()
|
|
466
|
+
}
|
|
467
|
+
catch(e){
|
|
468
|
+
this.rxChar.removeAllListeners()
|
|
469
|
+
|
|
470
|
+
this.debug(`error while stopping notifications`)
|
|
471
|
+
this.debug(e)
|
|
472
|
+
}
|
|
473
|
+
|
|
459
474
|
this.rxChar = await this.rxService.getCharacteristic(
|
|
460
475
|
this.constructor.RX_CHAR_UUID
|
|
461
476
|
);
|
|
462
477
|
|
|
463
478
|
await this.rxChar.startNotifications();
|
|
464
|
-
|
|
479
|
+
try {
|
|
480
|
+
await this.getBuffer(0x97)
|
|
481
|
+
} catch (e) {
|
|
482
|
+
this.setError(e.message)
|
|
483
|
+
}
|
|
484
|
+
|
|
465
485
|
//this.debug(`(${this.getName()}) Connections: ${this.connections++}`)
|
|
466
486
|
}
|
|
467
487
|
|
|
468
488
|
activate(config, plugin) {
|
|
469
489
|
super.activate(config, plugin);
|
|
470
490
|
this.initGATTConnection().then(async () => {
|
|
471
|
-
|
|
491
|
+
try {
|
|
492
|
+
await this.getAndEmitBatteryInfo();
|
|
493
|
+
} catch(e) {
|
|
494
|
+
this.setError(e.message)
|
|
495
|
+
}
|
|
472
496
|
this.intervalID = setInterval(async () => {
|
|
473
|
-
if (!(await this.device.isConnected()))
|
|
497
|
+
if (!(await this.device.isConnected())) {
|
|
474
498
|
await this.initGATTConnection(true);
|
|
499
|
+
}
|
|
475
500
|
await this.getAndEmitBatteryInfo();
|
|
476
501
|
}, this.pollFreq * 1000);
|
|
477
502
|
});
|