Getting local access to SunPower PVS6 data

Tinkering with my new solar system. The install includes a fancy SunPower monitoring system called a PVS6. SunPower has a decent website which gives you current conditions and hourly history of energy production. But I want more detailed data! And thanks to this guide I’ve got access and am starting to unpack what all is there. This GitHub project also has lots of notes and this PDF is quite detailed.

Access to monitoring data

The PVS6 has a web server with stats you can access over the network. The trick is you have to use the LAN1 installer port to get to it. You don’t want to just plug it into your network; it has a DHCP server of its own that might make mischief. So instead I set up a Raspberry Pi with haproxy to forward HTTP requests to the PVS6. The guide I followed has detailed instructions and now I have access to the PVS6 web API.

So what’s there? The notes here are a detailed guide. The main command for monitoring is DeviceList. Apparently most of the data updates every 15 seconds. The JSON output is complicated, but it boils down to a block for the PVS itself, a block for each CT sensor measuring overall electricity flow, and a block for each inverter (28 microinverters for me). Note it’s pretty slow, about 6-7 seconds to answer a DeviceList query.

The numbers I get from the PVS6 do seem to match what SunPower shows me in their consumer app.

sunpower-pvs-exporter

At this point I took a left turn and decided to install this monitoring setup. It’s a Python project that creates a Prometheus service from the PVS6 data, which Telegraf can import. The project also includes some Grafana dashboards. Looks nice!

I installed sunpower-pvs-exporter directly on the Raspberry Pi, no need for haproxy in the path. Then I set up telegraf to query it (just need to configure the URL) and insert the data in to InfluxDB. The resulting schema is a bit messy; Grafana is now polluted with lots of measurements with names like sunpower_pvs_power_meter_net_energy_watt_hours. And a whole lot more series inside that, and the values all are named “gauge”. Not awesome but I can work with it.

Unfortunately importing the sample dashboards from the project did not work. Some config did come through but not the queries. (Schema mismatch?) I hand-edited a few and got some stuff working but it’s not great. Also the schema is not a great match for Grafana so the queries are pretty contorted. All told I got discouraged at this point; if I’m going to have to do this much hand-work I might as well write my own code to pull data straight from the PVS6 JSON and output it in nicely aggregated Influx format.

Mysteries

My solar install has something weird; their estimate of my usage is wrong. They seem to think that in the middle of the day I’m using 6kW, 3-4x more than I use. Also usage goes up with solar power. I think maybe the CT sensors aren’t installed correctly. Or maybe this has something to do with not being fully activated at PG&E? The electric meter display looks correct, just not the SunPower monitoring, so I’m thinking I have an install problem.

The other confusion is arithmetic. I have one CT power meter labelled “GROSS_PRODUCTION_SITE” and one labelled “NET_CONSUMPTION_LOADSIDE”. That’s what’s graphed in the picture above, those two numbers. But note that’s net consumption; if you want gross consumption you need to add those two numbers. That’s baked in to the sunpower-pvs-exporter’s queries but it confused me at first. Particularly since my net consumption numbers from the power meter seem to be wrong.

jq

I took a quick crack at getting basic wattage output with JQ. This dumps the wattage of all the things in my report; the two meters and also the individual inverters.

jq '[.devices[1:][].p_3phsum_kw? | tonumber * 1000 | round] | @csv'

p_3phsum_kw appears to be the actual AC power production. I assume that means “3 phase sum”. It seems to account for reactive loads.

Thoughts

At this point I’m declaring victory for the day. I’ve got access to the data. I still need a system to massage it and import it into InfluxDB and I don’t think sunpower-pvs-exporter is it for me. Too many problems. Telegraf’s JSON plugin might be sufficient but I’ll probably end up writing my own Python code so I can massage things as desired. In particular I’m trying to think how to handle the data streams for all 28 inverters, that seems a bit unwieldy.