Inverter polling software for Linux

nrm21

Member
Joined
Jan 4, 2018
Messages
116
I've forked a project I found on github and made some mods to it so that it polls a voltronic inverter and spits out the values received to standard out in JSON format. The program is written in C++, requires no external dependencies and is very light weight. In fact I helped develop it to compile and run on my Raspberry Pi 1 B+. The point of it is to use some other program to run it and handle it's output. For instance I use telegraf's exec plugin to run the program once every 15 seconds and take it's output and send to an InfluxDB instance where I can later graph it with something else (grafana).

Also the program can be used to send raw commands to the inverter (some examples given in the programs help). Anyway I have been using it for half a month now and I figured I'd share it if anyone else wants to try it out.

https://github.com/nrm21/skymax-demo
 
Nice. Thanks for the contribution! :D
 
Thx, I also forgot to mention that you do need to apt-get (or yum) install cmake (gcc and make should already be on there) before you compile on whatever linux platform you have, but otherwise there aren't any per-compile complexities.
 
Nice contribution. If you dont want to run the Json things i did this is a simple and small addition for sure!
 
Not sure what you as asking/telling.

The program has no JSON parse or generate libraries in it, it just does a simple printf() into the JSON structure needed. Very simple and not even quotes on the field values. Telegraf ignores fields that are string anyway unless they are tagged in the telegraf config so it's kinda pointless.

Of course this could all be written in but I'm trying to keep very lightweight. The program is for very slow embedded devices like RasbPi Gen1. And I don't want non-"linux cli" people to be to intimidated by having to apt-get a million things before they can recompile successfully.

BTW, I added a bin to the repo so one doesn't need to compile for RasPiB+
 
nrm What I said is that I have one made as well but that one is made in NodeJs that is for instance included in the Grafana project :) Nothing towards urs since the advantage of yours is that yours is alot smaller and will run on gen1 that mine potentially can have issues :p
 
Ahh ok.

Yes I tried yours out and to your credit, it did work. But I couldn't figure out why the InfluxDB was not accepting its data. I still think your's is a more complete solution (with Batrium support and all that), mine is just for people having trouble because of less powerful hardware than 1GB memory. :)
 
Yeah for that yours is better. You can of course only run the NodeJS thingy but it takes some effort to have it running compare to pre compiled that you got..
 
Got your skymax program working with telegraf to import it into influxdb to work with daromer's pi build.

Just in case if anyone wants the telegraf.conf file, here's the configs I had to change. It took me a while to figure out the last line for the data_format should be json. It was influxdb by default and I couldn't figure out why it wasn't parsing!

# Configuration for telegraf agent
[agent]
## Default data collection interval for all inputs
interval = "15s"
## Rounds collection interval to 'interval'
## ie, if interval="10s" then always collect on :00, :10, :20, etc.
round_interval = true


[[outputs.influxdb]]
## The full HTTP or UDP URL for your InfluxDB instance.
##
## Multiple URLs can be specified for a single cluster, only ONE of the
## urls will be written to each interval.

urls = ["http://localhost:8086"]

## The target database for metrics; will be created as needed.

database = "telegraf"

[[inputs.exec]]
# ## Commands array

commands = [
"/opt/skymax/bin/skymax"
]

# ## Timeout for each command to complete.
timeout = "8s"
#
name_override = "powerwall"

# ## measurement name suffix (for separating different commands)
# name_suffix = ""

#
# ## Data format to consume.
# ## Each data format has its own unique set of configuration options, read
# ## more about them here:
# ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
data_format = "json"


Also I noticed you had a fudge factor for the pv_input_watts and you made the same mistake as I did thinking that the pv_input_current was actually the current from the PV. It's actually the current going into the battery. So you should be multiplying it by the scc_voltage, not pv_input_voltage. It will get you closer to the number that is displayed on the unit screen.

pv_input_watts = (scc_voltage * pv_input_current) * wattfactor;
 
nrm21 said:
I've forked a project I found on github and made some mods to it so that it polls a voltronic inverter and spits out the values received to standard out in JSON format. The program is written in C++, requires no external dependencies and is very light weight. In fact I helped develop it to compile and run on my Raspberry Pi 1 B+. The point of it is to use some other program to run it and handle it's output. For instance I use telegraf's exec plugin to run the program once every 15 seconds and take it's output and send to an InfluxDB instance where I can later graph it with something else (grafana).

Also the program can be used to send raw commands to the inverter (some examples given in the programs help). Anyway I have been using it for half a month now and I figured I'd share it if anyone else wants to try it out.

https://github.com/nrm21/skymax-demo

Hi,

Could you add support for the MPI 5Kwh and 10Kwh inverters?
 
Not easily since I don't have one to test and play with. However a quick google seems to show it working with the watchpower program so it seems it uses the same modbus commands. So I don't see why it wouldn't work with that also as is. Have you tried it?
 
10kw mpi is not same as the PIP. Different protocols. The V series is another one too and it differs quite a lot in how it handles CRC commands.
 
nrm21 said:
Not easily since I don't have one to test and play with. However a quick google seems to show it working with the watchpower program so it seems it uses the same modbus commands. So I don't see why it wouldn't work with that also as is. Have you tried it?

My inverter is in a remote location which I don't visit often, with a PC or laptop permanently connected to it. So I want to monitor it with a Raspberry Pi remotely. Watchpower does work, but then I need to leave my laptop there. And the logging isn't very good, IMO
 
SiverNodashi said:
nrm21 said:
Not easily since I don't have one to test and play with. However a quick google seems to show it working with the watchpower program so it seems it uses the same modbus commands. So I don't see why it wouldn't work with that also as is. Have you tried it?

My inverter is in a remote location which I don't visit often, with a PC or laptop permanently connected to it. So I want to monitor it with a Raspberry Pi remotely. Watchpower does work, but then I need to leave my laptop there. And the logging isn't very good, IMO
Hi..
Same case... Hybrid V series.. can't comunicate.. because not pip or 10k protocol.. thanks a lot.. reading your comments I get experience
 
nrm21 said:
I've forked a project I found on github and made some mods to it so that it polls a voltronic inverter and spits out the values received to standard out in JSON format. The program is written in C++, requires no external dependencies and is very light weight. In fact I helped develop it to compile and run on my Raspberry Pi 1 B+. The point of it is to use some other program to run it and handle it's output. For instance I use telegraf's exec plugin to run the program once every 15 seconds and take it's output and send to an InfluxDB instance where I can later graph it with something else (grafana).

Also the program can be used to send raw commands to the inverter (some examples given in the programs help). Anyway I have been using it for half a month now and I figured I'd share it if anyone else wants to try it out.

https://github.com/nrm21/skymax-demo

Hi nrm21,

Can skymax-demo poll more than 1 inverter at the same time?
 
Silver No. You need to run several instances of it.
 
Correct, you need to run difference instances of it on different '/dev/hidraw' devices.
 
not2bme said:
Got your skymax program working with telegraf to import it into influxdb to work with daromer's pi build.

Just in case if anyone wants the telegraf.conf file, here's the configs I had to change. It took me a while to figure out the last line for the data_format should be json. It was influxdb by default and I couldn't figure out why it wasn't parsing!

# Configuration for telegraf agent
[agent]
## Default data collection interval for all inputs
interval = "15s"
## Rounds collection interval to 'interval'
## ie, if interval="10s" then always collect on :00, :10, :20, etc.
round_interval = true


[[outputs.influxdb]]
## The full or UDP URL for your InfluxDB instance.
##
## Multiple URLs can be specified for a single cluster, only ONE of the
## urls will be written to each interval.

urls = [""]

## The target database for metrics; will be created as needed.

database = "telegraf"

[[inputs.exec]]
# ## Commands array

commands = [
"/opt/skymax/bin/skymax"
]

# ## Timeout for each command to complete.
timeout = "8s"
#
name_override = "powerwall"

# ## measurement name suffix (for separating different commands)
# name_suffix = ""

#
# ## Data format to consume.
# ## Each data format has its own unique set of configuration options, read
# ## more about them here:
#
data_format = "json"


Also I noticed you had a fudge factor for the pv_input_watts and you made the same mistake as I did thinking that the pv_input_current was actually the current from the PV. It's actually the current going into the battery. So you should be multiplying it by the scc_voltage, not pv_input_voltage. It will get you closer to the number that is displayed on the unit screen.

pv_input_watts = (scc_voltage * pv_input_current) * wattfactor;


Thanks for posting this. I hope this is not the wrong place to ask. But skymax cpp is actually one of the very very few means of interacting with the axpert inverter via linux or the Rpi. I was wondering if you guys have found away to get it to post to emoncms using json. I got close to doing this by addingsnprintf to the original code, however the major problem I had was getting skymax to run when the system powers up. I tried adding it to /etc/rc.local , creating init.d script and adding it as a run script to udev rules. I could not get it to run on system start. I was wondering if I could se telegraf to formart the script and send it to emoncms

 
Best way would be to edit the source code to get it to output JSON the way you want (using sprintf type commands directly). Telegraf could maybe modify the output on the fly, but this would be wonky and hackish (if it can be done at all).

Not sure how exactly "getting it to run on startup" would help. The program is coded to run, spit out the values at that moment, and exit. It's designed/intended to be called over and over from another program/script/cron at some interval rather than run once at startup.
 
Back
Top