Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sbender9/signalk-venus-plugin
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.30.2
Choose a base ref
...
head repository: sbender9/signalk-venus-plugin
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Aug 5, 2023

  1. Copy the full SHA
    4bb6528 View commit details
  2. feature: added some new paths (#124)

    /Dc/0/MidVoltageDeviation
    /Dc/0/MidVoltage
    /Load/State
    /MppOperationMode
    /Leds/*
    /Remaining
    /Altitude
    sbender9 authored Aug 5, 2023
    Copy the full SHA
    6f4458d View commit details
  3. 1.31.0

    sbender9 committed Aug 5, 2023
    Copy the full SHA
    8c21783 View commit details

Commits on Aug 6, 2023

  1. Copy the full SHA
    e9999af View commit details
  2. Copy the full SHA
    ffa9b50 View commit details
  3. 1.31.1

    sbender9 committed Aug 6, 2023
    Copy the full SHA
    e21ba47 View commit details

Commits on Aug 17, 2023

  1. Copy the full SHA
    b29db54 View commit details
  2. 1.32.0

    sbender9 committed Aug 17, 2023
    Copy the full SHA
    b0d4f22 View commit details

Commits on Aug 18, 2023

  1. Copy the full SHA
    fa27cf9 View commit details

Commits on Sep 24, 2023

  1. Copy the full SHA
    ae0f656 View commit details
  2. Copy the full SHA
    8da99dc View commit details
  3. 1.33.0

    sbender9 committed Sep 24, 2023
    Copy the full SHA
    26f9811 View commit details

Commits on Sep 25, 2023

  1. Copy the full SHA
    bca62ef View commit details
  2. 1.33.1

    sbender9 committed Sep 25, 2023
    Copy the full SHA
    961c968 View commit details

Commits on Oct 6, 2023

  1. Copy the full SHA
    93e7043 View commit details
  2. Copy the full SHA
    e19fc16 View commit details
  3. feature: push acceleration data for RuuviTag (#131)

    * Add acceleration path for Ruuvitag
    
    To be alligned with  signalk-ruuvitag-plugin, push acceleration data to Signalk, on same paths.
    macjl authored Oct 6, 2023
    Copy the full SHA
    75d19cc View commit details
  4. 1.34.0

    sbender9 committed Oct 6, 2023
    Copy the full SHA
    7afde8c View commit details

Commits on Mar 30, 2024

  1. Copy the full SHA
    4c594d5 View commit details
  2. 1.34.1

    sbender9 committed Mar 30, 2024
    Copy the full SHA
    0d63c46 View commit details

Commits on May 1, 2024

  1. Copy the full SHA
    c019eb5 View commit details
  2. 1.35.0

    sbender9 committed May 1, 2024
    Copy the full SHA
    5eb7b2a View commit details

Commits on May 24, 2024

  1. Copy the full SHA
    ed1fe7b View commit details
  2. 1.36.0

    sbender9 committed May 24, 2024
    Copy the full SHA
    0f56699 View commit details
  3. Copy the full SHA
    2c56d9b View commit details
  4. 1.36.1

    sbender9 committed May 24, 2024
    Copy the full SHA
    9db9f49 View commit details
  5. Copy the full SHA
    61af423 View commit details

Commits on May 25, 2024

  1. Copy the full SHA
    1b46144 View commit details
  2. 1.37.0

    sbender9 committed May 25, 2024
    Copy the full SHA
    70d44e9 View commit details

Commits on Aug 5, 2024

  1. Copy the full SHA
    a7fc09e View commit details
  2. 1.38.0

    sbender9 committed Aug 5, 2024
    Copy the full SHA
    1bc4591 View commit details

Commits on Aug 6, 2024

  1. Copy the full SHA
    0d25836 View commit details
  2. 1.38.1

    sbender9 committed Aug 6, 2024
    Copy the full SHA
    5802cda View commit details

Commits on Aug 24, 2024

  1. Update README.md

    Link to Discord
    Remove "Supported Devices" list, not complete and hard to keep updated
    Remove info about developing the plugin outside of Signal K, no longer relavent .
    sbender9 authored Aug 24, 2024
    Copy the full SHA
    538426f View commit details

Commits on Sep 3, 2024

  1. Copy the full SHA
    5826f14 View commit details
  2. 1.38.2

    sbender9 committed Sep 3, 2024
    Copy the full SHA
    14a2dfd View commit details

Commits on Sep 9, 2024

  1. Copy the full SHA
    b15ed49 View commit details
  2. Copy the full SHA
    7c3fecc View commit details
  3. 1.39.0

    sbender9 committed Sep 9, 2024
    Copy the full SHA
    e57c8a3 View commit details
  4. Copy the full SHA
    aa85e3f View commit details
  5. Copy the full SHA
    a66f70c View commit details
  6. 1.40.0

    sbender9 committed Sep 9, 2024
    Copy the full SHA
    e0bde2b View commit details

Commits on Sep 10, 2024

  1. Copy the full SHA
    340bb05 View commit details

Commits on Sep 16, 2024

  1. Copy the full SHA
    80d3675 View commit details
  2. 1.41.0

    sbender9 committed Sep 16, 2024
    Copy the full SHA
    d2f3ccb View commit details
  3. Copy the full SHA
    f0a0a5b View commit details

Commits on Oct 20, 2024

  1. Copy the full SHA
    b7f7b49 View commit details
  2. 1.41.1

    sbender9 committed Oct 20, 2024
    Copy the full SHA
    a3b8dec View commit details

Commits on Nov 5, 2024

  1. Copy the full SHA
    55cab19 View commit details
  2. 1.42.0

    sbender9 committed Nov 5, 2024
    Copy the full SHA
    b96dfdd View commit details
Showing with 1,083 additions and 170 deletions.
  1. +4 −33 README.md
  2. +66 −12 dbus-listener.js
  3. +258 −58 index.js
  4. +5 −2 ios.js
  5. +7 −6 package.json
  6. +743 −59 venusToDeltas.js
37 changes: 4 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -9,29 +9,22 @@ possible to run [Venus OS](https://github.com/victronenergy/venus/wiki) on a
[RaspberryPi2 or 3](https://github.com/victronenergy/venus/wiki/raspberrypi-install-venus-image),
for example.

Supported Victron products:
- Inverter/Chargers: Multis, Quattros
- Battery Monitors: any type that is supported by Venus. For example the BMV-700 series, or the
Lynx Shunt VE.Can, as well as various integrated Lithium battery systems.
- Solar Chargers: both the types with a VE.Direct and the types with a VE.Can connection
- Tank senders: the resistive inputs on the Venus GX, as well as a tank sender connected to Venus
over N2K

Know that there is also a version of Venus OS with signalk-server, and this plug-in pre-installed.
In which case you don't need to self install or configure this plugin. See
[Venus OS large](https://www.victronenergy.com/live/venus-os:large).

## Support
Use the #victron channel on the [Signal K Slack](http://slack-invite.signalk.org/).
Use the #victron channel on [Discord](https://discord.gg/uuZrwz4dCS).

## Plugin installation & configuration
Installing is simple. The plugin is available in the signalk app store. Simply click to install.

Then there are two settings. The first is how to connect to Venus OS. Choose between these:

- A. Connect to localhost
- A. Connect to localhost via dbus
- B. Connect to a GX-device over tcp using MQTT (Plain text)
- C. Connect to a GX-device over tcp using MQTT (SSL)
- D. Connect via VRM

Use option A when signalk-server is installed on the GX-device itself.

@@ -43,26 +36,4 @@ When using option B or C go enter the hostname or ipaddress of the Venus device

Also ensure that MQTT is turned on in the GX-devices Services Settings.

## Test harness

To see data, without having actual Victron or other Venus compatible hardware setup,
get and run below explained Dummy data script. Or, clone
[dbus-recorder](https://github.com/victronenergy/dbus-recorder) and run play.sh.

Note that using the test harness could cause for some errors during init, as it
doesn't support doing a GetValue on the root item (/).

## How to develop this plugin outside of Signal K

First run `npm install`.

Use ./demo.sh to run the code with full debug logging and the produced delta
serialised to stdout.

When not tested on an actual Venus device, there will be no output since there
is no data coming in. Use a dummy data script to test / develop on a pc:

https://gist.github.com/mpvader/94672c05d68bb6762859ba70240ea887

dbus-listener.py is an example of how similar data would be read in Python. It
is not required to use the plugin.
Option D is mostly usefull for developer testing/debugging with other peoples systems, but could also be used if running signalk in a different location or network that the GC device
78 changes: 66 additions & 12 deletions dbus-listener.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const dbus = require('dbus-native')
const _ = require('lodash')
const camelcase = require('camelcase')

module.exports = function (app, messageCallback, address, plugin, pollInterval) {
return new Promise((resolve, reject) => {
@@ -77,15 +78,39 @@ module.exports = function (app, messageCallback, address, plugin, pollInterval)
// a process to manage settings on the dbus, the logger to VRM Portal
// and others. All services that send out data for connected devices do
// have the /DeviceInstance path.
app.debug(`warning: error getting device instance for ${name}`)
services[owner].deviceInstance = 99
if ( services[owner] ) {
app.debug(`warning: error getting device instance for ${name}`)
services[owner].deviceInstance = 99
}
} else {
services[owner].deviceInstance = res[1][0]
}

if ( plugin.options.useDeviceNames !== undefined &&
plugin.options.useDeviceNames ) {
app.debug('requesting custom name for %s', name)
bus.invoke(
{
path: '/CustomName',
destination: name,
interface: 'com.victronenergy.BusItem',
member: 'GetValue'
},
function (err, res) {
if (!err) {
let customName = res[1][0]
app.debug('got custom name %s for %s', customName, name)
services[owner].customName = camelcase(customName)
} else {
services[owner].customName = ''
}
requestRoot(service)
})
} else {
requestRoot(service)
}
}
)

requestRoot(service)
}

function requestRoot (service) {
@@ -106,9 +131,17 @@ module.exports = function (app, messageCallback, address, plugin, pollInterval)
)
} else {
var data = {}
res[1][0].forEach(kp => {
data[kp[0]] = kp[1][1][0]
})

if ( res[0][0].type == 'a' ) {
res[1][0].forEach(kp => {
data[kp[0]] = kp[1][1][0]
})
} else {
//for some reason virtual devices come in this way
res.forEach(kp => {
data[kp[0]] = kp[1][1][0]
})
}

service.deviceInstance = data.DeviceInstance

@@ -122,21 +155,33 @@ module.exports = function (app, messageCallback, address, plugin, pollInterval)

// app.debug(`${service.name} ${JSON.stringify(data)}`)

let deviceInstance = service.deviceInstance
let deviceInstance

/*
//FIXME: paths that don't require instance??
if ( _.isUndefined(deviceInstance) ) {
return
}
}
*/

if ( plugin.options.instanceMappings ) {
const mapping = plugin.options.instanceMappings.find(mapping => {
return service.name.startsWith(mapping.type) && mapping.venusId == deviceInstance
return service.name.startsWith(mapping.type) && mapping.venusId == service.deviceInstance
})
if ( !_.isUndefined(mapping) ) {
deviceInstance = mapping.signalkId
}
}

if ( deviceInstance === undefined )
{
if ( plugin.options.useDeviceNames !== undefined && plugin.options.useDeviceNames && service.customName !== '' ) {
deviceInstance = service.customName
}
else
deviceInstance = service.deviceInstance
}

var messages = []
_.keys(data).forEach(path => {
messages.push({
@@ -216,7 +261,7 @@ module.exports = function (app, messageCallback, address, plugin, pollInterval)
}

const senderName = service.name
let instanceName = service.deviceInstance
let instanceName

if ( plugin.options.instanceMappings ) {
const mapping = plugin.options.instanceMappings.find(mapping => {
@@ -225,7 +270,16 @@ module.exports = function (app, messageCallback, address, plugin, pollInterval)
if ( !_.isUndefined(mapping) ) {
instanceName = mapping.signalkId
}
}
}

if ( instanceName === undefined )
{
if ( plugin.options.useDeviceNames !== undefined && plugin.options.useDeviceNames && service.customName !== '' ) {
instanceName = service.customName
}
else
instanceName = service.deviceInstance
}

let entries

316 changes: 258 additions & 58 deletions index.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions ios.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,10 @@

const venusToDeltas = require('./venusToDeltas')

var vd = venusToDeltas({}, {usePosition:true})
//var vd = venusToDeltas({}, {usePosition:true})

global.toDelta = vd.toDelta
//global.toDelta = vd.toDelta

global.getToDelta = (putRegistrar) => {
return venusToDeltas({ supportsMetaDeltas: true }, {usePosition:true}, {}, putRegistrar).toDelta
}
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
{
"name": "signalk-venus-plugin",
"version": "1.30.2",
"version": "1.43.1",
"description": "Victron Venus-SignalK Integration",
"main": "index.js",
"dependencies": {
"camelcase": "^6.3.0",
"dbus-native": "^0.2.5",
"debug": "^3.1.0",
"lodash": "^4.17.4",
"mqtt": "^4.2.6",
"promise-retry": "^1.1.1"
"promise-retry": "^1.1.1",
"webpack-cli": "^5.1.4"
},
"devDependencies": {
"@signalk/github-create-release": "^1.2.1",
"@signalk/signalk-schema": "0.0.1-12",
"chai": "^4.1.2",
"chai-things": "0.2",
"mocha": "^4.0.1",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11"
"mocha": "^4.0.1"
},
"scripts": {
"test": "mocha",
"create-release": "github-create-release --owner sbender9 --repository signalk-venus-plugin",
"release": "git tag -d v$npm_package_version ; git tag v$npm_package_version && git push --tags && git push && npm run create-release",
"build_ios": "webpack ios.js -o ios_venus.js"
"build_ios": "webpack --mode development ./ios.js -o ios_venus.js",
"build_prod_ios": "webpack --mode production ./ios.js -o ios_venus.js"
},
"keywords": [
"signalk-node-server-plugin"
802 changes: 743 additions & 59 deletions venusToDeltas.js

Large diffs are not rendered by default.