bt-sensors-plugin-sk 1.3.4-beta → 1.3.4
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 +5 -4
- package/index.js +13 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
## WHAT'S NEW
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
# Version 1.3.4
|
|
7
|
-
|
|
8
|
-
- Experimental inactivity timeout with Bluetooth recycle
|
|
6
|
+
# Version 1.3.4
|
|
9
7
|
|
|
8
|
+
- Inactivity timeout configuration option. If > 0 and there's been no contact with any Bluetooth device, the plugin will power cycle the bluetooth adapter.
|
|
9
|
+
- Exclude non-active devices that are Out of Range from Last Error and Status on SignalK Dashboard
|
|
10
|
+
|
|
10
11
|
# Version 1.3.3
|
|
11
12
|
|
|
12
13
|
- Support for additional Xiaomi environmental sensors
|
|
13
14
|
- Out Of Range device automatic retry
|
|
14
|
-
-
|
|
15
|
+
- [Device pairing guide](./pairing.md)
|
|
15
16
|
|
|
16
17
|
# Version 1.3.2-1
|
|
17
18
|
|
package/index.js
CHANGED
|
@@ -178,8 +178,8 @@ module.exports = function (app) {
|
|
|
178
178
|
minimum: 10,
|
|
179
179
|
maximum: 3600
|
|
180
180
|
},
|
|
181
|
-
inactivityTimeout: {title: "Inactivity timeout
|
|
182
|
-
type: "integer", default:
|
|
181
|
+
inactivityTimeout: {title: "Inactivity timeout in seconds -- set to 0 to disable. (If no contact with any sensors for this period, the plugin will attempt to power cycle the Bluetooth adapter.)",
|
|
182
|
+
type: "integer", default: 0,
|
|
183
183
|
minimum: 0,
|
|
184
184
|
maximum: 3600
|
|
185
185
|
},
|
|
@@ -208,8 +208,6 @@ module.exports = function (app) {
|
|
|
208
208
|
plugin.started=true
|
|
209
209
|
var adapterID=options.adapter
|
|
210
210
|
var foundConfiguredDevices=0
|
|
211
|
-
var lastContactDelta=Infinity
|
|
212
|
-
|
|
213
211
|
|
|
214
212
|
if (Object.keys(options).length==0){ //empty config means initial startup. save defaults and enabled=true.
|
|
215
213
|
let json = {configuration:{adapter:"hci0", transport:"le", discoveryTimeout:30, discoveryInterval:10}, enabled:true, enableDebug:false}
|
|
@@ -330,7 +328,8 @@ module.exports = function (app) {
|
|
|
330
328
|
transport: options.transport,
|
|
331
329
|
duplicateData: options.duplicateData,
|
|
332
330
|
discoveryTimeout: options.discoveryTimeout,
|
|
333
|
-
discoveryInterval: options.discoveryInterval
|
|
331
|
+
discoveryInterval: options.discoveryInterval,
|
|
332
|
+
inactivityTimeout: options.inactivityTimeout
|
|
334
333
|
}
|
|
335
334
|
}
|
|
336
335
|
);
|
|
@@ -521,7 +520,8 @@ module.exports = function (app) {
|
|
|
521
520
|
{
|
|
522
521
|
s.setError(errorTxt)
|
|
523
522
|
} else {
|
|
524
|
-
|
|
523
|
+
if (config.active)
|
|
524
|
+
plugin.setError(errorTxt)
|
|
525
525
|
}
|
|
526
526
|
plugin.debug(e)
|
|
527
527
|
|
|
@@ -764,10 +764,9 @@ module.exports = function (app) {
|
|
|
764
764
|
}
|
|
765
765
|
const minTimeout=Math.min(...deviceConfigs.map((dc)=>dc?.discoveryTimeout??options.discoveryTimeout))
|
|
766
766
|
const intervalTimeout = ((minTimeout==Infinity)?(options?.discoveryTimeout??plugin.schema.properties.discoveryTimeout.default):minTimeout)*1000
|
|
767
|
-
|
|
768
|
-
|
|
769
767
|
|
|
770
768
|
deviceHealthID = setInterval( async ()=> {
|
|
769
|
+
let lastContactDelta=Infinity
|
|
771
770
|
sensorMap.forEach((sensor)=>{
|
|
772
771
|
const config = getDeviceConfig(sensor.getMacAddress())
|
|
773
772
|
const dt = config?.discoveryTimeout??options.discoveryTimeout
|
|
@@ -778,7 +777,7 @@ module.exports = function (app) {
|
|
|
778
777
|
updateSensor(sensor)
|
|
779
778
|
}
|
|
780
779
|
})
|
|
781
|
-
if (sensorMap.size && lastContactDelta > options.inactivityTimeout)
|
|
780
|
+
if (sensorMap.size && options.inactivityTimeout && lastContactDelta > options.inactivityTimeout)
|
|
782
781
|
{
|
|
783
782
|
|
|
784
783
|
plugin.debug(`No contact with any sensors for ${lastContactDelta} seconds. Recycling Bluetooth adapter.`)
|
|
@@ -813,6 +812,11 @@ module.exports = function (app) {
|
|
|
813
812
|
progressTimeoutID=null
|
|
814
813
|
}
|
|
815
814
|
|
|
815
|
+
if (deviceHealthID) {
|
|
816
|
+
clearTimeout(deviceHealthID)
|
|
817
|
+
deviceHealthID=null
|
|
818
|
+
}
|
|
819
|
+
|
|
816
820
|
if ((sensorMap)){
|
|
817
821
|
for await (const sensorEntry of sensorMap.entries()) {
|
|
818
822
|
try{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bt-sensors-plugin-sk",
|
|
3
|
-
"version": "1.3.4
|
|
3
|
+
"version": "1.3.4",
|
|
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": {
|