bt-sensors-plugin-sk 1.1.1 → 1.2.0-beta.0.0.10
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 +304 -108
- package/Queue.js +48 -0
- package/README.md +36 -22
- package/classLoader.js +38 -0
- package/definitions.json +941 -0
- package/index.js +425 -375
- package/package.json +52 -6
- package/plugin_defaults.json +146 -0
- package/public/893.js +1 -1
- package/public/main.js +1 -100
- package/public/remoteEntry.js +1 -129
- package/sensor_classes/ATC.js +34 -22
- 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/BlackListedDevice.js +4 -0
- package/sensor_classes/DEVELOPMENT.md +1 -6
- package/sensor_classes/GoveeH50xx.js +12 -12
- package/sensor_classes/GoveeH510x.js +7 -8
- package/sensor_classes/IBeacon.js +6 -10
- package/sensor_classes/Inkbird.js +8 -6
- package/sensor_classes/JBDBMS.js +33 -25
- package/sensor_classes/KilovaultHLXPlus.js +33 -16
- package/sensor_classes/LancolVoltageMeter.js +4 -3
- package/sensor_classes/MopekaTankSensor.js +31 -15
- package/sensor_classes/Renogy/RenogySensor.js +15 -6
- package/sensor_classes/RenogyBattery.js +15 -13
- package/sensor_classes/RenogyRoverClient.js +2 -3
- package/sensor_classes/RuuviTag.js +36 -27
- package/sensor_classes/ShellySBHT003C.js +19 -22
- package/sensor_classes/SwitchBotMeterPlus.js +10 -12
- package/sensor_classes/SwitchBotTH.js +13 -16
- package/sensor_classes/UNKNOWN.js +8 -4
- package/sensor_classes/UltrasonicWindMeter.js +13 -5
- package/sensor_classes/Victron/VictronSensor.js +6 -2
- package/sensor_classes/VictronACCharger.js +19 -8
- package/sensor_classes/VictronBatteryMonitor.js +49 -37
- package/sensor_classes/VictronDCDCConverter.js +14 -5
- package/sensor_classes/VictronDCEnergyMeter.js +27 -15
- package/sensor_classes/VictronGXDevice.js +2 -5
- package/sensor_classes/VictronInverter.js +19 -15
- package/sensor_classes/VictronInverterRS.js +19 -8
- package/sensor_classes/VictronLynxSmartBMS.js +15 -13
- package/sensor_classes/VictronOrionXS.js +16 -3
- package/sensor_classes/VictronSmartBatteryProtect.js +5 -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 +31 -21
- package/spec/electrical.json +688 -0
- package/spec/environment.json +401 -0
- package/spec/sensors.json +39 -0
- package/spec/tanks.json +115 -0
- package/src/components/PluginConfigurationPanel.js +393 -0
- package/src/index.js +0 -0
- package/webpack.config.js +71 -0
package/README.md
CHANGED
|
@@ -1,19 +1,41 @@
|
|
|
1
1
|
# Bluetooth Sensors for [Signal K](http://www.signalk.org)
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## What's New
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 1.2.0-beta-0.0.10
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Better handling of plugin config screen when Disabled
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## 1.2.0-beta-0.0.9
|
|
10
|
+
|
|
11
|
+
Fixes to config page RSSI update.
|
|
12
|
+
|
|
13
|
+
## 1.2.0-beta-0.0.8
|
|
14
|
+
|
|
15
|
+
Improved handling of changed state on config page.
|
|
16
|
+
|
|
17
|
+
Several small fixes to various sensor classes.
|
|
18
|
+
|
|
19
|
+
## 1.2.0-beta-0.0.7
|
|
20
|
+
|
|
21
|
+
Added zone config param for environmental sensors. Removed location parameter.
|
|
22
|
+
|
|
23
|
+
## 1.2.0-beta-0.0.6
|
|
24
|
+
Default values for paths for most sensor classes.
|
|
25
|
+
|
|
26
|
+
## 1.2.0-beta-0.0.5
|
|
27
|
+
|
|
28
|
+
Added workaround to support multiple simultaneous GATT connections. Owing to problematic behavior in Bluez where making a GATT connection halted the scanner which made additional updates and connections impossible, added a scanner restart after making each GATT connection.
|
|
29
|
+
|
|
30
|
+
## 1.2.0-beta-0.0.1
|
|
31
|
+
|
|
32
|
+
Dynamic configuration added. List updates when new devices are found by scanner. (No more screen refreshing necessary).
|
|
10
33
|
|
|
11
34
|
## WHAT IT IS
|
|
12
35
|
|
|
13
36
|
BT Sensors Plugin for Signalk is a lightweight BLE (Bluetooth Low Energy) framework for listening and connecting to Bluetooth sensors on your boat and sending deltas to Signalk paths with the values the sensors reports. <br>
|
|
14
37
|
|
|
15
|
-
The Plugin currently supports every documented Victron device (AC Charger, Battery Monitor, DC-DC Converter, DC Energy Meter, GX Device, Inverter, Inverter RS, Lynx Smart BMS, Orion XS, Smart Battery Protect, Smart Lithium and VE Bus), [Lancol Battery Meters ](https://www.lancol.com/product/12v-bluetooth-4-0-battery-tester-micro-10-c/), [Kilovault HLX+ smart batteries ](https://sunwatts.com/content/manual/KiloVault_HLX_PLUS_Datasheet_06252021%20%281%29.pdf?srsltid=AfmBOooY-cGnC_Qm6V1T9Vg5oZzBCJurS0AOGoWqWeyy-dwz2vA-l1Jb), Xiaomi devices, [ATC devices](https://github.com/atc1441/ATC_MiThermometer), RuuviTags, Renogy BMS, Ultrasonic Wind Meters, SwitchBotTH and Meterplus, Aranet 2/4 environmental sensors, Govee 50/51xx sensors,
|
|
16
|
-
[JBD/Jiabaida/Xiaoxiang Battery management systems](https://jiabaida-bms.com/), IBeacon and clone devices, and Inkbird thermometers.
|
|
38
|
+
The Plugin currently supports every documented Victron device (AC Charger, Battery Monitor, DC-DC Converter, DC Energy Meter, GX Device, Inverter, Inverter RS, Lynx Smart BMS, Orion XS, Smart Battery Protect, Smart Lithium and VE Bus), [Lancol Battery Meters ](https://www.lancol.com/product/12v-bluetooth-4-0-battery-tester-micro-10-c/), [Kilovault HLX+ smart batteries ](https://sunwatts.com/content/manual/KiloVault_HLX_PLUS_Datasheet_06252021%20%281%29.pdf?srsltid=AfmBOooY-cGnC_Qm6V1T9Vg5oZzBCJurS0AOGoWqWeyy-dwz2vA-l1Jb), Xiaomi devices, [ATC devices](https://github.com/atc1441/ATC_MiThermometer), RuuviTags, Renogy BMS, Ultrasonic Wind Meters, SwitchBotTH and Meterplus, Aranet 2/4 environmental sensors, Govee 50/51xx sensors, and Inkbird thermometers.
|
|
17
39
|
|
|
18
40
|
A typical use case is a Bluetooth thermometer like the Xiaomi LYWSD03MMC, an inexpensive Bluetooth thermometer that runs on a 3V watch battery that can report the current temperature and humidity in your refrigerator or cabin or wherever you want to stick it (no judgement.) <br>
|
|
19
41
|
|
|
@@ -21,12 +43,6 @@ The reported temperature can then be displayed on a Signalk app like Kip, Wilhel
|
|
|
21
43
|
|
|
22
44
|
It's pretty easy to write and deploy your own sensor class for any currently unsupported sensor. More on that in [the development README](./sensor_classes/DEVELOPMENT.md).
|
|
23
45
|
|
|
24
|
-
### RENOGY NOTES
|
|
25
|
-
|
|
26
|
-
The class of Renogy Devices cannot be reliably identified from their Bluetooth advertisements. <br>
|
|
27
|
-
|
|
28
|
-
On the plugin config page, You will need to select the device from the Device dropdown, then select the appropriate class from the Class dropdown. After that, you will need to hit the Submit button. On restart of the plugin, the plugin should recognize the device. If you've selected the appropriate class (RenogyRoverClient for example), you should see configs for paths. <br>
|
|
29
|
-
|
|
30
46
|
## WHO IS IT FOR
|
|
31
47
|
|
|
32
48
|
Signalk users with a Linux boat-puter (Windows and MacOS are NOT currently supported) and Bluetooth sensors they'd like to integrate into their Signalk datastream.
|
|
@@ -41,15 +57,16 @@ Signalk users with a Linux boat-puter (Windows and MacOS are NOT currently suppo
|
|
|
41
57
|
|
|
42
58
|
## INSTALLATION
|
|
43
59
|
|
|
44
|
-
|
|
60
|
+
NOTE: If you're running the 1.0.3 release, you will have to reconfigure your devices.<br>
|
|
45
61
|
|
|
46
|
-
|
|
62
|
+
### Signalk Appstore
|
|
63
|
+
The beta plugin is not currently available in the Signalk Appstore. <br>
|
|
47
64
|
|
|
48
65
|
### NPM
|
|
49
66
|
|
|
50
67
|
Go to you signalk home (usually ~/.signalk) and run:
|
|
51
68
|
|
|
52
|
-
npm i bt-sensors-plugin-sk@1.
|
|
69
|
+
npm i bt-sensors-plugin-sk@1.2.0-beta.0.0.7
|
|
53
70
|
|
|
54
71
|
### Linux
|
|
55
72
|
|
|
@@ -58,6 +75,8 @@ If you want to install directly from source (this is mostly of interest to custo
|
|
|
58
75
|
<pre> cd ~/[some_dir]
|
|
59
76
|
git clone https://github.com/naugehyde/bt-sensors-plugin-sk
|
|
60
77
|
cd bt-sensors-plugin-sk
|
|
78
|
+
git switch '1.2.0-beta'
|
|
79
|
+
git pull
|
|
61
80
|
npm i
|
|
62
81
|
[sudo] npm link
|
|
63
82
|
cd [signalk_home]
|
|
@@ -76,16 +95,11 @@ After installing and restarting Signalk you should see a "BT Sensors Plugin" opt
|
|
|
76
95
|
|
|
77
96
|
On initial configuration, wait for your Bluetooth adapter to scan devices. The plugin will scan for new devices at whatever you set the "scan for new devices interval" value to. <br><br>
|
|
78
97
|
|
|
79
|
-
> TIP: Close and re-open the config screen to refresh the screen. The config screen isn't as <i>reactive</i> as it oughtta be.<br><br>
|
|
80
|
-
|
|
81
|
-
Then press the + button to add a sensor. Your screen should look something like this:<br><br>
|
|
82
|
-
<img width="1122" alt="Screenshot 2024-10-13 at 6 52 52 PM" src="https://github.com/user-attachments/assets/0487b8d0-4bc0-4358-85c6-a507bc3c97d2">
|
|
83
|
-
|
|
84
98
|
<br><br>
|
|
85
99
|
|
|
86
|
-
Select the sensor you want Signalk to listen to from the
|
|
100
|
+
Select the sensor you want Signalk to listen to from the list.<br>
|
|
87
101
|
|
|
88
|
-
If you don't see your device and you know that it's on and nearby to the server, it may not be currently supported. But fear not, you can add custom sensor classes yourself. (Check out [the development section](#development).). <br><br>
|
|
102
|
+
If you don't see your device and you know that it's on and nearby to the server, it may not be currently supported (It could also be out of range.) But fear not, you can add custom sensor classes yourself. (Check out [the development section](#development).). <br><br>
|
|
89
103
|
|
|
90
104
|
Now it's a simple matter of associating the data emitted by the sensor with the Signalk path you want it to update. (Also, you can name your sensor so when it appears in logs its easy to recognize.) <br><br>
|
|
91
105
|
|
package/classLoader.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
const semver = require('semver')
|
|
4
|
+
|
|
5
|
+
function loadClasses (dir, ext='.js')
|
|
6
|
+
{
|
|
7
|
+
const classMap = new Map()
|
|
8
|
+
const classFiles = fs.readdirSync(dir)
|
|
9
|
+
.filter(file => file.endsWith(ext));
|
|
10
|
+
|
|
11
|
+
classFiles.forEach(file => {
|
|
12
|
+
const filePath = path.join(dir, file);
|
|
13
|
+
const cls = require(filePath);
|
|
14
|
+
classMap.set(cls.name, cls);
|
|
15
|
+
})
|
|
16
|
+
return classMap
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function loadClassMap(app) {
|
|
20
|
+
const _classMap = loadClasses(path.join(__dirname, 'sensor_classes'))
|
|
21
|
+
const classMap = new Map([..._classMap].filter(([k, v]) => !k.startsWith("_") ))
|
|
22
|
+
const libPath = app.config.appPath +(
|
|
23
|
+
semver.gt(app.config.version,"2.13.5")?"dist":"lib"
|
|
24
|
+
)
|
|
25
|
+
import(libPath+"/modules.js").then( (modulesjs)=>{
|
|
26
|
+
const { default:defaultExport} = modulesjs
|
|
27
|
+
const modules = defaultExport.modulesWithKeyword(app.config, "signalk-bt-sensor-class")
|
|
28
|
+
modules.forEach((module)=>{
|
|
29
|
+
module.metadata.classFiles.forEach((classFile)=>{
|
|
30
|
+
const cls = require(module.location+module.module+"/"+classFile);
|
|
31
|
+
classMap.set(cls.name, cls);
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
classMap.get('UNKNOWN').classMap=new Map([...classMap].sort().filter(([k, v]) => !v.isSystem )) // share the classMap with Unknown for configuration purposes
|
|
35
|
+
})
|
|
36
|
+
return classMap
|
|
37
|
+
}
|
|
38
|
+
module.exports=loadClassMap
|