From 336534b4dbe4df22fa2ef9e1f558e13ca83f0f5e Mon Sep 17 00:00:00 2001 From: Dirk-Jan Faber Date: Mon, 28 Oct 2024 15:11:23 +0100 Subject: [PATCH] Cope with deviceInstance changes And also start depending on dbus-native-victron instead of on dbus-native. --- package-lock.json | 68 ++++++++++++++++------------------- package.json | 2 +- src/services/dbus-listener.js | 5 ++- 3 files changed, 36 insertions(+), 39 deletions(-) diff --git a/package-lock.json b/package-lock.json index 51fd5bc..156ea96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,16 +9,16 @@ "version": "1.5.23", "license": "MIT", "dependencies": { - "dbus-native": "^0.4.0", - "debug": "^4.3.4", + "dbus-native-victron": "^0.4.2", + "debug": "^4.3.7", "lodash": "^4.17.21", "promise-retry": "^2.0.1", - "standard": "^17.1.0" + "standard": "^17.1.2" }, "devDependencies": { - "@babel/eslint-parser": "^7.24.5", + "@babel/eslint-parser": "^7.25.7", "csv-parse": "^5.5.6", - "eslint": "^9.2.0", + "eslint": "^9.12.0", "eslint-config-google": "^0.14.0", "gar": "^1.0.4" }, @@ -1082,18 +1082,18 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/dbus-native": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/dbus-native/-/dbus-native-0.4.0.tgz", - "integrity": "sha512-i3zvY3tdPEOaMgmK4riwupjDYRJ53rcE1Kj8rAgnLOFmBd0DekUih59qv8v+Oyils/U9p+s4sSsaBzHWLztI+Q==", + "node_modules/dbus-native-victron": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/dbus-native-victron/-/dbus-native-victron-0.4.2.tgz", + "integrity": "sha512-KIO25q60OByuu86OKVnFDE+4NA5ev+XEqvH/FWkqtK2ydVNStoQs8Z6CvAfnE8YwSNFAkHWCT/07XWQK28bW7A==", "dependencies": { "event-stream": "^4.0.0", "hexy": "^0.2.10", "long": "^4.0.0", - "optimist": "^0.6.1", + "optimist": "^0.5.2", "put": "0.0.6", "safe-buffer": "^5.1.1", - "xml2js": "^0.4.17" + "xml2js": "^0.6.2" }, "bin": { "dbus2js": "bin/dbus2js.js" @@ -1102,6 +1102,26 @@ "abstract-socket": "^2.0.0" } }, + "node_modules/dbus-native-victron/node_modules/optimist": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.5.2.tgz", + "integrity": "sha512-r9M8ZpnM9SXV5Wii7TCqienfcaY3tAiJe9Jchof87icbmbruKgK0xKXngmrnowTDnEawmmI1Qbha59JEoBkBGA==", + "dependencies": { + "wordwrap": "~0.0.2" + } + }, + "node_modules/dbus-native-victron/node_modules/xml2js": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz", + "integrity": "sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, "node_modules/debug": { "version": "4.3.7", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", @@ -2828,11 +2848,6 @@ "node": "*" } }, - "node_modules/minimist": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", - "integrity": "sha512-iotkTvxc+TwOm5Ieim8VnSNvCDjCK9S8G3scJ50ZthspSxa7jx50jkhYduuAtAjvfDUwSgOwf8+If99AlOEhyw==" - }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -2967,15 +2982,6 @@ "wrappy": "1" } }, - "node_modules/optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha512-snN4O4TkigujZphWLN0E//nQmm7790RYaE53DdL7ZYwee2D8DDo9/EyYiKUfN3rneWUjhJnueija3G9I2i0h3g==", - "dependencies": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - } - }, "node_modules/optionator": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", @@ -4370,18 +4376,6 @@ "node": ">=8" } }, - "node_modules/xml2js": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", - "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", - "dependencies": { - "sax": ">=0.6.0", - "xmlbuilder": "~11.0.0" - }, - "engines": { - "node": ">=4.0.0" - } - }, "node_modules/xmlbuilder": { "version": "11.0.1", "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", diff --git a/package.json b/package.json index 4a329e4..cc3454f 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "Custom Node-RED Nodes for Victron Energy", "version": "1.5.23", "dependencies": { - "dbus-native": "^0.4.0", + "dbus-native-victron": "^0.4.2", "debug": "^4.3.7", "lodash": "^4.17.21", "promise-retry": "^2.0.1", diff --git a/src/services/dbus-listener.js b/src/services/dbus-listener.js index c1ac3ff..66c7007 100644 --- a/src/services/dbus-listener.js +++ b/src/services/dbus-listener.js @@ -3,7 +3,7 @@ * https://github.com/sbender9/signalk-venus-plugin/blob/master/dbus-listener.js */ -const dbus = require('dbus-native') +const dbus = require('dbus-native-victron') const debug = require('debug')('node-red-contrib-victron:dbus') const _ = require('lodash') @@ -230,6 +230,9 @@ class VictronDbusListener { if (!service || !service.name) { return } + if (m.path === '/DeviceInstance') { + service.deviceInstance = m.value + } m.senderName = service.name.split('.').splice(0, 3).join('.') if (service.deviceInstance === null) { service.deviceInstance = searchDeviceInstanceByName(this.services, m.senderName, '')