diff --git a/venusToDeltas.js b/venusToDeltas.js index 4a8f669..9b0f827 100644 --- a/venusToDeltas.js +++ b/venusToDeltas.js @@ -134,6 +134,19 @@ module.exports = function (app, options, handleMessage) { } } ], + '/Link/NetworkStatus': [ + { + path: m => { + return makePath(m, `${m.instanceName}.mode`) + }, + conversion: convertNetworkStatus + }, + { + path: m => { + return makePath(m, `${m.instanceName}.modeNumber`) + } + } + ], '/ErrorCode': { path: m => { return 'notifications.' + makePath(m, `${m.instanceName}.error`) @@ -821,12 +834,10 @@ const stateMaps = { 'com.victronenergy.alternator': { 0: 'off', - 1: 'bulk', - 2: 'absorbtion', + 3: 'bulk', + 4: 'absorbtion', 5: 'float', - 7: 'Ext Control', - 8: 'disabled', - 9: 'float' + 252: 'Ext. Control' }, 'com.victronenergy.dcdc': { @@ -837,7 +848,27 @@ const stateMaps = { 7: 'Ext Control', 8: 'disabled', 9: 'float' - } + }, + + 'com.victronenergy.battery': { + 0: 'initializing', + 1: 'initializing', + 2: 'initializing', + 3: 'initializing', + 4: 'initializing', + 5: 'initializing', + 6: 'initializing', + 7: 'initializing', + 8: 'initializing', + 9: 'running', + 10: 'error', + 12: 'shutdown', + 13: 'updating', + 14: 'standby', + 15: 'going to run', + 16: 'pre-charging', + 17: 'contactor check' + } } function senderNamePrefix (senderName) { @@ -880,15 +911,9 @@ const modeMaps = { 5: 'eco' }, 'com.victronenergy.battery': { - 0: 'sleep', - 1: 'hibernation', - 2: 'standby', - 3: 'on' - }, - 'com.victronenergy.alternator': { - 0: 'standalone', - 1: 'master', - 2: 'slave' + 3: 'on', + 4: 'off', + 252: 'Standby' }, 'com.victronenergy.dcdc': { 0: 'standalone', @@ -897,13 +922,19 @@ const modeMaps = { } } +const networkStatusMaps = { + 'com.victronenergy.alternator': { + 0: 'standalone', + 1: 'master', + 4: 'slave' + }, +} + const statePropName = { 'com.victronenergy.vebus': 'chargingMode', 'com.victronenergy.charger': 'chargingMode', 'com.victronenergy.solarcharger': 'controllerMode', 'com.victronenergy.inverter': 'inverterMode', - 'com.victronenergy.battery': 'mode', - 'com.victronenergy.alternator': 'chargingMode', 'com.victronenergy.dcdc': 'chargingMode' } @@ -916,6 +947,11 @@ function convertMode (msg) { return (modeMap && modeMap[Number(msg.value)]) || 'unknown' } +function convertNetworkStatus (msg) { + var networkStatusMap = networkStatusMaps[senderNamePrefix(msg.senderName)] + return (networkStatusMap && networkStatusMap[Number(msg.value)]) || 'unknown' +} + const acinSourceMap = { 1: 'grid', 2: 'genset',