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
|
@@ -10,23 +10,34 @@ class VictronInverterRS extends VictronSensor{
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
initSchema() {
|
|
14
|
+
super.initSchema()
|
|
15
|
+
this.addDefaultParam("id")
|
|
16
16
|
this.addMetadatum('deviceState','', 'inverter device state',
|
|
17
|
-
|
|
17
|
+
(buff)=>{return VC.OperationMode.get(buff.readIntU8(0))})
|
|
18
|
+
.default='electrical.inverters.{id}.state'
|
|
19
|
+
|
|
18
20
|
const md = this.addMetadatum('chargerError','', 'charger error',
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
(buff)=>{return VC.ChargerError(buff.readIntU8(1))})
|
|
22
|
+
.default='electrical.inverters.{id}.error'
|
|
23
|
+
md.notify=true
|
|
21
24
|
|
|
22
25
|
this.addMetadatum('batteryVoltage','V', 'battery voltage',
|
|
23
26
|
(buff)=>{return this.NaNif(buff.readInt16LE(2),0x7FFF)/100})
|
|
27
|
+
.default='electrical.inverters.{id}.battery.voltage'
|
|
28
|
+
|
|
24
29
|
this.addMetadatum('pvPower','W', 'PV power',
|
|
25
30
|
(buff)=>{return this.NaNif(buff.readUInt16LE(4), 0xffff)})
|
|
31
|
+
.default='electrical.inverters.{id}.power'
|
|
32
|
+
|
|
26
33
|
this.addMetadatum('yieldToday','W', 'yield yoday in watts',
|
|
27
34
|
(buff)=>{return this.NaNif(buff.readUInt16LE(6), 0xffff)*10})
|
|
35
|
+
.default='electrical.inverters.{id}.yieldToday'
|
|
36
|
+
|
|
28
37
|
this.addMetadatum('acOutPower','W', 'AC out power in watts',
|
|
29
|
-
(buff)=>{this.NaNif(buff.readInt16LE(8), 0x7fff)})
|
|
38
|
+
(buff)=>{this.NaNif(buff.readInt16LE(8), 0x7fff)})
|
|
39
|
+
.default='electrical.inverters.{id}.ac.power'
|
|
40
|
+
|
|
30
41
|
}
|
|
31
42
|
|
|
32
43
|
emitValuesFrom(decData){
|
|
@@ -22,26 +22,28 @@ class VictronLynxSmartBMS extends VictronSensor{
|
|
|
22
22
|
return await this.identifyMode(device, 0x0A)
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.initMetadata()
|
|
28
|
-
}
|
|
29
|
-
initMetadata(){
|
|
25
|
+
initSchema(){
|
|
26
|
+
super.initSchema()
|
|
30
27
|
this.addMetadatum('error','', 'error code',
|
|
31
28
|
(buff)=>{return buff.readUInt8(0)})
|
|
32
29
|
|
|
33
|
-
this.
|
|
34
|
-
(buff)=>{return this.NaNif(buff.readUInt16LE(1),0xFFFF)*60}
|
|
35
|
-
this.
|
|
36
|
-
(buff)=>{return this.NaNif(buff.readInt16LE(3),0x7FFF)/100}
|
|
37
|
-
this.
|
|
38
|
-
(buff)=>{return this.NaNif(buff.readInt16LE(5),0x7FFF)/10}
|
|
30
|
+
this.addDefaultPath('ttg','electrical.batteries.capacity.timeRemaining')
|
|
31
|
+
.read=(buff)=>{return this.NaNif(buff.readUInt16LE(1),0xFFFF)*60}
|
|
32
|
+
this.addDefaultPath('voltage','electrical.batteries.voltage')
|
|
33
|
+
.read=(buff)=>{return this.NaNif(buff.readInt16LE(3),0x7FFF)/100}
|
|
34
|
+
this.addDefaultPath('current','electrical.batteries.current')
|
|
35
|
+
.read=(buff)=>{return this.NaNif(buff.readInt16LE(5),0x7FFF)/10}
|
|
36
|
+
|
|
39
37
|
this.addMetadatum('ioStatus','','IO Status', //TODO
|
|
40
38
|
(buff)=>{return buff.readUInt16LE(7)})
|
|
39
|
+
|
|
41
40
|
this.addMetadatum('warningsAndAlarms','','warnings and alarms')
|
|
42
|
-
|
|
41
|
+
|
|
42
|
+
this.addDefaultPath('soc','electrical.batteries.capacity.stateOfCharge')
|
|
43
43
|
this.addMetadatum('consumedAh','Ah','amp-hours consumed')
|
|
44
|
-
|
|
44
|
+
.default="electrical.batteries.{batteryID}.capacity.ampHoursConsumed"
|
|
45
|
+
|
|
46
|
+
this.addDefaultPath('temp', 'electrical.batteries.temperature')
|
|
45
47
|
}
|
|
46
48
|
emitValuesFrom(buffer){
|
|
47
49
|
super.emitValuesFrom(buffer)
|
|
@@ -8,22 +8,34 @@ class VictronOrionXS extends VictronSensor{
|
|
|
8
8
|
static async identify(device){
|
|
9
9
|
return await this.identifyMode(device, 0x0F)
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
initSchema() {
|
|
12
|
+
super.initSchema()
|
|
13
|
+
this.addDefaultParam("id")
|
|
13
14
|
this.addMetadatum('deviceState','', 'device state',
|
|
14
15
|
(buff)=>{return VC.OperationMode.get(buff.readUInt8(0))})
|
|
16
|
+
.default="electrical.chargers.{id}.state"
|
|
17
|
+
|
|
15
18
|
this.addMetadatum('chargerError','', 'charger error',
|
|
16
19
|
(buff)=>{return VC.ChargerError.get(buff.readUInt8(1))})
|
|
20
|
+
.default="electrical.chargers.{id}.error"
|
|
21
|
+
|
|
17
22
|
this.addMetadatum('outputVoltage','V', 'output voltage',
|
|
18
23
|
(buff)=>{return this.NaNif(buff.readInt16LE(2),0x7FF)/100})
|
|
24
|
+
.default="electrical.chargers.{id}.output.voltage"
|
|
25
|
+
|
|
26
|
+
|
|
19
27
|
this.addMetadatum('current','A','output current',
|
|
20
28
|
(buff)=>{return this.NaNif(buff.readUInt16LE(4),0xFFFF)/10})
|
|
29
|
+
.default="electrical.chargers.{id}.output.current"
|
|
21
30
|
this.addMetadatum('inputVoltage','V', 'input voltage',
|
|
22
31
|
(buff)=>{return this.NaNif(buff.readInt16LE(6),0x07FF)/100})
|
|
32
|
+
.default="electrical.chargers.{id}.input.voltage"
|
|
23
33
|
this.addMetadatum('inputCurrent','A','input current',
|
|
24
34
|
(buff)=>{return this.NaNif(buff.readUInt16LE(8),0xFFFF)/10})
|
|
35
|
+
.default="electrical.chargers.{id}.input.current"
|
|
25
36
|
this.addMetadatum('deviceOffReason','', 'device off reason',
|
|
26
|
-
(buff)=>{return VC.OffReasons(buff.readUInt32BE(10))})
|
|
37
|
+
(buff)=>{return VC.OffReasons(buff.readUInt32BE(10))})
|
|
38
|
+
.default="electrical.chargers.{id}.offReason"
|
|
27
39
|
}
|
|
28
40
|
|
|
29
41
|
}
|
|
@@ -23,13 +23,11 @@ class VictronSmartBatteryProtect extends VictronSensor{
|
|
|
23
23
|
return await this.identifyMode(device, 0x09)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
initMetadata(){
|
|
26
|
+
|
|
27
|
+
initSchema(){
|
|
28
|
+
super.initSchema()
|
|
31
29
|
this.addMetadatum('deviceState','', 'device state',
|
|
32
|
-
|
|
30
|
+
(buff)=>{return VC.OperationMode.get(buff.readUInt8(1))})
|
|
33
31
|
this.addMetadatum('outputStatus','', 'output status', //TODO
|
|
34
32
|
(buff)=>{return (buff.readUInt8(2))})
|
|
35
33
|
|
|
@@ -38,31 +38,31 @@ class VictronSmartLithium extends VictronSensor{
|
|
|
38
38
|
return await this.identifyMode(device, 0x05)
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.
|
|
44
|
-
}
|
|
45
|
-
initMetadata(){
|
|
41
|
+
initSchema(){
|
|
42
|
+
super.initSchema()
|
|
43
|
+
this.addDefaultParam("batteryID")
|
|
46
44
|
|
|
47
45
|
this.addMetadatum('bmsFlags','', 'BMS Flags',
|
|
48
46
|
(buff)=>{return buff.readUInt32LE(0)})
|
|
47
|
+
.default="electrical.batteries.{batteryID}.flags"
|
|
49
48
|
|
|
50
49
|
this.addMetadatum('smartLithiumErrors','', 'Smart Lithium Errors Flags',
|
|
51
50
|
(buff)=>{return buff.readUInt16LE(4)})
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
this.addMetadatum('balancerStatus','', 'balancer status', //TODO
|
|
51
|
+
.default="electrical.batteries.{batteryID}.errors"
|
|
52
|
+
|
|
53
|
+
for (let i=0;i++;i<8){
|
|
54
|
+
this.addMetadatum(`cell${i+1}Voltage`,'V', `cell ${i+1} voltage`)
|
|
55
|
+
.default=`electrical.batteries.{batteryID}.cell${i+1}.voltage`
|
|
56
|
+
}
|
|
57
|
+
this.addDefaultPath('batteryVoltage','electrical.batteries.voltage')
|
|
58
|
+
.read=(buff)=>{return this.NaNif((buff.readUInt16LE(13)&0xFFF),0xFFF)/100}
|
|
59
|
+
|
|
60
|
+
this.addMetadatum('balancerStatus','', 'balancer status',
|
|
63
61
|
(buff)=>{return BALANCERSTATUS[this.NaNif((buff.readUInt8(14)>>4),0xF)]})
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
.default=`electrical.batteries.{batteryID}.balancerStatus`
|
|
63
|
+
|
|
64
|
+
this.addDefaultPath('batteryTemp','electrical.batteries.temperature')
|
|
65
|
+
.read=(buff)=>{return this.NaNif((buff.readUInt8(15)&0x7F),0x7F)+233.15}
|
|
66
66
|
}
|
|
67
67
|
emitValuesFrom(buffer){
|
|
68
68
|
super.emitValuesFrom(buffer)
|
|
@@ -6,25 +6,38 @@ class VictronSolarCharger extends VictronSensor{
|
|
|
6
6
|
return await this.identifyMode(device, 0x01)
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.addMetadatum('chargeState','', 'charge state',
|
|
9
|
+
initSchema() {
|
|
10
|
+
super.initSchema()
|
|
11
|
+
this.addDefaultParam("id")
|
|
12
|
+
|
|
13
|
+
this.addMetadatum('chargeState','', 'charge state',
|
|
15
14
|
(buff)=>{return VC.OperationMode.get(buff.readUInt8(0))})
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
.default="electrical.solar.{id}.state"
|
|
16
|
+
|
|
17
|
+
this.addMetadatum('chargerError','', 'charger error',
|
|
18
|
+
(buff)=>{return VC.ChargerError.get(buff.readUInt8(1))})
|
|
19
|
+
.default="electrical.solar.{id}.error"
|
|
20
|
+
|
|
21
|
+
this.addMetadatum('voltage','V', 'charger battery voltage',
|
|
22
|
+
(buff)=>{return this.NaNif(buff.readInt16LE(2),0x7FFF)/100})
|
|
23
|
+
.default="electrical.solar.{id}.dc.voltage"
|
|
24
|
+
|
|
25
|
+
this.addMetadatum('current','A','charger battery current',
|
|
26
|
+
(buff)=>{return this.NaNif(buff.readInt16LE(4),0x7FFF)/10})
|
|
27
|
+
.default="electrical.solar.{id}.dc.current"
|
|
28
|
+
|
|
29
|
+
this.addMetadatum('yield','Wh', 'yield today in Watt-hours',
|
|
30
|
+
(buff)=>{return this.NaNif(buff.readUInt16LE(6),0xFFFF)*10})
|
|
31
|
+
.default="electrical.solar.{id}.yieldToday"
|
|
32
|
+
|
|
33
|
+
this.addMetadatum('solarPower','W', 'solar power',
|
|
34
|
+
(buff)=>{return this.NaNif(buff.readUInt16LE(8),0xFFFF)})
|
|
35
|
+
.default="electrical.solar.{id}.panelPower"
|
|
36
|
+
|
|
37
|
+
this.addMetadatum('externalDeviceLoad','A', 'external device load',
|
|
38
|
+
(buff)=>{return this.NaNif(buff.readUInt16LE(10)&0x1FF,0x1FF)/10})
|
|
39
|
+
.default="electrical.solar.{id}.loadCurrent"
|
|
40
|
+
|
|
28
41
|
}
|
|
29
42
|
}
|
|
30
43
|
module.exports=VictronSolarCharger
|
|
@@ -9,11 +9,8 @@ class VictronVEBus extends VictronSensor{
|
|
|
9
9
|
return await this.identifyMode(device, 0x0C)
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.initMetadata()
|
|
15
|
-
}
|
|
16
|
-
initMetadata(){
|
|
12
|
+
initSchema(){
|
|
13
|
+
super.initSchema()
|
|
17
14
|
this.addMetadatum('chargeState','', 'charge state',
|
|
18
15
|
(buff)=>{return VC.OperationMode.get(buff.readUInt8(0))})
|
|
19
16
|
|
|
@@ -90,8 +90,6 @@ class XiaomiMiBeacon extends BTSensor{
|
|
|
90
90
|
return null
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
GATTwarning = "WARNING: Xiaomi GATT connections are known to be unreliable on Debian distributions with Bluez 5.55 and up (earlier BlueZ versions are untested). Using GATT on the Xiaomi may put the system Bluetooth stack into an inconsistent state disrupting and disabling other plugin Bluetooth connections. If by some chance you're successful using GATT with the Xiaomi, let the plugin developer know your configuration. Refer to the plugin documentation for getting the Xiamoi bindKey for non-GATT connections and more information on Xiaomi GATT issues."
|
|
95
93
|
|
|
96
94
|
emitValues(buffer){
|
|
97
95
|
this.emitData("temp", buffer, 0)
|
|
@@ -102,13 +100,10 @@ class XiaomiMiBeacon extends BTSensor{
|
|
|
102
100
|
return "Xiaomi Inc."
|
|
103
101
|
}
|
|
104
102
|
getGATTDescription() {
|
|
105
|
-
return
|
|
103
|
+
return ""
|
|
106
104
|
}
|
|
105
|
+
|
|
107
106
|
initGATTConnection(){
|
|
108
|
-
if (!this?.gattWarningDelivered) {
|
|
109
|
-
this.debug(this.GATTwarning.toUpperCase())
|
|
110
|
-
this.gattWarningDelivered=true
|
|
111
|
-
}
|
|
112
107
|
return new Promise((resolve,reject )=>{
|
|
113
108
|
this.deviceConnect().then(async ()=>{
|
|
114
109
|
if (!this.gattServer) {
|
|
@@ -202,30 +197,34 @@ class XiaomiMiBeacon extends BTSensor{
|
|
|
202
197
|
}
|
|
203
198
|
|
|
204
199
|
async init(){
|
|
200
|
+
|
|
205
201
|
await super.init()
|
|
206
202
|
const data = this.getServiceData(this.constructor.SERVICE_MIBEACON)
|
|
207
203
|
const frameControl = data[0] + (data[1] << 8)
|
|
208
204
|
this.deviceID = data[2] + (data[3] << 8)
|
|
209
205
|
this.isEncrypted = (frameControl >> 3) & 1
|
|
210
206
|
this.encryptionVersion = frameControl >> 12
|
|
207
|
+
}
|
|
208
|
+
initSchema(){
|
|
209
|
+
super.initSchema()
|
|
211
210
|
this.addParameter(
|
|
212
211
|
"encryptionKey",
|
|
213
212
|
{
|
|
214
213
|
title: "encryptionKey (AKA bindKey) for decryption"
|
|
215
214
|
}
|
|
216
215
|
)
|
|
217
|
-
this.
|
|
218
|
-
|
|
219
|
-
this.addMetadatum('humidity','ratio', 'humidity',
|
|
220
|
-
(buff,offset)=>{return buff.readInt16LE(offset)/1000})
|
|
221
|
-
|
|
222
|
-
this.addMetadatum('batteryStrength', 'ratio', 'sensor battery strength',
|
|
223
|
-
(buff,offset)=>{return ((buff.readUInt8(offset))/100)})
|
|
224
|
-
this.addMetadatum('voltage', 'V', 'sensor battery voltage',
|
|
225
|
-
(buff,offset)=>{return ((buff.readUInt16LE(offset))/1000)})
|
|
216
|
+
this.addDefaultPath('temp','environment.temperature')
|
|
217
|
+
.read=(buff,offset)=>{return ((buff.readInt16LE(offset))/10) + 273.15}
|
|
226
218
|
|
|
227
|
-
|
|
228
|
-
|
|
219
|
+
this.addDefaultPath('humidity','environment.humidity')
|
|
220
|
+
.read=(buff,offset)=>{return buff.readInt16LE(offset)/1000}
|
|
221
|
+
|
|
222
|
+
this.addDefaultPath("batteryStrength", "sensors.batteryStrength")
|
|
223
|
+
.read= (buff,offset)=>{return ((buff.readUInt8(offset))/100)}
|
|
224
|
+
|
|
225
|
+
this.addDefaultPath("voltage", "sensors.batteryVoltage")
|
|
226
|
+
.read=(buff,offset)=>{return ((buff.readUInt16LE(offset))/1000)}
|
|
227
|
+
}
|
|
229
228
|
|
|
230
229
|
getName(){
|
|
231
230
|
const dt = DEVICE_TYPES.get(this.deviceID)
|