bt-sensors-plugin-sk 1.2.0-beta.0.0.4 → 1.2.0-beta.0.0.6
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 +7 -5
- package/index.js +8 -5
- package/package.json +1 -1
- package/plugin_defaults.json +98 -10
- package/sensor_classes/ATC.js +2 -3
- package/sensor_classes/Aranet/AranetSensor.js +4 -0
- package/sensor_classes/Aranet2.js +16 -15
- package/sensor_classes/Aranet4.js +23 -17
- package/sensor_classes/GoveeH50xx.js +10 -12
- package/sensor_classes/GoveeH510x.js +2 -5
- package/sensor_classes/IBeacon.js +4 -7
- package/sensor_classes/Inkbird.js +2 -2
- package/sensor_classes/JBDBMS.js +29 -19
- package/sensor_classes/KilovaultHLXPlus.js +32 -15
- package/sensor_classes/LancolVoltageMeter.js +4 -3
- package/sensor_classes/MopekaTankSensor.js +19 -10
- package/sensor_classes/RenogyBattery.js +15 -13
- package/sensor_classes/RenogyRoverClient.js +2 -3
- package/sensor_classes/RuuviTag.js +35 -27
- package/sensor_classes/ShellySBHT003C.js +17 -17
- package/sensor_classes/SwitchBotMeterPlus.js +8 -12
- package/sensor_classes/SwitchBotTH.js +11 -16
- package/sensor_classes/UltrasonicWindMeter.js +8 -4
- package/sensor_classes/VictronACCharger.js +19 -8
- package/sensor_classes/VictronBatteryMonitor.js +40 -23
- package/sensor_classes/VictronDCDCConverter.js +14 -5
- package/sensor_classes/VictronDCEnergyMeter.js +26 -7
- package/sensor_classes/VictronGXDevice.js +2 -5
- package/sensor_classes/VictronInverter.js +18 -14
- package/sensor_classes/VictronInverterRS.js +18 -7
- package/sensor_classes/VictronLynxSmartBMS.js +15 -13
- package/sensor_classes/VictronOrionXS.js +15 -3
- package/sensor_classes/VictronSmartBatteryProtect.js +4 -6
- package/sensor_classes/VictronSmartLithium.js +18 -18
- package/sensor_classes/VictronSolarCharger.js +31 -18
- package/sensor_classes/VictronVEBus.js +2 -5
- package/sensor_classes/XiaomiMiBeacon.js +17 -18
package/BTSensor.js
CHANGED
|
@@ -101,6 +101,7 @@ function preparePath(obj, str) {
|
|
|
101
101
|
|
|
102
102
|
class BTSensor extends EventEmitter {
|
|
103
103
|
//static metadata=new Map()
|
|
104
|
+
|
|
104
105
|
static DEFAULTS = require('./plugin_defaults.json');
|
|
105
106
|
|
|
106
107
|
/**
|
|
@@ -314,11 +315,6 @@ class BTSensor extends EventEmitter {
|
|
|
314
315
|
}
|
|
315
316
|
}
|
|
316
317
|
|
|
317
|
-
}
|
|
318
|
-
async init(){
|
|
319
|
-
this.currentProperties = await this.constructor.getDeviceProps(this.device)
|
|
320
|
-
this.initSchema()
|
|
321
|
-
|
|
322
318
|
|
|
323
319
|
//create the 'name' parameter
|
|
324
320
|
this.addDefaultParam("name")
|
|
@@ -331,6 +327,12 @@ class BTSensor extends EventEmitter {
|
|
|
331
327
|
this.addDefaultPath("RSSI","sensors.RSSI")
|
|
332
328
|
this.getPath("RSSI").read=()=>{return this.getRSSI()}
|
|
333
329
|
this.getPath("RSSI").read.bind(this)
|
|
330
|
+
|
|
331
|
+
}
|
|
332
|
+
async init(){
|
|
333
|
+
this.currentProperties = await this.constructor.getDeviceProps(this.device)
|
|
334
|
+
this.initSchema()
|
|
335
|
+
|
|
334
336
|
this.initListen()
|
|
335
337
|
}
|
|
336
338
|
|
package/index.js
CHANGED
|
@@ -20,6 +20,10 @@ class MissingSensor {
|
|
|
20
20
|
this.config=config
|
|
21
21
|
this.addPath=BTSensor.prototype.addPath.bind(this)
|
|
22
22
|
this.addParameter=BTSensor.prototype.addParameter.bind(this)
|
|
23
|
+
this.addDefaultPath=BTSensor.prototype.addDefaultPath.bind(this)
|
|
24
|
+
this.addDefaultParam=BTSensor.prototype.addDefaultPath.bind(this)
|
|
25
|
+
this.addDefaultParam=BTSensor.prototype.addDefaultPath.bind(this)
|
|
26
|
+
this.getPath=BTSensor.prototype.getPath.bind(this)
|
|
23
27
|
|
|
24
28
|
this.getJSONSchema = BTSensor.prototype.getJSONSchema.bind(this)
|
|
25
29
|
this.initSchema = BTSensor.prototype.initSchema.bind(this)
|
|
@@ -50,6 +54,7 @@ class MissingSensor {
|
|
|
50
54
|
initGATTConnection(){
|
|
51
55
|
|
|
52
56
|
}
|
|
57
|
+
|
|
53
58
|
getGATTDescription(){
|
|
54
59
|
return ""
|
|
55
60
|
}
|
|
@@ -342,15 +347,13 @@ module.exports = function (app) {
|
|
|
342
347
|
//filter options which can cause issues with Device::Connect()
|
|
343
348
|
//turning off Discovery
|
|
344
349
|
//try {await adapter.startDiscovery()}
|
|
345
|
-
const _transport = transport?plugin.schema.properties.transport.default:transport
|
|
346
350
|
try{
|
|
347
|
-
if (
|
|
348
|
-
app.debug(`Setting Bluetooth transport option to ${
|
|
351
|
+
if (transport) {
|
|
352
|
+
app.debug(`Setting Bluetooth transport option to ${transport}`)
|
|
349
353
|
await adapter.helper.callMethod('SetDiscoveryFilter', {
|
|
350
|
-
Transport: new Variant('s',
|
|
354
|
+
Transport: new Variant('s', transport)
|
|
351
355
|
})
|
|
352
356
|
}
|
|
353
|
-
adapter._transport=_transport
|
|
354
357
|
await adapter.helper.callMethod('StartDiscovery')
|
|
355
358
|
}
|
|
356
359
|
catch (error){
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bt-sensors-plugin-sk",
|
|
3
|
-
"version": "1.2.0-beta.0.0.
|
|
3
|
+
"version": "1.2.0-beta.0.0.6",
|
|
4
4
|
"description": "Bluetooth Sensors for Signalk -- support for Victron devices, RuuviTag, Xiaomi, ATC and Inkbird, Ultrasonic wind meters, Mopeka tank readers, Renogy Battery and Solar Controllers, Aranet4 environment sensors, SwitchBot temp and humidity sensors, KilovaultHLXPlus smart batteries, and Govee GVH51xx temp sensors",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"dependencies": {
|
package/plugin_defaults.json
CHANGED
|
@@ -6,29 +6,117 @@
|
|
|
6
6
|
"location":{
|
|
7
7
|
"description": "Sensor location",
|
|
8
8
|
"examples": ["inside", "outside", "galley", "freezer", "refrigerator", "head", "cabin", "engine", "deck", "cockpit"]
|
|
9
|
+
},
|
|
10
|
+
"zone":{
|
|
11
|
+
"description": "Zone where sensor operates on boat AKA location ",
|
|
12
|
+
"examples": ["inside", "outside", "galley", "freezer", "refrigerator", "head", "cabin", "engine", "deck", "cockpit"]
|
|
13
|
+
},
|
|
14
|
+
"batteryID":{
|
|
15
|
+
"description": "Battery ID",
|
|
16
|
+
"examples": ["starter", "house"]
|
|
17
|
+
},
|
|
18
|
+
"id":{
|
|
19
|
+
"description": "Sensor ID"
|
|
9
20
|
}
|
|
10
21
|
},
|
|
11
22
|
"environment":{
|
|
12
|
-
"temperature":
|
|
23
|
+
"temperature":
|
|
13
24
|
{
|
|
14
25
|
"unit":"K",
|
|
15
|
-
"default": "environment.{
|
|
26
|
+
"default": "environment.{zone}.temperature"
|
|
16
27
|
},
|
|
17
28
|
"humidity":
|
|
18
29
|
{
|
|
19
30
|
"unit":"ratio",
|
|
20
|
-
"default":"environment.{
|
|
31
|
+
"default":"environment.{zone}.humidity"
|
|
32
|
+
},
|
|
33
|
+
"relativeHumidity":
|
|
34
|
+
{
|
|
35
|
+
"title":"Current relative humidity",
|
|
36
|
+
"unit":"ratio",
|
|
37
|
+
"default":"environment.{zone}.humidity"
|
|
38
|
+
},
|
|
39
|
+
"pressure":
|
|
40
|
+
{
|
|
41
|
+
"title": "Current outside air ambient pressure",
|
|
42
|
+
"unit":"Pa",
|
|
43
|
+
"default":"environment.{zone}.humidity"
|
|
21
44
|
}
|
|
22
45
|
},
|
|
23
46
|
"electrical":{
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
47
|
+
"inverters":{
|
|
48
|
+
"ac":{
|
|
49
|
+
"current":{
|
|
50
|
+
"unit": "A",
|
|
51
|
+
"default":"electrical.inverters.{id}.ac.current"
|
|
52
|
+
},
|
|
53
|
+
"voltage":
|
|
54
|
+
{
|
|
55
|
+
"unit": "V",
|
|
56
|
+
"default":"electrical.inverters.{id}.ac.voltage"
|
|
57
|
+
},
|
|
58
|
+
"power":
|
|
59
|
+
{
|
|
60
|
+
"unit": "W",
|
|
61
|
+
"default":"electrical.inverters.{id}.ac.power"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
},
|
|
66
|
+
"dc":{
|
|
67
|
+
"current":{
|
|
68
|
+
"unit": "A",
|
|
69
|
+
"default":"electrical.inverters.{id}.dc.current"
|
|
70
|
+
},
|
|
71
|
+
"voltage":
|
|
72
|
+
{
|
|
73
|
+
"unit": "V",
|
|
74
|
+
"default":"electrical.inverters.{id}.dc.voltage"
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
}
|
|
27
78
|
},
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
79
|
+
"batteries":{
|
|
80
|
+
|
|
81
|
+
"current":{
|
|
82
|
+
"unit": "A",
|
|
83
|
+
"default":"electrical.batteries.{batteryID}.current"
|
|
84
|
+
},
|
|
85
|
+
"voltage":
|
|
86
|
+
{
|
|
87
|
+
"unit": "V",
|
|
88
|
+
"default": "electrical.batteries.{batteryID}.voltage"
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
"temperature":{
|
|
92
|
+
"unit": "K",
|
|
93
|
+
"default": "electrical.batteries.{batteryID}.temperature"
|
|
94
|
+
},
|
|
95
|
+
"cycles":{
|
|
96
|
+
"unit": "",
|
|
97
|
+
"default": "electrical.batteries.{batteryID}.cycles"
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
"capacity":{
|
|
101
|
+
"remaining":{
|
|
102
|
+
"unit":"Ah",
|
|
103
|
+
"default": "electrical.batteries.{batteryID}.capacity.remaining"
|
|
104
|
+
},
|
|
105
|
+
"actual":{
|
|
106
|
+
"unit":"Ah",
|
|
107
|
+
"default": "electrical.batteries.{batteryID}.capacity.actual"
|
|
108
|
+
},
|
|
109
|
+
"stateOfCharge":{
|
|
110
|
+
"unit":"ratio",
|
|
111
|
+
"default": "electrical.batteries.{batteryID}.capacity.stateOfCharge"
|
|
112
|
+
},
|
|
113
|
+
"timeRemaining":{
|
|
114
|
+
"unit":"s",
|
|
115
|
+
"default": "electrical.batteries.{batteryID}.capacity.timeRemaining"
|
|
116
|
+
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
32
120
|
}
|
|
33
121
|
},
|
|
34
122
|
"sensors":{
|
package/sensor_classes/ATC.js
CHANGED
|
@@ -30,10 +30,9 @@ class ATC extends BTSensor{
|
|
|
30
30
|
if (!this.parser){
|
|
31
31
|
this.parser="ATC-LE"
|
|
32
32
|
}
|
|
33
|
-
this.initMetadata()
|
|
34
33
|
}
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
initSchema(){
|
|
35
|
+
super.initSchema()
|
|
37
36
|
this.addDefaultPath('batteryStrength','sensors.batteryStrength')
|
|
38
37
|
.read=(buff)=>{return ((buff.readUInt8(12))/100)}
|
|
39
38
|
|
|
@@ -13,25 +13,26 @@ class Aranet2 extends AranetSensor{
|
|
|
13
13
|
return null //not supported for now
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
async init() {
|
|
17
|
-
await super.init()
|
|
18
|
-
this.initMetadata()
|
|
19
|
-
}
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
initSchema(){
|
|
18
|
+
super.initSchema()
|
|
19
|
+
|
|
20
|
+
this.addMetadatum('co2', 'ppm', 'co2 concentration in zone',
|
|
23
21
|
(buff)=>{return ((buff.readUInt16LE(8)))})
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
.default="environment.{zone}.co2"
|
|
23
|
+
|
|
24
|
+
this.addDefaultPath('temp', 'environment.temperature')
|
|
25
|
+
.read=(buff)=>{return parseFloat((273.15+(buff.readInt16LBE(15))/1000).toFixed(2))}
|
|
26
26
|
|
|
27
|
-
this.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
this.addDefaultPath('pressure', 'environment.pressure')
|
|
28
|
+
.read= (buff)=>{return ((buff.readUInt16LE(13)))/10}
|
|
29
|
+
|
|
30
|
+
this.addDefaultPath('relativeHumidity','environment.relativeHumidity')
|
|
31
|
+
.read=(buff)=>{return ((buff.readUInt16LE(8))/10000)}
|
|
32
|
+
|
|
33
|
+
this.addDefaultPath("battery","sensors.batteryStrength")
|
|
34
|
+
.read=(buff)=>{return ((buff.readUInt8(12))/100)}
|
|
31
35
|
|
|
32
|
-
this.addMetadatum('humidity','ratio', 'humidity',
|
|
33
|
-
(buff)=>{return ((buff.readUInt16LE(8))/10000)})
|
|
34
|
-
|
|
35
36
|
}
|
|
36
37
|
propertiesChanged(props){
|
|
37
38
|
super.propertiesChanged(props)
|
|
@@ -15,27 +15,33 @@ class Aranet4 extends AranetSensor{
|
|
|
15
15
|
return null
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
async init() {
|
|
19
|
-
await super.init()
|
|
20
|
-
this.initMetadata()
|
|
21
|
-
}
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
this.addMetadatum('co2', 'ppm', 'co2 concentration',
|
|
25
|
-
(buff)=>{return ((buff.readUInt16LE(8)))})
|
|
26
|
-
this.addMetadatum('temp','K', 'temperature',
|
|
27
|
-
(buff)=>{return parseFloat((273.15+(buff.readInt16LE(10))/20).toFixed(2))})
|
|
19
|
+
initSchema(){
|
|
28
20
|
|
|
29
|
-
this.addMetadatum("pressure","hPa","atmospheric pressure",
|
|
30
|
-
(buff)=>{return ((buff.readUInt16LE(12)))/10})
|
|
31
21
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
super.initSchema()
|
|
23
|
+
this.addMetadatum('co2', 'ppm', 'co2 concentration in zone',
|
|
24
|
+
(buff)=>{return ((buff.readUInt16LE(8)))})
|
|
25
|
+
.default="environment.{zone}.co2"
|
|
26
|
+
|
|
27
|
+
this.addDefaultPath('temp','environment.temperature')
|
|
28
|
+
.read=
|
|
29
|
+
(buff)=>{return parseFloat((273.15+(buff.readInt16LE(10))/20).toFixed(2))}
|
|
38
30
|
|
|
31
|
+
this.addDefaultPath("pressure","environment.pressure")
|
|
32
|
+
.read=(buff)=>{return ((buff.readUInt16LE(12)))/10}
|
|
33
|
+
|
|
34
|
+
this.addDefaultPath('relativeHumidity','environment.relative')
|
|
35
|
+
.read=(buff)=>{return ((buff.readUInt8(14))/100)}
|
|
36
|
+
|
|
37
|
+
this.addMetadatum('color', '', 'Warning color (G Y R)',
|
|
38
|
+
(buff)=>{return this.COLOR[buff.readUInt8(16)]})
|
|
39
|
+
.default="environment.{zone}.warningColor"
|
|
40
|
+
|
|
41
|
+
this.addDefaultPath("battery","sensors.batteryStrength")
|
|
42
|
+
.read=(buff)=>{return ((buff.readUInt8(15))/100)}
|
|
43
|
+
|
|
44
|
+
|
|
39
45
|
}
|
|
40
46
|
propertiesChanged(props){
|
|
41
47
|
super.propertiesChanged(props)
|
|
@@ -17,18 +17,16 @@ class GoveeH50xx extends BTSensor {
|
|
|
17
17
|
t
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.
|
|
26
|
-
(buffer)=>{return
|
|
27
|
-
|
|
28
|
-
this.
|
|
29
|
-
(buffer)=>{return buffer.
|
|
30
|
-
})
|
|
31
|
-
this.addMetadatum('battery','ratio', 'battery strength', (buffer)=>{return buffer.readUInt8(5)/100})
|
|
20
|
+
initSchema(){
|
|
21
|
+
super.initSchema()
|
|
22
|
+
this.addDefaultPath("temp","environment.temperature")
|
|
23
|
+
.read= (buffer)=>{return 273.15+(buffer.readUInt16LE(1)/100) }
|
|
24
|
+
|
|
25
|
+
this.addDefaultPath("humidity", "environment.humidity")
|
|
26
|
+
.read = (buffer)=>{return buffer.readUInt16LE(3)/10000}
|
|
27
|
+
|
|
28
|
+
this.addDefaultPath("battery","sensors.batteryStrength")
|
|
29
|
+
.read = (buffer)=>{return buffer.readUInt8(5)/100}
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
getManufacturer(){
|
|
@@ -34,11 +34,8 @@ class GoveeH510x extends BTSensor{
|
|
|
34
34
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.initMetadata()
|
|
40
|
-
}
|
|
41
|
-
initMetadata(){
|
|
37
|
+
initSchema(){
|
|
38
|
+
super.initSchema()
|
|
42
39
|
this.addDefaultPath("temp","environment.temperature")
|
|
43
40
|
this.addDefaultPath("humidity", "environment.humidity")
|
|
44
41
|
this.addDefaultPath("battery","sensors.batteryStrength")
|
|
@@ -13,13 +13,10 @@ class IBeacon extends BTSensor {
|
|
|
13
13
|
return null
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
initMetadata(){
|
|
22
|
-
this.addMetadatum('battery','ratio', 'Battery charge state', (buffer)=>{return buffer[6]})
|
|
16
|
+
initSchema(){
|
|
17
|
+
super.initSchema()
|
|
18
|
+
this.addDefaultPath("battery","sensors.batteryStrength")
|
|
19
|
+
.read=(buffer)=>{return buffer[6]}
|
|
23
20
|
}
|
|
24
21
|
|
|
25
22
|
propertiesChanged(props){
|
|
@@ -13,8 +13,8 @@ class Inkbird extends BTSensor{
|
|
|
13
13
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
initSchema() {
|
|
17
|
+
super.initSchema()
|
|
18
18
|
this.addDefaultPath('temp','environment.temperature')
|
|
19
19
|
this.addDefaultPath('battery', 'sensors.batteryStrength')
|
|
20
20
|
if (this.getName() == 'sps'){
|
package/sensor_classes/JBDBMS.js
CHANGED
|
@@ -28,26 +28,35 @@ class JBDBMS extends BTSensor {
|
|
|
28
28
|
return await this.txChar.writeValueWithResponse(Buffer.from(this.jbdCommand(command)))
|
|
29
29
|
|
|
30
30
|
}
|
|
31
|
-
async
|
|
32
|
-
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
this.
|
|
36
|
-
(buffer)=>{return buffer.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
this.
|
|
42
|
-
(buffer)=>{return buffer.readUInt16BE(
|
|
31
|
+
async initSchema(){
|
|
32
|
+
super.initSchema()
|
|
33
|
+
this.addDefaultParam("batteryID")
|
|
34
|
+
|
|
35
|
+
this.addDefaultPath('voltage','electrical.batteries.voltage')
|
|
36
|
+
.read=(buffer)=>{return buffer.readUInt16BE(4) / 100}
|
|
37
|
+
|
|
38
|
+
this.addDefaultPath('voltage','electrical.batteries.current')
|
|
39
|
+
.read=(buffer)=>{return buffer.readInt16BE(6) / 100}
|
|
40
|
+
|
|
41
|
+
this.addDefaultPath('remainingCapacity','electrical.batteries.capacity.remaining')
|
|
42
|
+
.read=(buffer)=>{return buffer.readUInt16BE(8) / 100}
|
|
43
|
+
|
|
44
|
+
this.addDefaultPath('capacity','electrical.batteries.capacity.actual')
|
|
45
|
+
.read=(buffer)=>{return buffer.readUInt16BE(10) / 100}
|
|
46
|
+
|
|
47
|
+
this.addDefaultPath('cycles','electrical.batteries.cycles' )
|
|
48
|
+
.read=(buffer)=>{return buffer.readUInt16BE(12)}
|
|
49
|
+
|
|
43
50
|
this.addMetadatum('protectionStatus', '', 'Protection Status',
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
(buffer)=>{return buffer.readUInt16BE(20)} )
|
|
52
|
+
.default="electrical.batteries.{batteryID}.protectionStatus"
|
|
53
|
+
|
|
54
|
+
this.addDefaultPath('SOC','electrical.batteries.capacity.stateOfCharge')
|
|
55
|
+
.read=(buffer)=>{return buffer.readUInt8(23)/100}
|
|
48
56
|
|
|
49
57
|
this.addMetadatum('FET', '', 'FET Control',
|
|
50
58
|
(buffer)=>{return buffer.readUInt8(24)} )
|
|
59
|
+
.default="electrical.batteries.{batteryID}.FETControl"
|
|
51
60
|
|
|
52
61
|
await this.deviceConnect()
|
|
53
62
|
await this.initCharacteristics()
|
|
@@ -65,11 +74,12 @@ class JBDBMS extends BTSensor {
|
|
|
65
74
|
for (let i=0; i<this.numberOfCells; i++){
|
|
66
75
|
this.addMetadatum(`cell${i}Voltage`, 'V', `Cell ${i+1} voltage`,
|
|
67
76
|
(buffer)=>{return buffer.readUInt16BE((4+(i*2)))/1000} )
|
|
77
|
+
.default=`electrical.batteries.{batteryID}.cell${i}.voltage`
|
|
68
78
|
this.addMetadatum(`cell${i}Balance`, 'V', `Cell ${i+1} balance` )
|
|
79
|
+
.default=`electrical.batteries.{batteryID}.cell${i}.balance`
|
|
80
|
+
|
|
69
81
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
82
|
+
}
|
|
73
83
|
hasGATT(){
|
|
74
84
|
return true
|
|
75
85
|
}
|
|
@@ -60,35 +60,52 @@ class KilovaultHLXPlus extends BTSensor{
|
|
|
60
60
|
// Nothing to do here. HLX+ only reports via BLE notify, not BLE read
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
async
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
this.
|
|
71
|
-
(buffer)=>{return buffer.readInt32LE(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
this.
|
|
77
|
-
(buffer)=>{return buffer.readInt16LE(
|
|
63
|
+
async initSchema(){
|
|
64
|
+
super.initSchema()
|
|
65
|
+
this.addDefaultParam("batteryID")
|
|
66
|
+
|
|
67
|
+
this.addDefaultPath("voltage","electrical.batteries.voltage")
|
|
68
|
+
.read=(buffer)=>{return Number(buffer.readInt16LE(0)) / 1000}
|
|
69
|
+
|
|
70
|
+
this.addDefaultPath("current","electrical.batteries.current")
|
|
71
|
+
.read=(buffer)=>{return buffer.readInt32LE(4) / 1000}
|
|
72
|
+
|
|
73
|
+
this.addDefaultPath("energy", "electrical.batteries.capacity.remaining")
|
|
74
|
+
.read=(buffer)=>{return buffer.readInt32LE(8) / 1000}
|
|
75
|
+
|
|
76
|
+
this.addDefaultPath("cycles",'electrical.batteries.cycles')
|
|
77
|
+
.read=(buffer)=>{return buffer.readInt16LE(12)}
|
|
78
|
+
|
|
79
|
+
this.addDefaultPath("soc",'electrical.batteries.capacity,stateOfCharge')
|
|
80
|
+
.read=(buffer)=>{return buffer.readInt16LE(14)}
|
|
81
|
+
|
|
82
|
+
this.addDefaultPath("temperature",'electrical.batteries.temperature')
|
|
83
|
+
.read=(buffer)=>{return buffer.readInt16LE(16)/10 }
|
|
78
84
|
|
|
79
85
|
this.addMetadatum("status","","Battery Status",
|
|
80
86
|
(buffer)=>{return buffer.readInt16LE(18) })
|
|
87
|
+
.default="electrical.batteries.{batteryID}.status"
|
|
88
|
+
|
|
81
89
|
this.addMetadatum("AFEStatus","","Battery AFE Status",
|
|
82
90
|
(buffer)=>{return buffer.readInt16LE(20) })
|
|
91
|
+
.default="electrical.batteries.{batteryID}.AFEStatus"
|
|
83
92
|
|
|
84
93
|
this.addMetadatum("cell1_voltage","V","Cell 1 Voltage",
|
|
85
94
|
(buffer)=>{return buffer.readInt16LE(22) / 1000})
|
|
95
|
+
.default="electrical.batteries.{batteryID}.cell1.voltage"
|
|
96
|
+
|
|
86
97
|
this.addMetadatum("cell2_voltage","V","Cell 2 Voltage",
|
|
87
98
|
(buffer)=>{return buffer.readInt16LE(24) / 1000})
|
|
99
|
+
.default="electrical.batteries.{batteryID}.cell2.voltage"
|
|
100
|
+
|
|
88
101
|
this.addMetadatum("cell3_voltage","V","Cell 3 Voltage",
|
|
89
102
|
(buffer)=>{return buffer.readInt16LE(26) / 1000})
|
|
103
|
+
.default="electrical.batteries.{batteryID}.cell3.voltage"
|
|
104
|
+
|
|
90
105
|
this.addMetadatum("cell4_voltage","V","Cell 4 Voltage",
|
|
91
106
|
(buffer)=>{return buffer.readInt16LE(28) / 1000})
|
|
107
|
+
.default="electrical.batteries.{batteryID}.cell4.voltage"
|
|
108
|
+
|
|
92
109
|
}
|
|
93
110
|
|
|
94
111
|
// Concatentate chunks received by notification into a complete message.
|
|
@@ -14,9 +14,10 @@ class LancolVoltageMeter extends BTSensor{
|
|
|
14
14
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
this.
|
|
17
|
+
initSchema(){
|
|
18
|
+
super.initSchema()
|
|
19
|
+
this.addDefaultParam("batteryID")
|
|
20
|
+
this.addDefaultPath('voltage',"electrical.batteries.voltage")
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
getManufacturer(){
|
|
@@ -276,7 +276,7 @@ class MopekaTankSensor extends BTSensor{
|
|
|
276
276
|
this.addParameter("medium",
|
|
277
277
|
{
|
|
278
278
|
title:"type of liquid in tank",
|
|
279
|
-
enum: Object.keys(Media)
|
|
279
|
+
enum: Object.keys(Media)
|
|
280
280
|
}
|
|
281
281
|
)
|
|
282
282
|
this.addParameter("tankHeight",
|
|
@@ -286,34 +286,43 @@ class MopekaTankSensor extends BTSensor{
|
|
|
286
286
|
unit:"mm"
|
|
287
287
|
}
|
|
288
288
|
)
|
|
289
|
+
this.addDefaultParam("id")
|
|
289
290
|
|
|
290
|
-
this.
|
|
291
|
-
((buffer)=>{
|
|
291
|
+
this.addDefaultPath("battVolt","sensors.batteryVoltage")
|
|
292
|
+
.read=((buffer)=>{
|
|
292
293
|
this.battVolt = (buffer.readUInt8(1)/32)
|
|
293
294
|
return this.battVolt
|
|
294
295
|
}).bind(this)
|
|
295
|
-
|
|
296
|
-
this.
|
|
297
|
-
(buffer)=>{ return Math.max(0, Math.min(1, (((this.battVolt) - 2.2) / 0.65))) }
|
|
298
|
-
|
|
296
|
+
|
|
297
|
+
this.addDefaultPath("battStrength", "sensors.batteryStrength")
|
|
298
|
+
.read=(buffer)=>{ return Math.max(0, Math.min(1, (((this.battVolt) - 2.2) / 0.65))) }
|
|
299
|
+
|
|
299
300
|
this.addMetadatum("temp","K","temperature",
|
|
300
301
|
((buffer)=>{
|
|
301
302
|
this.temp = parseFloat(((buffer.readUInt8(2)&0x7F)+233.15).toFixed(2))
|
|
302
303
|
return this.temp
|
|
303
|
-
})
|
|
304
|
+
})
|
|
304
305
|
)
|
|
306
|
+
.default="tanks.{id}.temperature"
|
|
305
307
|
this.addMetadatum("tankLevel","ratio","tank level",
|
|
306
308
|
(buffer)=>{ return (this._tankLevel(((buffer.readUInt16LE(3))&0x3FFF)))/this.getTankHeight()}
|
|
307
309
|
)
|
|
310
|
+
.default="tanks.{id}.currentLevel"
|
|
311
|
+
|
|
308
312
|
this.addMetadatum("readingQuality","","quality of read",
|
|
309
313
|
(buffer)=>{ return buffer.readUInt8(4)>>6}
|
|
310
314
|
)
|
|
315
|
+
.default="sensors.{macAndName}.readingQuality"
|
|
316
|
+
|
|
311
317
|
this.addMetadatum("accX","Mg","acceleration on X-axis",
|
|
312
318
|
(buffer)=>{ return buffer.readUInt8(8)}
|
|
313
319
|
)
|
|
320
|
+
.default="sensors.{macAndName}.accelerationXAxis"
|
|
321
|
+
|
|
314
322
|
this.addMetadatum("accY","Mg","acceleration on Y-axis",
|
|
315
323
|
(buffer)=>{ return buffer.readUInt8(9)}
|
|
316
324
|
)
|
|
325
|
+
.default="sensors.{macAndName}.accelerationYAxis"
|
|
317
326
|
}
|
|
318
327
|
|
|
319
328
|
propertiesChanged(props){
|
|
@@ -326,8 +335,8 @@ class MopekaTankSensor extends BTSensor{
|
|
|
326
335
|
if (this.name)
|
|
327
336
|
return this.name
|
|
328
337
|
|
|
329
|
-
const _name =
|
|
330
|
-
return _name?_name:
|
|
338
|
+
const _name = MopekaDevice.get(this?.modelID??0x0).name
|
|
339
|
+
return _name?_name:MopekaDevice.get(0x0).name
|
|
331
340
|
|
|
332
341
|
}
|
|
333
342
|
}
|