bt-sensors-plugin-sk 1.2.6-beta-6e → 1.3.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.
@@ -23,7 +23,7 @@ class OutOfRangeDevice extends EventEmitter{
23
23
  this.intervalID=setInterval(
24
24
  ()=>{
25
25
  adapter.waitDevice(config.mac_address,(config?.discoveryTimeout??30)*1000)
26
- .then(async (device)=> {
26
+ .then( (device)=> {
27
27
  this.emit("deviceFound", device)
28
28
  clearInterval(this.intervalID)
29
29
  this.intervalID=undefined
package/README.md CHANGED
@@ -2,32 +2,28 @@
2
2
 
3
3
  ## WHAT'S NEW
4
4
 
5
- # Version 1.2.6-beta-6
6
- - Funny you should ask...
7
-
8
- # Version 1.2.6-beta-5
9
-
10
- - JikongBMS fixes
11
5
 
12
- # Version 1.2.6-beta-4
6
+ # Version 1.3.1
13
7
 
14
- - Improved reconnect logic for connected devices
15
- - Error display in config (preliminary effort)
16
- - JikongBMS support (aka JKBMS)
8
+ - JBD Protection status
9
+ - SensorPush devices (untested)
17
10
 
18
- # Version 1.2.6-beta-3
11
+ # Version 1.3.0
19
12
 
13
+ - JikongBMS support (aka JKBMS)
14
+ - EcoWorthyBW02 Batteries/BMS support (need testers)
15
+ - Ective, Topband, Skanbatt etc LiFePo4 BMS support (ective.de BMS manufacturer)
16
+ - FeasyCom BP108B support -- iBeacon/Eddystone protocols
17
+ - Refactored code for connected devices
18
+ - Display connection/active state in config
19
+ - DBus resource issues addressed
20
+ - dbus-next package replaced with @jellybrick/dbus-next
21
+ - Improved reconnect logic for connected devices
20
22
  - UI improvements for selecting Sensor Class (if available, paths appear immediately upon selection)
21
- - EcoWorthy Batteries/BMS (need testers)
22
-
23
- # Version 1.2.6-beta
24
-
25
-
26
23
  - Mopeka examples not defaults in config for underused paths
27
24
  - Fix so no plugin restart required after selecting sensor class for an unidentified device
28
- - FeasyCom BP108B support -- iBeacon/Eddystone protocols
29
- - Ective, Topband, Skanbatt etc LiFePo4 BMS support (ective.de)
30
25
  - Fixed Junctek chargeDirection at start (amps will not reported until chargeDirection is known)
26
+ - auxMode detection fixes for Victron SmartBatteryMonitor devices
31
27
 
32
28
  # Version 1.2.5-1
33
29
 
@@ -122,7 +118,7 @@ It's pretty easy to write and deploy your own sensor class for any currently uns
122
118
  |[Jikong](https://jikongbms.com/)| https://jikongbms.com/product/ |
123
119
  |[Junctek](https://www.junteks.com)|[Junctek BMS](https://www.junteks.com/pages/product/index) |
124
120
  |[Remoran](https://remoran.eu)| [Remoran Wave.3](https://remoran.eu/wave.html)|
125
- |[AC DC Systems](https://marinedcac.com) | [Bank Manager] hybrid (Pb and Li) charger(https://marinedcac.com/pages/bankmanager)|
121
+ |[AC DC Systems](https://marinedcac.com) | [Bank Manager](https://marinedcac.com/pages/bankmanager) hybrid (Pb and Li) charger|
126
122
  |[Ective](https://ective.de/)| Also Topband(?), Skanbatt and others |
127
123
 
128
124
  ### Environmental
@@ -138,6 +134,7 @@ It's pretty easy to write and deploy your own sensor class for any currently uns
138
134
  |[Govee](http://www.govee.com)| Govee H50xx and H510x Temperature and humidity sensors |
139
135
  |[BTHome](https://bthome.io/)| NOTE: Framework for IOT sensor devices. |
140
136
  |[Inkbird](https://inkbird.com/)| TH-2 Temp and Humidity Sensor |
137
+ |[SensorPush](https://www.sensorpush.com/)| Temperature, Humidity and Atmospheric Pressure sensor|
141
138
 
142
139
 
143
140
  ### Tanks
package/index.js CHANGED
@@ -550,6 +550,7 @@ module.exports = function (app) {
550
550
  c.debug=app.debug
551
551
 
552
552
  const sensor = new c(device, config?.params, config?.gattParams)
553
+
553
554
  sensor._paths=config.paths //this might be a good candidate for refactoring
554
555
  sensor._app=app
555
556
  sensor._adapter=adapter //HACK!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bt-sensors-plugin-sk",
3
- "version": "1.2.6-beta-6e",
3
+ "version": "1.3.1",
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": {
Binary file
@@ -62,7 +62,24 @@ class JBDBMS extends BTSensor {
62
62
  .read=(buffer)=>{return buffer.readUInt16BE(12)}
63
63
 
64
64
  this.addMetadatum('protectionStatus', '', 'Protection Status',
65
- (buffer)=>{return buffer.readUInt16BE(20)} )
65
+ (buffer)=>{
66
+ const bits = buffer.readUInt16BE(20).toString(2)
67
+ return {
68
+ singleCellOvervolt: bits[0]=='1',
69
+ singleCellUndervolt: bits[1]=='1',
70
+ packOvervolt: (bits[2]=='1'),
71
+ packUndervolt: bits[3]=='1',
72
+ chargeOvertemp:bits[4]=='1',
73
+ chargeUndertemp:bits[5]=='1',
74
+ dischargeOvertemp:bits[6]=='1',
75
+ dischargeUndertemp:bits[7]=='1',
76
+ chargeOvercurrent:bits[8]=='1',
77
+ dischargeOvercurrent:bits[9]=='1',
78
+ shortCircut:bits[10]=='1',
79
+ frontEndDetectionICError:bits[11]=='1',
80
+ softwareLockMOS:bits[12]=='1',
81
+ }
82
+ })
66
83
  .default="electrical.batteries.{batteryID}.protectionStatus"
67
84
 
68
85
  this.addDefaultPath('SOC','electrical.batteries.capacity.stateOfCharge')
@@ -6,12 +6,6 @@ const RenogySensor = require("./Renogy/RenogySensor.js");
6
6
  class RenogyBattery extends RenogySensor {
7
7
 
8
8
  static ImageFile="RenogySmartLiFePo4Battery.webp"
9
-
10
- async init(){
11
- this.numberOfCells = await this.retrieveNumberOfCells()
12
- this.deviceID = await this.retrieveDeviceID()
13
- await super.init()
14
- }
15
9
 
16
10
  async getAllEmitterFunctions(){
17
11
  return [this.getAndEmitBatteryInfo.bind(this),
@@ -46,6 +40,8 @@ class RenogyBattery extends RenogySensor {
46
40
  }
47
41
  async initGATTConnection() {
48
42
  await super.initGATTConnection()
43
+ this.numberOfCells = await this.retrieveNumberOfCells()
44
+ this.deviceID = await this.retrieveDeviceID()
49
45
  this.emit('numberOfCells', this.numberOfCells)
50
46
  }
51
47
 
@@ -0,0 +1,123 @@
1
+ const BTSensor = require("../BTSensor");
2
+ class SensorPush extends BTSensor{
3
+ static Domain = BTSensor.SensorDomains.environmental
4
+
5
+ static async identify(device){
6
+
7
+ const name = await this.getDeviceProp(device,"Name")
8
+ const regex= /^SensorPush\s(HT|HTP)\s[0-9a-fA-F]{4}$/
9
+ if (name && name.match(regex))
10
+ return this
11
+ else
12
+ return null
13
+ }
14
+ static ImageFile="SensorPush.webp"
15
+ static Manufacturer="Cousins & Sears - Creative Technologists - Brooklyn, NY USA"
16
+ static ServiceUUID = "EF090000-11D6-42BA-93B8-9DD7EC090AB0"
17
+ static Characteristics =
18
+ {
19
+ tx: "EF090003-11D6-42BA-93B8-9DD7EC090AA9",
20
+ adv: "EF090005-11D6-42BA-93B8-9DD7EC090AA9",
21
+ batt: "EF090007-11D6-42BA-93B8-9DD7EC090AA9",
22
+ LED: "EF09000C-11D6-42BA-93B8-9DD7EC090AA9",
23
+ temp: "EF090080-11D6-42BA-93B8-9DD7EC090AA9",
24
+ hum: "EF090081-11D6-42BA-93B8-9DD7EC090AA9",
25
+ bar: "EF090082-11D6-42BA-93B8-9DD7EC090AA9"
26
+ }
27
+ pollFreq=30
28
+ hasGATT(){
29
+ return true
30
+ }
31
+ usingGATT(){
32
+ return true
33
+ }
34
+
35
+
36
+ async emitGATT(){
37
+ this.characteristics.temp.writeValue(0x01000000).then(async ()=>{
38
+ this.emitData("temp", await this.characteristics.temp.readValue())
39
+ this.emitData("hum", await this.characteristics.temp.readValue())
40
+ })
41
+ this.characteristics.bar.writeValue(0x01000000).then(async ()=>{
42
+ this.emitData("bar", await this.characteristics.bar.readValue())
43
+ })
44
+ }
45
+
46
+ initSchema(){
47
+ super.initSchema()
48
+ this.getGATTParams()["useGATT"].default=true
49
+
50
+ this.addDefaultParam("zone")
51
+
52
+ this.addParameter(
53
+ "tx",
54
+ {
55
+ title:'transmission rate in db',
56
+ type: 'number',
57
+ enum: [-21, -18, -15, -12, -9, -6, -3, 0, 1, 2, 3, 4, 5],
58
+ default: -3,
59
+ isRequired: true
60
+ }
61
+ )
62
+ this.addParameter(
63
+ "adv",
64
+ {
65
+ title:'advertising interval in ms',
66
+ type: 'number',
67
+ default: 1285,
68
+ minimum: Math.round((32*625)/1000),
69
+ maximum: Math.round((32767*625)/1000),
70
+ isRequired: true
71
+ }
72
+ )
73
+
74
+ this.addParameter(
75
+ "LED",
76
+ {
77
+ type: 'number',
78
+ title:'LED flashes per second (0=off, 1-127, 128=once every second',
79
+ default: 0,
80
+ minimum: 0,
81
+ maximum: 128,
82
+ isRequired: true
83
+ }
84
+ )
85
+
86
+ this.addDefaultPath("batt","sensors.batteryVoltage")
87
+ .read=(buffer)=>{ return buffer.readUInt16LE()/100}
88
+
89
+ this.addDefaultPath("temp","environment.temperature")
90
+ .read=(buffer)=>{ return buffer.readInt32E()/100}
91
+
92
+ this.addDefaultPath("humidity","environment.humidity")
93
+ .read=(buffer)=>{ return buffer.readInt32E()/10000}
94
+
95
+ this.addDefaultPath("pressure","environment.pressure")
96
+ .read=(buffer)=>{ return buffer.readInt32E()/100}
97
+
98
+ }
99
+
100
+ async initGATTConnection(isReconnecting){
101
+ await super.initGATTConnection(isReconnecting)
102
+ const gattServer = await this.getGATTServer()
103
+ const service = await gattServer.getPrimaryService(this.constructor.ServiceUUID)
104
+ this.characteristics={}
105
+ for (const c in this.constructor.Characteristics) {
106
+ this.characteristics[c] = await service.getCharacteristic(this.constructor.Characteristics[c])
107
+ }
108
+ if (this.tx) this.characteristics.tx.writeValueWithoutResponse(this.tx)
109
+ if (this.LED) this.characteristics.LED.writeValueWithoutResponse(this.LED)
110
+ if (this.adv) this.characteristics.tx.writeValueWithoutResponse(Math.round((this.adv/625)*1000))
111
+ }
112
+ async initGATTNotifications() {
113
+
114
+ }
115
+
116
+ async deactivateGATT(){
117
+ for (const c in this.characteristics) {
118
+ await this.stopGATTNotifications(this.characteristics[c])
119
+ }
120
+ await super.deactivateGATT()
121
+ }
122
+ }
123
+ module.exports=SensorPush