Monitoring a SunPower Solar System

[Update: Here is a new Node-RED flow that works better with Home Assistant’s Energy Dashboard.]

After years of waffling on if I should install solar on my house, I finally decided that it would be a good investment. While the federal tax credit went down from 30% to 26%, I would still get a bit of my investment back. The tax credit goes to 22% next year and then goes away, so if I didn’t make the leap now, I’m not sure financially it would make sense for a long time until the panel prices come way down.

Like most major investments, I did a significant amount of research. I got proposals from 9 companies using a variety of panels and inverters. For better or worse, I went with a SunPower system. SunPower wants to make it easy for people to see how much energy they are producing and their monitoring site has a very, very simple dashboard. Apparently their older dashboard (still available via a different URL that uses Flash) showed output on a per panel basis. When I asked SunPower about this, here was their response:

Unfortunately, our monitoring website only shows production data of the system as a whole. Inverter level monitoring was only offered to dealers for troubleshooting and/or repair purposes. This was not offered to homeowners because, after lengthy evaluation, that feature offers more information than is necessary to monitor ongoing system performance, but not enough information to help identify problems (on the rare occasions when they do occur). We also had concerns about the feature’s design, in part due to negative feedback from customers.

After a bit of research, I found that the monitoring device (PVS6) actually has the ability to be queried for local data. An individual with better hacking/detective skills than me figured out the commands to send to the unit and posted information on GitHub describing the setup. That looked pretty straight forward. So I decided to figure out how to integrate it into Home Assistant and into my Grafana graphs.

First step was to configure a Raspberry Pi as basically a bridge where HTTP requests sent to one port would be redirected out the other port. I didn’t need a full fledged router for this, just an HTTP proxy. I decided to use a Raspberry Pi Zero W that I had lying around as a base. I ordered an Ethernet adapter for it and that was it for hardware. My son designed a case for both pieces and I 3D printed it.

Configuring the Raspberry Pi

  1. Download the Raspberry Pi Imager
  2. Select the Raspbian Lite image.
  3. Write the image to an SD card.
  4. Create a file called wpa_supplicant.conf at the root of the image with the following:
    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    country=US
    
    network={
     ssid="<Name of your WiFi>"
    psk="<Password for your WiFi>"
    }
    
  5. Add a file called ssh at the root of the image. This file should be empty.
  6. Assign a static IP address mapping on your router for the Pi.
  7. Boot the Raspberry Pi. Login using username: pi password: raspberry
  8. Update the OS using
    sudo apt-get update
    
  9. Install ha-proxy
    sudo apt-get install haproxy
    
  10. Modify /etc/dhcpcd.conf by adding the following so that the Ethernet going to the PVS6 doesn’t attempt to setup a gateway. If this happens, the Pi no longer responds over WiFi.
    interface eth0
    nogateway
    
  11. Add the following to /etc/haproxy/haproxy.cfg:
    frontend http-in
        bind *:80
        default_backend backend_servers
    
    backend backend_servers
        server sv1 172.27.153.1:80
    
    listen stats
        bind *:8080
        stats enable
        stats uri /
        stats refresh 10s
        stats admin if LOCALHOST
    
  12. Reboot the Pi.

Now when you issue HTTP calls to the Pi, they’ll goto the PVS6.

Setting up Home Assistant

I use Node-RED for most of my automations, so the following is how I poll the PVS6 from Node-RED.

Node-RED PVS6

Basically what I do is make an HTTP call to the Raspberry Pi over the WiFi interface that redirects to the PVS6. Using the information from the GitHub repo I found, the call is: http://10.0.3.55/cgi-bin/dl_cgi?Command=DeviceList

I then parse out the different devices that are returned (one for each inverter, one for the monitoring unit, one for the consumption meter and one for the production meter). My installer didn’t hook up the consumption meter, but I use an older version of the Rainforest Automation EAGLE-200 to connect to my electric meter and get consumption data.

This Node-RED flow generates multiple sensors that can then be used to display data right in Home Assistant or in Grafana. There is more information in the output than I need such as AC voltage, DC voltage, AC current, DC, current, etc. I use Home Assistant’s HTTP interface to create new sensors and since I have no idea how fast it can respond, I rate limit the updating of the sensors.

You can download my Node-RED flow from here.

Grafana

I’m going to leave it as an exercise for the reader to setup pretty pictures in Grafana. I’ve setup a basic dashboard and some other graphs. The per panel graphs are useful to tell me if a panel isn’t operating properly. While SunPower doesn’t really want you to know this information, it is very helpful. My system was turned on (my installer and SunPower can remotely disable my system which really bothers me) yesterday and I noticed that 1 of the panels wasn’t generating power. This amounts to about 8% of my overall system; most people wouldn’t know this which makes it even more important to be able to get status on a per panel basis.

Energy Dashboard

Energy Usage

Per Panel Monitoring

Conclusion

I’ve written up this guide to help others, but also to refresh my memory in the future to figure out what I did. My home automation system is growing more and more complex by the day and if I don’t document at least parts of it, I’ll never be able to troubleshoot it.

Feel free to ask questions or provide comments.

206 Replies to “Monitoring a SunPower Solar System”

  1. What tool do you use to generate a request? In Chrome developer tools, if you right click on “components”, hover over “Copy” to get the list, and then for example choose “Copy as cURL (cmd)”. You can use that to run a cURL command. Or I use Postman and import the cURL to set up the request.

    Looks like the authentication times out after some period which means you’ll need to sign in again and grab the new token, or you can trace the sign in, locate the “authenticate” call, and copy that into a request.

  2. can you given and example of a cURL command you are using? I’m confused by the content of the “Copy as cURL (cmd)”.

  3. You should design an app and sell it for money I would definitely be interested. I’m just surprised no one has created a 3rd party app.

  4. How do you power the raspberry pi? The PVS5x/PVS6 usually mount near the breaker panel or power company meter on the outside of your house unless you are running a long ethernet cable from LAN1 port on the PSV5x/PVS6 to bring the signal inside the house to the pi. Is this how you have your pi power? inside the house or outside near the PVS5x/PVS6?

    1. Hi Hai,

      My PVS6 is located in my garage and I have Ethernet runs from my switch out to the garage. I’ve located my Pi in my equipment rack, so I just power it right at the switch. I’ve read that others use one of the USB ports on the PVS6.

  5. I would pay MONEY for this as a third party app. I played around with setting this up but I don’t understand network traffic well enough to build this out without haproxy. For some reason I can’t run haproxy as I have a Pi running Pi-hole.

  6. Scott, this is an amazing article and I’m glad to see someone take initiative to be able to get the data they are seeking.

    It’s a bit weird to me that SunPower would not provide that information to Homeowners due to the fact that it’s more information than needed. Again, I’m quite impressed with the alternative you have provided and it’s something worth the test.

  7. Fairly new PVS6 installation running Build 9210. DeviceList does not show any of the micro inverters. Just the Supervisor, the Production(p?) and Consumption(c?), Am I missing something or has something changed where SunPower is restricting that information?

          1. You can try configuring your PVS6 but you probably will not be able to save the changes. You should request your installer claim your inverters as they did not finish your installation. You could just ask them to verify your panels as you suspect one of them is not working. They will not be able to do this unless they finish your installation and claim your inverters. You can try claiming your inverters yourself by entering:
            http://172.27.153.1/#/landing choose “residential”
            Click “continue”
            It will display a notice that SP is shutting down this app.
            It will then check the firmware
            Click “continue”
            Choose “yes” “updating existing site”
            Select your device and site then click “continue”
            Click “rediscover”
            Click “discover” it may take awhile as is discovers your devices
            After it is done it will take you back to the same screen
            Click “configure” your panels should show up
            Click “done” at bottom of page
            It will take you back to the same page
            Click “continue”
            Your inverters will be claimed
            Click “continue”
            Your devices should all show up and you can click on them to get additional information.
            When you click “continue” it will ask you to login but you will not be able to as you need an installer password & user name. So you probably will not be able to save the changes but at least you can see them this way.

  8. I got this working well and get data for about 12 hours, then the Pi started getting 503 errors when accessing the ConnectedDevices end point. A reboot of the pi fixes it but its frustrating to have to do that so often. Any idea where to start to debug this issue?

  9. My system does not have any power measuring devices for production (only consumption.) So I assume the supervisor lifetime energy is simply summing what is reported by the inverters. I am curious why the energy reported by supervisor is 1.6% less than the sum of the energy values reported by the inverters. I would think it would match exactly. Any idea?

    1. My only guess is that it is calculating total energy based on the periodic power values received from the inverters instead of summing the inverters’ reported energy values. This won’t be as accurate as I assume the inverters are reporting true energy based on nearly continuous power output over time and not just samples taken every longer time interval.

  10. Yes. I believe it’s an error caused by the sampling rate of the monitor versus the rate at which the inverters produce energy (i.e. continuously) – probably “aliasing error”.

  11. Anyone know what causes the gaps in the daily SunPower data? It occurs at the same time in my real-time readout.
    Trying to attach a screenshot but how?

  12. Awesome stuff. Is step 10 necessary if I ran haproxy from a docker container off my NAS instead of a PI? Not well versed in any of this so if you have any suggestions I would appreciate it.

    1. I’m not sure if step 10 is necessary, but I used it in my original setup and my current setup (a Pi 2 B with Ethernet and a USB Ethernet dongle) and things are working fine. I’d suggest using it if there is an issue.

        1. Hi Jeffrey,

          You’ll want to make sure that MQTT is setup and integrated. If you’re not familiar with MQTT, you might want to go back to the old flow and just add customizations to make it work with the energy dashboard, but that’s not the route I took.

  13. Hi Scott,

    I’ve been trying to set this up and educating myself along the way. I’m running into an issue with MQTT, and wondering if you could share some of your settings/setup details.

    Since I’m doing this all in containers on my pi, the add-ons are not available. My HA instance cannot connect to the running MQTT server, and I’m a bit lost as to why.

    Thanks.

    1. I’m using HassOS (or whatever it is called these days), so I just use the add-ons. It makes things super easy. Unfortunately I didn’t like containers as it required too much maintenance, so I don’ve have any suggestions. Sorry.

  14. Dang. I’ve been using Balena Cloud to maintain my pi projects, and while I enjoy the pipeline aspects it’s proving to be more of a hinderance for this project than a benefit. Quite unfortunate that the AH add-ons are not available in container environments.

    1. Well, I finally figured out what was going on (kind of). MQTT 2.x containers default to a local only mode, which breaks them. There should be config work-arounds that would allow for anonymous connections, and force listening on the right port/interface, but I couldn’t get them to work correctly. Ultimately I was able to get mqtt to do its job by reverting to an older image.

      Now it’s time to figure out how to config HA’s energy monitoring and/or graphana to display the panel level data I’m interested in.

      Thanks a ton for your writeup.

  15. Another quick follow-up. How were you able to configure the native HA energy dashboards? Node-red does not appear to be configuring the right entities to populate them as shown in your image as configured. Did you happen to make changes to get the right entities to populate as energy statistics?

      1. Interesting. Do you have any sensors other than the PVS6 that are being polled for consumption (as it relates to grid/solar – I see you have some other stuff going on there)?

  16. It seems I don’t have a /etc/dhcpcd.conf file. I am running the latest raspbian release. Any idea why that might not be there?

  17. I wanted to setup the RPi solution and did quite a bit of research and captured everything I found in one document. (Got this working easily and integrated with HA). It includes detailed API documentation for both the direct connection to the PVS6 as well as the Web site API. This can save people from having to wade through all the comments and multiple web sites: https://starreveld.com/PVS6%20Access%20and%20API.pdf

  18. I purchased a raspberry pie zero for this. A bit concerned leaving it in the PVS6 since it will be enclosed. I live in Phoenix so summers are brutal. I am new to raspberry pi but my gut says this might be a fire hazard. I plan on running this 24/7 do what reliability or fire risk is this setup?

  19. I think the system time is GMT. Is this a correct assumption?
    I notice if I am pulling the data at say 12:00 noon my time but the system show CURTIME as 19:00 and DATATIME at a little bit before 19:00. So it looks like 7 hrs ahead of my time which is GMT for my time zone.

    1. I believe this is correct. Just now I pulled from my PVS6 at 12:25 PM PDT and it returned 2021,11,03,19,25,58 which corresponds to UTC (we don’t call it GMT anymore 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.