bt-sensors-plugin-sk 1.2.6-beta → 1.2.6-beta-1

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.
@@ -0,0 +1,2 @@
1
+ {
2
+ }
package/README.md CHANGED
@@ -2,9 +2,15 @@
2
2
 
3
3
  ## WHAT'S NEW
4
4
 
5
+ # Version 1.2.6-beta-1
6
+
7
+ - UI improvements for selecting Sensor Class (if available, paths appear immediately upon selection)
8
+ - EcoWorthy Batteries/BMS (need testers)
9
+
5
10
  # Version 1.2.6-beta
6
11
 
7
- - Mopeka examples not defaults in config
12
+
13
+ - Mopeka examples not defaults in config for underused paths
8
14
  - Fix so no plugin restart required after selecting sensor class for an unidentified device
9
15
  - FeasyCom BP108B support -- iBeacon/Eddystone protocols
10
16
  - Ective, Topband, Skanbatt etc LiFePo4 BMS support (ective.de)
@@ -0,0 +1,170 @@
1
+ {
2
+ "configuration": {
3
+ "discoveryInterval": 10,
4
+ "peripherals": [
5
+ {
6
+ "active": true,
7
+ "discoveryTimeout": 30,
8
+ "params": {
9
+ "name": "ATC_9FF77E",
10
+ "zone": "inside.cabin",
11
+ "parser": "ATC-LE",
12
+ "sensorClass": "ATC"
13
+ },
14
+ "paths": {
15
+ "RSSI": "sensors.{macAndName}.RSSI",
16
+ "batteryStrength": "sensors.{macAndName}.battery.strength",
17
+ "voltage": "sensors.{macAndName}.battery.voltage",
18
+ "temp": "environment.{zone}.temperature",
19
+ "humidity": "environment.{zone}.humidity"
20
+ },
21
+ "mac_address": "A4:C1:38:9F:F7:7E"
22
+ },
23
+ {
24
+ "active": true,
25
+ "discoveryTimeout": 30,
26
+ "params": {
27
+ "name": "tps",
28
+ "zone": "inside.refrigerator",
29
+ "sensorClass": "Inkbird"
30
+ },
31
+ "paths": {
32
+ "RSSI": "sensors.{macAndName}.RSSI",
33
+ "temp": "environment.{zone}.temperature",
34
+ "battery": "sensors.{macAndName}.battery.strength"
35
+ },
36
+ "mac_address": "49:22:05:17:2B:AE"
37
+ },
38
+ {
39
+ "active": true,
40
+ "discoveryTimeout": 30,
41
+ "params": {
42
+ "name": "Ruuvi BC7E",
43
+ "zone": "inside.navdesk",
44
+ "sensorClass": "RuuviTag"
45
+ },
46
+ "paths": {
47
+ "RSSI": "sensors.{macAndName}.RSSI",
48
+ "temp": "environment.{zone}.temperature",
49
+ "humidity": "environment.{zone}.humidity",
50
+ "pressure": "environment.{zone}.pressure",
51
+ "accX": "sensors.{macAndName}.accX",
52
+ "accY": "sensors.{macAndName}.accY",
53
+ "accZ": "sensors.{macAndName}.accZ",
54
+ "battV": "sensors.{macAndName}.battery.voltage",
55
+ "mc": "sensors.{macAndName}.movementCounter",
56
+ "msc": "sensors.{macAndName}.measurementSequenceCounter"
57
+ },
58
+ "mac_address": "F9:B0:6E:63:BC:7E"
59
+ },
60
+ {
61
+ "active": true,
62
+ "discoveryTimeout": 30,
63
+ "params": {
64
+ "name": "SBMO-003Z-db1b",
65
+ "zone": "inside",
66
+ "sensorClass": "ShellySBMO003Z"
67
+ },
68
+ "paths": {
69
+ "RSSI": "sensors.{macAndName}.RSSI",
70
+ "motion": "environment.{zone}.motion",
71
+ "illuminance": "environment.{zone}.illuminance",
72
+ "battery": "sensors.{macAndName}.battery.strength",
73
+ "button": "sensors.{macAndName}.button"
74
+ },
75
+ "mac_address": "E8:E0:7E:97:DB:1B"
76
+ },
77
+ {
78
+ "active": true,
79
+ "discoveryTimeout": 30,
80
+ "params": {
81
+ "name": "LYWSD03MMC",
82
+ "zone": "inside.vberth",
83
+ "encryptionKey": "3985f4ebc032f276cc316f1f6ecea085",
84
+ "sensorClass": "XiaomiMiBeacon"
85
+ },
86
+ "paths": {
87
+ "RSSI": "sensors.{macAndName}.RSSI",
88
+ "temp": "environment.{zone}.temperature",
89
+ "humidity": "environment.{zone}.humidity",
90
+ "batteryStrength": "sensors.{macAndName}.battery.strength",
91
+ "voltage": "sensors.{macAndName}.battery.voltage"
92
+ },
93
+ "gattParams": {
94
+ "useGATT": false
95
+ },
96
+ "mac_address": "A4:C1:38:3E:7E:94"
97
+ },
98
+ {
99
+ "active": true,
100
+ "discoveryTimeout": 30,
101
+ "params": {
102
+ "name": "SmartShunt HQ2204C2GHD",
103
+ "batteryID": "house",
104
+ "encryptionKey": "8cce8529307cf9dd0c85611c4fef42d9",
105
+ "sensorClass": "VictronBatteryMonitor"
106
+ },
107
+ "paths": {
108
+ "RSSI": "sensors.{macAndName}.RSSI",
109
+ "current": "electrical.batteries.{batteryID}.current",
110
+ "power": "electrical.batteries.{batteryID}.power",
111
+ "voltage": "electrical.batteries.{batteryID}.voltage",
112
+ "alarm": "electrical.batteries.{batteryID}.alarm",
113
+ "consumed": "electrical.batteries.{batteryID}.capacity.ampHoursConsumed",
114
+ "soc": "electrical.batteries.{batteryID}.capacity.stateOfCharge",
115
+ "ttg": "electrical.batteries.{batteryID}.capacity.timeRemaining",
116
+ "starterVoltage": "electrical.batteries.secondary.voltage"
117
+ },
118
+ "gattParams": {
119
+ "useGATT": false
120
+ },
121
+ "mac_address": "D4:50:46:39:38:C5"
122
+ },
123
+ {
124
+ "active": true,
125
+ "discoveryTimeout": 90,
126
+ "params": {
127
+ "name": "aft propane tank",
128
+ "medium": "PROPANE",
129
+ "tankHeight": "325",
130
+ "id": "propane",
131
+ "sensorClass": "MopekaTankSensor"
132
+ },
133
+ "paths": {
134
+ "RSSI": "sensors.{macAndName}.RSSI",
135
+ "battVolt": "sensors.{macAndName}.battery.voltage",
136
+ "battStrength": "sensors.{macAndName}.battery.strength",
137
+ "temp": "tanks.{id}.temperature",
138
+ "tankLevel": "tanks.{id}.currentLevel",
139
+ "readingQuality": "sensors.{macAndName}.readingQuality",
140
+ "accX": "sensors.{macAndName}.accelerationXAxis",
141
+ "accY": "sensors.{macAndName}.accelerationYAxis"
142
+ },
143
+ "mac_address": "D4:40:59:BE:2A:8C"
144
+ },
145
+ {
146
+ "active": true,
147
+ "discoveryTimeout": 30,
148
+ "params": {
149
+ "name": "SBHT-003C",
150
+ "zone": "outside.deck",
151
+ "sensorClass": "ShellySBHT003C"
152
+ },
153
+ "paths": {
154
+ "RSSI": "sensors.{macAndName}.RSSI",
155
+ "battery": "sensors.{macAndName}.battery.strength",
156
+ "temp": "environment.{zone}.temperature",
157
+ "humidity": "environment.{zone}.humidity",
158
+ "button": "sensors.{macAndName}.button"
159
+ },
160
+ "mac_address": "7C:C6:B6:AF:49:5F"
161
+ }
162
+ ],
163
+ "adapter": "hci0",
164
+ "transport": "le",
165
+ "duplicateData": false,
166
+ "discoveryTimeout": 30
167
+ },
168
+ "enabled": true,
169
+ "enableDebug": false
170
+ }
@@ -0,0 +1,121 @@
1
+ {
2
+ "configuration": {
3
+ "discoveryTimeout": 30,
4
+ "discoveryInterval": 0,
5
+ "peripherals": [
6
+ {
7
+ "active": true,
8
+ "mac_address": "D4:50:46:39:38:C5",
9
+ "discoveryTimeout": 30,
10
+ "params": {
11
+ "name": "Victron Smart Shunt",
12
+ "encryptionKey": "8cce8529307cf9dd0c85611c4fef42d9"
13
+ },
14
+ "paths": {
15
+ "RSSI": "sensors.smartshunt.rssi",
16
+ "current": "electrical.battery.house.current",
17
+ "power": "electrical.battery.house.power",
18
+ "voltage": "electrical.battery.house.voltage",
19
+ "alarm": "electrical.battery.house.alarm",
20
+ "consumed": "electrical.battery.house.consumedAh",
21
+ "soc": "electrical.battery.house.soc",
22
+ "ttg": "electrical.battery.house.ttg",
23
+ "starterVoltage": "electrical.battery.starter.voltage",
24
+ "__state__": "sensors.smartshunt.state"
25
+ },
26
+ "gattParams": {
27
+ "useGATT": false
28
+ }
29
+ },
30
+ {
31
+ "active": true,
32
+ "mac_address": "F9:B0:6E:63:BC:7E",
33
+ "discoveryTimeout": 30,
34
+ "params": {
35
+ "name": "Ruuvi sensor for cabin"
36
+ },
37
+ "paths": {
38
+ "RSSI": "sensors.ruuviBC7E.rssi",
39
+ "temp": "environment.cabin.temperature",
40
+ "humidity": "environment.cabin.humidity",
41
+ "pressure": "environment.cabin.pressure",
42
+ "battV": "sensors.ruuviBC7E.voltage",
43
+ "mc": "sensors.ruuviBC7E.movementCounter",
44
+ "battery": "sensors.temperature.reefer.batterystrength",
45
+ "__state__": "sensors.ruuviBC7E.state"
46
+ }
47
+ },
48
+ {
49
+ "active": true,
50
+ "mac_address": "49:22:05:17:2B:AE",
51
+ "discoveryTimeout": 120,
52
+ "params": {
53
+ "name": "Inkbird temperature sensor"
54
+ },
55
+ "paths": {
56
+ "RSSI": "sensors.inkbird-th2.rssi",
57
+ "temp": "environment.refrigerator.temperature",
58
+ "battery": "sensors.inkbird-th2.battery",
59
+ "__state__": "sensors.inkbird-th2.state"
60
+ }
61
+ },
62
+ {
63
+ "active": true,
64
+ "mac_address": "A4:C1:38:9F:F7:7E",
65
+ "discoveryTimeout": 300,
66
+ "params": {
67
+ "name": "ATC Temp/Humidity sensor for Deck",
68
+ "parser": "ATC-LE"
69
+ },
70
+ "paths": {
71
+ "RSSI": "sensors.ATC_9FF77E.rssi",
72
+ "temp": "environment.deck.temperature",
73
+ "humidity": "environment.deck.humidity",
74
+ "voltage": "sensors.ATC_9FF77E.voltage",
75
+ "batteryStrength": "sensors.ATC_9FF77E.batteryStrength",
76
+ "__state__": "sensors.ATC_9FF77E.state"
77
+ }
78
+ },
79
+ {
80
+ "active": true,
81
+ "mac_address": "D4:40:59:BE:2A:8C",
82
+ "discoveryTimeout": 30,
83
+ "params": {
84
+ "medium": "PROPANE",
85
+ "tankHeight": "304.8",
86
+ "name": "Galley propane level"
87
+ },
88
+ "paths": {
89
+ "RSSI": "sensors.mopeka-59be8c.rssi",
90
+ "battVolt": "sensors.mopeka-59be8c.battery.voltage",
91
+ "battStrength": "sensors.mopeka-59be8c.battery.strength",
92
+ "temp": "sensors.mopeka-59be8c.temperature",
93
+ "tankLevel": "sensors.mopeka-59be8c.tankLevel",
94
+ "readingQuality": "sensors.mopeka-59be8c.quality",
95
+ "__state__": "sensors.mopeka-59be8c.state"
96
+ }
97
+ },
98
+ {
99
+ "active": true,
100
+ "mac_address": "A4:C1:38:3E:7E:94",
101
+ "discoveryTimeout": 30,
102
+ "params": {
103
+ "encryptionKey": "3985f4ebc032f276cc316f1f6ecea085",
104
+ "__state__": "sensors.xiaomi.state"
105
+ },
106
+ "paths": {
107
+ "RSSI": "sensors.xiaomi.rssi",
108
+ "temp": "sensors.xiaomi.temp",
109
+ "humidity": "sensors.xiaomi.humidity",
110
+ "voltage": "sensors.xiaomi.voltage",
111
+ "__state__": "sensors.xiaomi.state"
112
+ },
113
+ "gattParams": {
114
+ "useGATT": false
115
+ }
116
+ }
117
+ ]
118
+ },
119
+ "enabled": true,
120
+ "enableDebug": true
121
+ }
package/classLoader.js CHANGED
@@ -2,22 +2,22 @@ const fs = require('fs')
2
2
  const path = require('path')
3
3
  const semver = require('semver')
4
4
 
5
- function loadClasses (dir, ext='.js')
5
+ function loadClasses (dir, ext='.js')
6
6
  {
7
7
  const classMap = new Map()
8
8
  const classFiles = fs.readdirSync(dir)
9
9
  .filter(file => file.endsWith(ext));
10
10
 
11
- classFiles.forEach(file => {
11
+ classFiles.forEach( (file) => {
12
12
  const filePath = path.join(dir, file);
13
- const cls = require(filePath);
13
+ const cls = require (filePath)
14
14
  classMap.set(cls.name, cls);
15
15
  })
16
16
  return classMap
17
17
  }
18
18
 
19
- function loadClassMap(app) {
20
- const _classMap = loadClasses(path.join(__dirname, 'sensor_classes'))
19
+ function loadClassMap(app) {
20
+ const _classMap = loadClasses(path.join(__dirname, 'sensor_classes'))
21
21
  const classMap = new Map([..._classMap].filter(([k, v]) => !k.startsWith("_") ))
22
22
  const libPath = app.config.appPath +(
23
23
  semver.gt(app.config.version,"2.13.5")?"dist":"lib"
@@ -26,7 +26,7 @@ const semver = require('semver')
26
26
  const { default:defaultExport} = modulesjs
27
27
  const modules = defaultExport.modulesWithKeyword(app.config, "signalk-bt-sensor-class")
28
28
  modules.forEach((module)=>{
29
- module.metadata.classFiles.forEach((classFile)=>{
29
+ module.metadata.classFiles.forEach( (classFile)=>{
30
30
  try{
31
31
  const cls = require(module.location+module.module+"/"+classFile);
32
32
  classMap.set(cls.name, cls);
@@ -0,0 +1,57 @@
1
+ import { EventEmitter } from "events";
2
+ export class FakeGATTServer{
3
+ constructor(services){
4
+ this.services=services
5
+ }
6
+ getPrimaryService (uuid){
7
+ return this.services.find((service)=>{return service.uuid==uuid})
8
+ }
9
+ }
10
+
11
+ export class FakeGATTService{
12
+ constructor(uuid, characteristics=[]){
13
+ this.uuid=uuid
14
+ this.characteristics=characteristics
15
+ }
16
+ getCharacteristic (uuid){
17
+ return this.characteristics.find((characteristic)=>{return characteristic.uuid==uuid})
18
+ }
19
+ }
20
+
21
+ export class FakeGATTCharacteristic extends EventEmitter{
22
+ constructor(uuid, values=[], interval=1000){
23
+ super()
24
+ this.uuid=uuid
25
+ this.valueIndex=0
26
+ this.values=values
27
+ this.interval = interval
28
+ }
29
+ startNotifications(){
30
+ this.intervalID=setInterval(()=>{
31
+ if (this.values.length>0){
32
+ this.emit("valuechanged",Buffer.from(this.values[this.valueIndex++],"hex") )
33
+ if (this.valueIndex>=this.values.length)
34
+ this.valueIndex=0
35
+ }
36
+ },this.interval)
37
+
38
+ }
39
+ stopNotifications(){
40
+ this.clearInterval(this.intervalID)
41
+ }
42
+ }
43
+
44
+ export class FakeDevice{
45
+ constructor(services=[]){
46
+ this.gattServer=new FakeGATTServer(services)
47
+ }
48
+ connect(){
49
+ return this
50
+ }
51
+ gatt(){
52
+ return this.gattServer
53
+ }
54
+ disconnect(){
55
+
56
+ }
57
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+
3
+ "type": "module"
4
+
5
+ }