Community
OpenEnergyMonitor

Community

Emoncms + Victron CCGX + My Battery App

Hello all,

I have recently built and installed a ESS recently consisting of a 4.8Kwh Battery, Victron Multiplus 2 with a Colour Control GX as a web interface.

With the new release of the My Battery App im trying to figure a way of importing the SOC of the battery into my inputs on my Emonhub which is a Rpi 3b.

I have a good read at the interfer page (link below) and tried writing my own in the emon config but I cannot get them to show up via modbus tcp. I have modbus tcp enabled and I am looking at specific registers in Home assistant.

I think another interfer via modbus for the CCGX would be great. especially with the roll out of the My Battery App.

This the following code i edited but didnt work.

[[ModbusTCP]]    
    Type = EmonModbusTcpInterfacer
    [[[init_settings]]]
         modbus_IP = 192.168.0.80
         modbus_port = 502          # Portclient listens on
    [[[runtimesettings]]]
         register = 843
         rType = uint16
         # nodeid used to match with node definition in nodes section below. Can be set to any integer value not previously used.
         nodeId = 27
         # Channel to publish data to should leave as ToEmonCMS
         pubchannels = ToEmonCMS,            
         interval = 1

[[27]]
     nodename = Multiplus
     [[[rx]]]
       names = Battery_State_of_Charge
       datacodes = 0
       scales = 1
       units = %

See modbus link for registers below.

https://www.victronenergy.com/live/ccgx:modbustcp_faq

Any help or feedback would be great :slight_smile:

Thanks

Gareth

Can you post the emonhub log - set the log level to DEBUG first. Post a section of log from restarting the emonhub service please.

Hi,

Thanks for the quick reply. Heres a snapshot.

2020-07-04 20:10:07,324 DEBUG    RFM2Pi     acknowledged command: > 0q
2020-07-04 20:10:07,326 DEBUG    MainThread Setting MQTT subchannels: ['ToEmonCMS']
2020-07-04 20:10:07,328 DEBUG    MainThread Setting MQTT pubchannels: ['ToRFM12']
2020-07-04 20:10:07,329 INFO     MainThread Setting MQTT nodevar_format_enable: 1
2020-07-04 20:10:07,330 INFO     MainThread Setting MQTT node_format_enable: 1
2020-07-04 20:10:07,331 INFO     MainThread Setting MQTT nodevar_format_basetopic: emon/
2020-07-04 20:10:07,332 INFO     MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg' 
2020-07-04 20:10:07,334 DEBUG    MainThread Setting emoncmsorg subchannels: ['ToEmonCMS']
2020-07-04 20:10:07,335 DEBUG    MainThread Setting emoncmsorg pubchannels: ['ToRFM12']
2020-07-04 20:10:07,336 INFO     MainThread Setting emoncmsorg url: https://emoncms.org
2020-07-04 20:10:07,336 INFO     MainThread Setting emoncmsorg senddata: 1
2020-07-04 20:10:07,337 INFO     MainThread Setting emoncmsorg apikey: set
2020-07-04 20:10:07,338 INFO     MainThread Setting emoncmsorg sendstatus: 1
2020-07-04 20:10:07,339 INFO     MainThread Creating EmonModbusTcpInterfacer 'ModbusTCP' 
2020-07-04 20:10:07,341 ERROR    MainThread PYMODBUS NOT PRESENT BUT NEEDED !!
2020-07-04 20:10:07,341 DEBUG    MainThread Setting ModbusTCP rType: uint16
2020-07-04 20:10:07,342 DEBUG    MainThread Setting ModbusTCP interval: 1
2020-07-04 20:10:07,343 DEBUG    MainThread Setting ModbusTCP nodeId: 27
2020-07-04 20:10:07,343 DEBUG    MainThread Setting ModbusTCP pubchannels: ['ToEmonCMS']
2020-07-04 20:10:07,344 DEBUG    MainThread Setting ModbusTCP register: 843
2020-07-04 20:10:07,428 DEBUG    RFM2Pi     device settings updated: E i5 g210 @ 433 MHz
2020-07-04 20:10:07,529 DEBUG    RFM2Pi     acknowledged command: > 1p
2020-07-04 20:10:07,834 DEBUG    RFM2Pi     acknowledged command: <nn> i     - set node ID (standard node ids are 1..30)
2020-07-04 20:10:07,938 DEBUG    RFM2Pi     acknowledged command: <n> b      - set MHz band (4 = 433, 8 = 868, 9 = 915)
2020-07-04 20:10:08,041 DEBUG    RFM2Pi     acknowledged command: <nnnn> o   - change frequency offset within the band (default 1600)
2020-07-04 20:10:08,254 DEBUG    RFM2Pi     acknowledged command: <nnn> g    - set network group (RFM12 only allows 212, 0 = any)
2020-07-04 20:10:08,360 DEBUG    RFM2Pi     acknowledged command: <n> c      - set collect mode (advanced, normally 0)
2020-07-04 20:10:08,572 DEBUG    RFM2Pi     acknowledged command: ...,<nn> a - send data packet to node <nn>, request ack
2020-07-04 20:10:08,678 DEBUG    RFM2Pi     acknowledged command: ...,<nn> s - send data packet to node <nn>, no ack
2020-07-04 20:10:08,784 DEBUG    RFM2Pi     acknowledged command: <n> q      - set quiet mode (1 = don't report bad packets)
2020-07-04 20:10:08,892 DEBUG    RFM2Pi     acknowledged command: <n> x      - set reporting format (0: decimal, 1: hex, 2: hex+ascii)
2020-07-04 20:10:09,207 DEBUG    RFM2Pi     acknowledged command: <hchi>,<hclo>,<addr>,<cmd> f     - FS20 command (868 MHz)
2020-07-04 20:10:09,314 DEBUG    RFM2Pi     acknowledged command: <addr>,<dev>,<on> k              - KAKU command (433 MHz)
2020-07-04 20:10:09,520 DEBUG    RFM2Pi     device settings updated: E i5 g210 @ 433 MHz
2020-07-04 20:10:09,627 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 9 64 240 193 38 8 142 20 112 0 216 20 150 123 32 8 8 71 60 4 241 (-92)
2020-07-04 20:10:09,733 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 13 17 20 234 48 124 0 0 193 150 204 168 128 (-93)
2020-07-04 20:10:12,071 DEBUG    RFM2Pi     7 NEW FRAME : OK 10 198 1 0 0 16 0 2 0 40 94 48 117 48 117 48 117 (-38)
2020-07-04 20:10:12,074 DEBUG    RFM2Pi     7 Timestamp : 1593893412.07
2020-07-04 20:10:12,075 DEBUG    RFM2Pi     7 From Node : 10
2020-07-04 20:10:12,076 DEBUG    RFM2Pi     7    Values : [454, 0, 16, 2, 241.04, 3000, 3000, 3000]
2020-07-04 20:10:12,077 DEBUG    RFM2Pi     7      RSSI : -38
2020-07-04 20:10:12,077 DEBUG    RFM2Pi     7 Sent to channel(start)' : ToEmonCMS

Thanks Gareth

First problem! Always look for errors in log files!!

Quick search on the community for pymodbus throws up this answer

You need to restart the service once installed…

sudo systemctl restart emonhub.service

However, I think the RFM2Pi config might be wrong - can you post that part of the config as well please.

Do you have an emonBase card? if not comment out the RFM2Pi interfacer config.

Hi,

Thanks I will do that from now on :slight_smile:

I enabled SSH today and used the command sudo apt-get install python3-pymodbus . I got an error. Pymodbus is not located in the package.

Ive had a look on github but not sure which one to add to the sd card .

Could you point me in the right direction of what file i need to add to the sd card please?

Cheers

Gareth

Try doing sudo apt update first although another user has had an issue with this.

Hi,

Got myself into a bit of mess with the ‘sudo apt update’. I was running the 2018 emonbase sd card image and the discrete sampling software on my emontxv3 and the ‘sudo apt update’ stalled half way through :frowning:

Tried to reboot and nothing…

So I reflashed the emonbase sd card with the lastest 2019 image and uploaded the latest continuous monitoring firmware onto the emontx. All the input were present and working.

I then used putty to complete the sudo apt update and it all updated and installed pymodbus. Will have a play this weekend and see if I can get the victron modubus registering on the input page.

I will keep you update :slight_smile:

cheers

1 Like

Its much easier to activate mqtt on the venus and use mqtt.
After that use nodered or any parser to get the desired values…

I might have a go with MQTT. I dont have node red running on anything atm.

I have pymodbus up and running now, but more errors. Can seem to find the answer to this one. See below.

My code in the emonhub config is this.

[[ModbusTCP]]    
    Type = EmonModbusTcpInterfacer
    [[[init_settings]]]
         modbus_IP = 192.168.0.80
         modbus_port = 502          # Portclient listens on
    [[[runtimesettings]]]
         rName = Battery State of Charge (System), Battery Voltage (System)
         register = 843, 840
         nReg = 1, 1
         rType = uint16, uint16
         # nodeid used to match with node definition in nodes section below. Can be set to any integer value not previously used.
         nodeId = 27
         # Channel to publish data to should leave as ToEmonCMS
         pubchannels = ToEmonCMS,            
         interval = 10

[[27]]
     nodename = Multiplus
     [[[rx]]]
       names = Battery State of Charge (System), Battery Voltage (System)
       datacodes = H, H
       scales = 1, 10
       units = %, V

any help would be much appreciated :slight_smile:

cheers

Edit - formatted tex. BT, Moderatorr

HI all,

For those who have a CCGX connected to a multiplus/quattro and want to read registers via Modbus TCP and import them to the inputs page of emoncms. I have worked out the code that is required for the config file in the interfacers section of the emonhub.

As @James_Hill mentioned the unit ID must be included as there is multiple unit ID’s/slaves on the Victron VE Bus system. See below.

I wanted the SOC and charge/discharger power feed for the My Solar & Battery app.

[[ModbusTCP]]    
    Type = EmonModbusTcpInterfacer
    [[[init_settings]]]
         modbus_IP = 192.168.x.x
         modbus_port = 502         
     [[[runtimesettings]]]
         rName = Battery State of Charge (System), Input Voltage Phase 1, Grid Power, Battery Power, 
         register = 31, 4, 821, 843
         nReg = 1,1,1,1
         nUnit = 239, 239, 100, 100
         rType = uint16, uint16, uint16, int16
         nodeId = 27
         pubchannels = ToEmonCMS,            
         interval = 10

[[27]]
     nodename = Multiplus
     [[[rx]]]
       names = Battery State of Charge (System), Input Voltage Phase 1, Grid Power, Battery Power, 
       datacodes = H,H,h,h
       scales = 0.1,0.1,1,1
       units = %, V, W, W

Cheers

Gareth

1 Like