question

jonoci avatar image
jonoci asked

Can I save data read from a modbus device via Cerbo_GX and node red onto my local PC drive.

I am collecting data from a device using Modbus TCP/IP via the Cerbo GX and Node Red. I use the CSV and WRITE FILE Nodes to do this, but the write file gives:

"failed to append to file: Error: EACCES: permission denied, open 'c:\users\Public\Logfile'"

On the PC I use https://venus.local:1881/ to get into the node red editor - all that works as does the rest of my flow. But I cannot write data to a local drive. Is there a way to do this? Do I have to write data to the Cerbo local storage device ( SD Card)? If so, How do I address it to write to it and read back from it? I am trying to log data used by my Heat pump on Modbus, and correlate that with my PV system to optimize use of excess PV

Modbus TCP
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

4 Answers
matt1309 avatar image
matt1309 answered ·

Hi,

Just to check I'm understanding, you've got a Node that's supposed to save log files down in the location c:\users\Public\Logfile'

If that's the case, you're right, Node Red is running on the cerbo gx and not on you local machine the path you described is a windows path (guessing that's your local machine).

Node red wont have access to that location as it's on a completely different devices (ie your PC rather than the cerbo where Node red is running).

I'm unfamiliar with writing to log files on Node rec however I believe Cerbo runs a form of embedded linux, therefore paths wont be of that form. It'll be more like

/home/root/ (with root being the user)

However as you mention you'll still have the issue of the data now being stored on the wrong system, there are loads of ways around this but not sure which you'll find easiest.

You could let the data store on CerboGX if you have enough storage and periodically download it to your machine via sftp (if you enable root access ssh on cerbo gx device).

Alternatively you can setup a network share on your local machine and have node red connect to that and store the data on local PC. You could also keep your PC on 24/7 to capture modbus data or use another raspberry pi or equivalent to capture that data.


2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

mondeoman avatar image
mondeoman answered ·

You can also run Node-RED on your PC and connect to the GX device via ModbusTCP and save data locally on your PC.

In your local Node-RED installation, you need to install the node-red-contrib-victron-modbus library of nodes (it's actually just one node). Then enable ModbusTCP services on the GX device and connect to it remotely from your PC. You also need to put the correct attributes file on your pc in:

c:\opt\victronenergy\dbus-modbustcp\attributes.csv

This file can be obtained from your GX device (ideally) or from Victron's GitHub page.

See here for more information: https://github.com/dirkjanfaber/node-red-contrib-victron-modbus

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

jonoci avatar image
jonoci answered ·

Thanks to both off you.

I have not been successful in sharing the network so that the Cerbo can see/connect to it - I dug a lot on internet but have not found how to do that.

I then installed node red on the local PC and loaded all the Modbus TCP nodes as they were in the VRM/node red setup. I was then able to save via a write-file node to a local file in .csv. This will be acceptable, although a little tedious in data analysis. I was hoping to have Victron energy graphs, Power meter graphs, PV energy , etc, all aligned on the same page with TCP heatpump data for analysis. It's not critical - will be a few weeks of statistical analysis of data to 'tune' the PV energy usage, and then its done and won;t be looked at much again.

Thanks again Chaps.


1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

matt1309 avatar image matt1309 commented ·
Hey,



Sounds like you've got your solution or at least someway of managing the task but I thought of a few alternative solutions that may be helpful.



Solution 1:

Using victron system/custom drivers.

If the data you need from heat pump is just power consumed. You could add a energy meter compatible with cerbo gx (et112 for example) and set the meter as "AC load" monitor in cerbo gx. That way vrm would monitor load used by heat pump in vrm.

Similarly you could use node red to edit the modbus tcp data from heatpump to mimic a modbus tcp energy meter supported by cerbo gx to send the data in cerbo gx. (you may need to look into adding custom drivers for a device to be recognised if you go the route of almost spoofing an energy meter if that makes sense.Won't need to do that if you use actual meter ie et112)

Could do similar with temperature data if heatpump data also send that. Again you'll need a custom driver I believe to add a temp sensor device to cerbo gx given there's not a real physical supported temp sensor just a heat pump temp data. Victron has a template of custom driver that should help as a good starting point if this is a route you prefer.



Solution 2 this one works for all data not just temp and power consumption but is more involved.

I'd setup an influx database (or some other time series database). And send both solar data from cerbo gx and the heatpump data to the database (heatpump data I'd gather via cerbo gx node red and forward onto wherever influxdb is installed)


I'd then view the data in the influxdb using grafana and setup the graphs/layouts I'd want in grafana. That way you've got victron data and heat pump data in one database (influxdb) and one layout/interface (grafana)


Definitely not worth setting up the above if you're doing some one time analysis but if you were looking for a longer term automated solution that's probably the way I'd go about it.


I'm not sure if opkg (package manager for Linux) has grafana and influxdb that you could maybe run on cerbo gx but that's grtting experimental. A seperate machine is probably safer/easier.

0 Likes 0 ·
jonoci avatar image
jonoci answered ·

Matt, thank you for your further thoughts!

The heat pump power in is monitored via a seperate energy meter - that is already read by the Cerbo via modbus.

The data I am wanting from the heatpump is it's determination of outside air temp, the heatpump out and in flow water temps ( water to the underfloor heating system), and the heatpump determined COP value. This gives me a picture of heatpump perfomance versus PV energy available and heating put into the floors...

The heat pump has an ethernet interface box ( for installer remote service capability), and that box is also a Modbus TCP access to the heatpump modbus parameters mentioned above. The network to Cerbo and the Heatpump internet box (and my local PC) is common, and so I use the node red Modbus nodes to read the relevant heatpump addresses and pull the required data. All the solar energies, energy meter data, ie, general Victron/PV/Energy data is graphed and viewed on the Victron VRM portal, but not the heatpump stuff...I can plot heatpump info on the Node Red dashboard for, say, the last 24 hours, but older than that then then falls off the page and is gone. Its good enough for daily analysis, but comparisons over longer periods are difficult. I am not good at Linux, or the deep internals of Cerbo world, and don't want to break it, so climbing in with some of your ideas is a bit scary at the moment..!

I don't wish to get to hung up on analysing excessively - the way I have it will be 'good enough', but I am also enjoying learning more as I go.

Thanks again Matte


1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

matt1309 avatar image matt1309 commented ·

No worries. Think mondeoman has the best solution for you then. That way you wont be editing anything on cerbo and limits use of any further code/linux other than Node red which you're using already.

0 Likes 0 ·

Related Resources