bt-sensors-plugin-sk 1.1.0-beta.2.2.4 → 1.1.0-beta.2.2.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.
Files changed (2) hide show
  1. package/index.js +9 -4
  2. package/package.json +3 -2
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const fs = require('fs')
2
2
  const util = require('util')
3
3
  const path = require('path')
4
+ const semver = require('semver')
4
5
  const packageInfo = require("./package.json")
5
6
 
6
7
  const {createBluetooth} = require('node-ble')
@@ -167,10 +168,14 @@ module.exports = function (app) {
167
168
  }
168
169
 
169
170
  function loadClassMap() {
170
- import(app.config.appPath+"/lib/modules.js").then( (modulesjs)=>{
171
- const _classMap = utilities_sk.loadClasses(path.join(__dirname, 'sensor_classes'))
172
- classMap = new Map([..._classMap].filter(([k, v]) => !k.startsWith("_") ))
173
- const { default:defaultExport} = modulesjs
171
+ const _classMap = utilities_sk.loadClasses(path.join(__dirname, 'sensor_classes'))
172
+ classMap = new Map([..._classMap].filter(([k, v]) => !k.startsWith("_") ))
173
+ const libPath = app.config.appPath +(
174
+ semver.gt(app.config.version,"2.13.5")?"dist":"lib"
175
+ )
176
+ //+ app.config.version
177
+ import(libPath+"/modules.js").then( (modulesjs)=>{
178
+ const { default:defaultExport} = modulesjs
174
179
  const modules = defaultExport.modulesWithKeyword(app.config, "signalk-bt-sensor-class")
175
180
  modules.forEach((module)=>{
176
181
  module.metadata.classFiles.forEach((classFile)=>{
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "bt-sensors-plugin-sk",
3
- "version": "1.1.0-beta.2.2.4",
3
+ "version": "1.1.0-beta.2.2.6",
4
4
  "description": "Bluetooth Sensors for Signalk -- support for Victron devices, RuuviTag, Xiaomi, ATC and Inkbird, Ultrasonic wind meters, Mopeka tank readers, Renogy Battery and Solar Controllers, Aranet4 environment sensors, SwitchBot temp and humidity sensors, KilovaultHLXPlus smart batteries, and Govee GVH51xx temp sensors",
5
5
  "main": "index.js",
6
6
  "dependencies": {
7
7
  "dbus-next": "^0.10.2",
8
8
  "node-ble": "^1.13.0",
9
9
  "int24":"^0.0.1",
10
- "kaitai-struct": "^0.10.0"
10
+ "kaitai-struct": "^0.10.0",
11
+ "semver":"^7.7.1"
11
12
  },
12
13
  "scripts": {
13
14
  "test": "echo \"Error: no test specified\" && exit 1"