bt-sensors-plugin-sk 1.2.6-beta-5 → 1.2.6-beta-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 +120 -85
- package/README.md +4 -0
- package/index.js +34 -19
- package/package.json +2 -2
- package/public/847.js +1 -1
- package/sensor_classes/BankManager.js +23 -35
- package/sensor_classes/Beacon/Eddystone.js +1 -1
- package/sensor_classes/Beacon/iBeacon.js +1 -1
- package/sensor_classes/EcoWorthyBW02.js +13 -20
- package/sensor_classes/EctiveBMS.js +8 -11
- package/sensor_classes/GobiusCTankMeter.js +13 -26
- package/sensor_classes/JBDBMS.js +7 -10
- package/sensor_classes/JikongBMS.js +35 -41
- package/sensor_classes/Junctek.js +13 -24
- package/sensor_classes/KilovaultHLXPlus.js +16 -25
- package/sensor_classes/MercurySmartcraft.js +26 -36
- package/sensor_classes/MopekaTankSensor.js +1 -1
- package/sensor_classes/RemoranWave3.js +23 -31
- package/sensor_classes/Renogy/RenogySensor.js +6 -13
- package/sensor_classes/ShenzhenLiOnBMS.js +11 -23
- package/sensor_classes/UltrasonicWindMeter.js +26 -43
- package/sensor_classes/XiaomiMiBeacon.js +10 -27
- package/src/components/PluginConfigurationPanel.js +1 -2
|
@@ -148,25 +148,19 @@ class ShenzhenLiONBMS extends BTSensor{
|
|
|
148
148
|
this.getJSONSchema().properties.params.required=["batteryID", "numberOfCells" ]
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
async initGATTConnection(){
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
this.rxCharacteristic = await this.service.getCharacteristic("0000ffe1-0000-1000-8000-00805f9b34fb")
|
|
159
|
-
this.txCharacteristic = await this.service.getCharacteristic("0000ffe2-0000-1000-8000-00805f9b34fb")
|
|
160
|
-
}
|
|
161
|
-
resolve(this)
|
|
162
|
-
})})
|
|
151
|
+
async initGATTConnection(isReconnecting){
|
|
152
|
+
|
|
153
|
+
await super.initGATTConnection(isReconnecting)
|
|
154
|
+
const gattServer = await this.getGATTServer()
|
|
155
|
+
const service = await gattServer.getPrimaryService("0000ffe0-0000-1000-8000-00805f9b34fb")
|
|
156
|
+
this.txCharacteristic = await service.getCharacteristic("0000ffe2-0000-1000-8000-00805f9b34fb")
|
|
157
|
+
this.rxCharacteristic = await service.getCharacteristic("0000ffe1-0000-1000-8000-00805f9b34fb")
|
|
163
158
|
}
|
|
164
159
|
|
|
165
160
|
async initGATTInterval(){
|
|
166
161
|
await this.initGATTNotifications()
|
|
167
162
|
}
|
|
168
|
-
emitGATT(){
|
|
169
|
-
|
|
163
|
+
emitGATT(){
|
|
170
164
|
}
|
|
171
165
|
async initGATTNotifications() {
|
|
172
166
|
await this.rxCharacteristic.startNotifications()
|
|
@@ -180,15 +174,9 @@ class ShenzhenLiONBMS extends BTSensor{
|
|
|
180
174
|
)
|
|
181
175
|
}
|
|
182
176
|
|
|
183
|
-
async
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
await this.rxCharacteristic.stopNotifications()
|
|
187
|
-
this.rxCharacteristic=null
|
|
188
|
-
}
|
|
189
|
-
if (await this.device.isConnected()){
|
|
190
|
-
await this.device.disconnect()
|
|
191
|
-
}
|
|
177
|
+
async deactivateGATT(){
|
|
178
|
+
await this.stopGATTNotifications(this.rxCharacteristic)
|
|
179
|
+
await super.deactivateGATT()
|
|
192
180
|
}
|
|
193
181
|
}
|
|
194
182
|
module.exports=ShenzhenLiONBMS
|
|
@@ -52,53 +52,36 @@ class UltrasonicWindMeter extends BTSensor{
|
|
|
52
52
|
.default='environment.wind.speedApparent'
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
initGATTConnection(){
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
this.awaCharacteristic = await this.envService.getCharacteristic("00002a73-0000-1000-8000-00805f9b34fb") }
|
|
64
|
-
resolve(this)
|
|
65
|
-
}) .catch((e)=>{ reject(e.message) }) })
|
|
55
|
+
async initGATTConnection(isReconnecting){
|
|
56
|
+
await super.initGATTConnection(isReconnecting)
|
|
57
|
+
const gattServer = await this.getGATTServer()
|
|
58
|
+
const battService = await gattServer.getPrimaryService("0000180f-0000-1000-8000-00805f9b34fb")
|
|
59
|
+
this.battCharacteristic = await battService.getCharacteristic("00002a19-0000-1000-8000-00805f9b34fb")
|
|
60
|
+
const envService = await gattServer.getPrimaryService("0000181a-0000-1000-8000-00805f9b34fb")
|
|
61
|
+
this.awsCharacteristic = await envService.getCharacteristic("00002a72-0000-1000-8000-00805f9b34fb")
|
|
62
|
+
this.awaCharacteristic = await envService.getCharacteristic("00002a73-0000-1000-8000-00805f9b34fb")
|
|
66
63
|
}
|
|
67
|
-
initGATTNotifications() {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
async initGATTNotifications() {
|
|
65
|
+
await this.battCharacteristic.startNotifications()
|
|
66
|
+
this.battCharacteristic.on('valuechanged', buffer => {
|
|
67
|
+
this.emitData("batt",buffer)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
await this.awaCharacteristic.startNotifications()
|
|
71
|
+
this.awaCharacteristic.on('valuechanged', buffer => {
|
|
75
72
|
this.emitData("awa", buffer)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
this.awsCharacteristic.on('valuechanged', buffer => {
|
|
73
|
+
})
|
|
74
|
+
await this.awsCharacteristic.startNotifications()
|
|
75
|
+
this.awsCharacteristic.on('valuechanged', buffer => {
|
|
80
76
|
this.emitData("aws", buffer)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
77
|
+
})
|
|
78
|
+
}
|
|
84
79
|
|
|
85
|
-
async
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
if (this.awaCharacteristic && await this.awaCharacteristic.isNotifying()) {
|
|
92
|
-
await this.awaCharacteristic.stopNotifications()
|
|
93
|
-
this.awaCharacteristic=null
|
|
94
|
-
}
|
|
95
|
-
if (this.awsCharacteristic && await this.awsCharacteristic.isNotifying()) {
|
|
96
|
-
await this.awsCharacteristic.stopNotifications()
|
|
97
|
-
this.awsCharacteristic=null
|
|
98
|
-
}
|
|
99
|
-
if (await this.device.isConnected()){
|
|
100
|
-
await this.device.disconnect()
|
|
101
|
-
}
|
|
80
|
+
async deactivateGATT(){
|
|
81
|
+
await this.stopGATTNotifications(this.battCharacteristic)
|
|
82
|
+
await this.stopGATTNotifications(this.awaCharacteristic)
|
|
83
|
+
await this.stopGATTNotifications(this.awsCharacteristic)
|
|
84
|
+
await super.deactivateGATT()
|
|
102
85
|
}
|
|
103
86
|
}
|
|
104
87
|
module.exports=UltrasonicWindMeter
|
|
@@ -110,18 +110,11 @@ class XiaomiMiBeacon extends BTSensor{
|
|
|
110
110
|
return ""
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
initGATTConnection(){
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
this.gattCharacteristic = await this.gattService.getCharacteristic("ebe0ccc1-7a0a-4b0c-8a1a-6ff2997da3a6")
|
|
119
|
-
resolve(this)
|
|
120
|
-
})
|
|
121
|
-
.catch((e)=>{
|
|
122
|
-
reject(e.message)
|
|
123
|
-
})
|
|
124
|
-
})
|
|
113
|
+
async initGATTConnection(isReconnecting){
|
|
114
|
+
await super.initGATTConnection(isReconnecting)
|
|
115
|
+
const gatt = await this.getGATTServer()
|
|
116
|
+
const gattService = await gatt.getPrimaryService("ebe0ccb0-7a0a-4b0c-8a1a-6ff2997da3a6")
|
|
117
|
+
this.gattCharacteristic = await gattService.getCharacteristic("ebe0ccc1-7a0a-4b0c-8a1a-6ff2997da3a6")
|
|
125
118
|
}
|
|
126
119
|
|
|
127
120
|
emitGATT(){
|
|
@@ -132,11 +125,10 @@ class XiaomiMiBeacon extends BTSensor{
|
|
|
132
125
|
}
|
|
133
126
|
|
|
134
127
|
async initGATTNotifications() {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}))
|
|
128
|
+
await this.gattCharacteristic.startNotifications()
|
|
129
|
+
this.gattCharacteristic.on('valuechanged', buffer => {
|
|
130
|
+
this.emitValues(buffer)
|
|
131
|
+
})
|
|
140
132
|
}
|
|
141
133
|
|
|
142
134
|
decryptV2and3(data){
|
|
@@ -244,20 +236,11 @@ class XiaomiMiBeacon extends BTSensor{
|
|
|
244
236
|
return super.getName()
|
|
245
237
|
else
|
|
246
238
|
return this?.name??`${dt.name} ${dt.model}`
|
|
247
|
-
|
|
248
239
|
}
|
|
249
240
|
|
|
250
241
|
async deactivateGATT(){
|
|
251
|
-
await this.
|
|
242
|
+
await this.stopGATTNotifications(this.gattCharacteristic)
|
|
252
243
|
await super.deactivateGATT()
|
|
253
244
|
}
|
|
254
|
-
|
|
255
|
-
async disconnectGATTCharacteristic(){
|
|
256
|
-
if (this.gattCharacteristic && await this.gattCharacteristic.isNotifying()) {
|
|
257
|
-
this.gattCharacteristic.removeAllListeners()
|
|
258
|
-
await this.gattCharacteristic.stopNotifications()
|
|
259
|
-
this.gattCharacteristic=null
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
245
|
}
|
|
263
246
|
module.exports=XiaomiMiBeacon
|
|
@@ -133,7 +133,6 @@ async function fetchJSONData(path, data = {}) {
|
|
|
133
133
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
|
|
137
136
|
async function getSensorInfo(mac, sensorClass){
|
|
138
137
|
|
|
139
138
|
const response = await fetchJSONData("getSensorInfo",{mac_address: mac, class: sensorClass})
|
|
@@ -387,7 +386,7 @@ function createListGroupItem(sensor){
|
|
|
387
386
|
{`${sensor._changesMade?"*":""}${sensor.info.name} MAC: ${sensor.info.mac} RSSI: ${ifNullNaN(sensor.info.RSSI)}` }
|
|
388
387
|
<div class="d-flex justify-content-between ">
|
|
389
388
|
{
|
|
390
|
-
sensor.info.state
|
|
389
|
+
`${sensor.info.state} ${sensor.info.error?" (ERROR)": "" }`
|
|
391
390
|
}
|
|
392
391
|
<div class="d-flex justify-content-between ">
|
|
393
392
|
{
|