Victron Energy protocol integration with emonhub

Hi Folks,

I recently wanted to add DC monitoring capabilities to my emon, to do this I purchased an off the shelf Victron BMV-700 that does highside DC monitoring and a Isolated USB cable (https://www.victronenergy.com/battery-monitors/bmv-700)

I connected this to my emonpi through the usb port and wrote a quick interfacer that will read from the serial and decode the VEDirect protocol.

Data coming from the BMV looks like this

2016-02-19 08:14:15,527 DEBUG    BMV        14 NEW FRAME : {'FW': '0307', 'SOC': '1000', 'Relay': 0, 'PID': '0x203', 'H10': '6', 'BMV': '700', 'TTG': '-1', 'H12': '0', 'H18': '0', 'I': '0', 'H11': '0', 'Alarm': 0, 'CE': '-7', 'H17': '9', 'P': '0', 'AR': '0', 'V': '25996', 'H8': '29011', 'H9': '49382', 'H2': '-7', 'H3': '0', 'H1': '-1633', 'H6': '-5781', 'H7': '17453', 'H4': '0', 'H5': '0'}

An explanation of the terms can be found here:

'com.victronenergy.battery': {
    '/ProductId': {'code': 'BM', 'whenToLog': 'configChange'},
    '/FirmwareVersion': {'code': 'BV', 'whenToLog': 'configChange'},
    '/Serial': {'code': 'BSN', 'whenToLog': 'configChange'},
    '/Dc/0/Voltage': {'code': 'V', 'whenToLog': 'onIntervalAlways', 'precision': 2},
    '/Dc/1/Voltage': {'code': 'VS', 'whenToLog': 'onIntervalAlways', 'precision': 2},
    '/Dc/0/Current': {'code': 'I', 'whenToLog': 'onIntervalAlways', 'precision': 2},
    '/Dc/0/Temperature': {'code': 'BT', 'whenToLog': 'onIntervalAlways', 'precision': 0},
    '/Dc/0/MidVoltage': {'code': 'VM', 'whenToLog': 'onIntervalAlways', 'precision': 2},
    '/Dc/0/MidVoltageDeviation': {'code': 'VMD', 'whenToLog': 'onIntervalAlways', 'precision': 1},
    '/ConsumedAmphours': {'code': 'CE', 'whenToLog': 'onIntervalAlways', 'precision': 2},
    '/Soc': {'code': 'SOC', 'whenToLog': 'onIntervalAlways', 'precision': 1},
    '/TimeToGo': {'code': 'TTG', 'whenToLog': 'onIntervalAlways', 'precision': 3},
    '/Alarms/LowVoltage': {'code': 'AL', 'whenToLog': 'onIntervalAlwaysAndOnEvent'},
    '/Alarms/HighVoltage': {'code': 'AH', 'whenToLog': 'onIntervalAlwaysAndOnEvent'},
    '/Alarms/LowStarterVoltage': {'code': 'ALS', 'whenToLog': 'onIntervalAlwaysAndOnEvent'},
    '/Alarms/HighStarterVoltage': {'code': 'AHS', 'whenToLog': 'onIntervalAlwaysAndOnEvent'},
    '/Alarms/LowSoc': {'code': 'ASoc', 'whenToLog': 'onIntervalAlwaysAndOnEvent'},
    '/Alarms/LowTemperature': {'code': 'ALT', 'whenToLog': 'onIntervalAlwaysAndOnEvent'},
    '/Alarms/HighTemperature': {'code': 'AHT', 'whenToLog': 'onIntervalAlwaysAndOnEvent'},
    '/Alarms/MidVoltage': {'code': 'AM', 'whenToLog': 'onIntervalAlwaysAndOnEvent'},
    '/Alarms/LowFusedVoltage': {'code': 'ALF', 'whenToLog': 'onIntervalAlwaysAndOnEvent'},
    '/Alarms/HighFusedVoltage': {'code': 'AHF', 'whenToLog': 'onIntervalAlwaysAndOnEvent'},
    '/Alarms/FuseBlown': {'code': 'AFB', 'whenToLog': 'onIntervalAlwaysAndOnEvent'},
    '/Alarms/HighInternalTemperature': {'code': 'AHIT', 'whenToLog': 'onIntervalAlwaysAndOnEvent'},
    '/Relay/0/State': {'code': 'Relay', 'whenToLog': 'onIntervalAlwaysAndOnEvent'},
    '/History/DeepestDischarge': {'code': 'H1', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/LastDischarge': {'code': 'H2', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/AverageDischarge': {'code': 'H3', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/ChargeCycles': {'code': 'H4', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/FullDischarges': {'code': 'H5', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/TotalAhDrawn': {'code': 'H6', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/MinimumVoltage': {'code': 'H7', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/MaximumVoltage': {'code': 'H8', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/TimeSinceLastFullCharge': {'code': 'H9', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/AutomaticSyncs': {'code': 'H10', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/LowVoltageAlarms': {'code': 'H11', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/HighVoltageAlarms': {'code': 'H12', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/LowStarterVoltageAlarms': {'code': 'H13', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/HighStarterVoltageAlarms': {'code': 'H14', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/MinimumStarterVoltage': {'code': 'H15', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/MaximumStarterVoltage': {'code': 'H16', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/LowFusedVoltageAlarms': {'code': 'H17', 'whenToLog': 'onIntervalOnlyWhenChanged'},
    '/History/HighFusedVoltageAlarms': {'code': 'H18', 'whenToLog': 'onIntervalOnlyWhenChanged'},
    '/History/MinimumFusedVoltage': {'code': 'H19', 'whenToLog': 'onIntervalOnlyWhenChanged'},
    '/History/MaximumFusedVoltage': {'code': 'H20', 'whenToLog': 'onIntervalOnlyWhenChanged'},
    '/History/DischargedEnergy': {'code': 'H21', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2},
    '/History/ChargedEnergy': {'code': 'H22', 'whenToLog': 'onIntervalOnlyWhenChanged', 'precision': 2}

You can simply add the following configuration in the emonhub.conf and the following node porfile

[[BMV]]
    Type = EmonHubVEDirectInterfacer
    [[[init_settings]]]
        com_port = /dev/ttyUSB0
        com_baud = 19200
        toextract = SOC,CE,TTG,V,I,Relay,Alarm #which vales to extract from data packet not all are needed
    [[[runtimesettings]]]
        nodeoffset = 9 #make sure this matches with nodename below
        pubchannels = ToEmonCMS,
        subchannels = ToSerial,
        basetopic = emonhub/

and add a node that looks like

[[9]]
    nodename = emonDC
    firmware =V1_6_emonTxV3_4_DiscreteSampling
    hardware = emonTx_(NodeID_DIP_Switch1:ON)
    [[[rx]]]
       names = SOC,CE,TTG,V,I,Relay,Alarm
       datacode = 0
       scales = 0.1,1,1,1,0.001,1,1
       units =%,Ah,s,V,A,S,S                   #FirmwareV1.6

 

I'd be happy to push this code into the next build of emonhub as it's a modular addition and  I know a lot of people want an easy DC monitoring solution as they use Batteries with their systems.

All the best,

Alp

TrystanLea's picture

Re: Victron Energy protocol integration with emonhub

Hello Alp, nice work!

Yes if youd like to send a pull request through to the emonhub repository here, I'd be happy to include http://github.com/openenergymonitor/emonhub

atilev's picture

Re: Victron Energy protocol integration with emonhub

Sent a PR : )

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.