SunPower ESS Mode Set Shell Script README
script: https://gist.github.com/koleson/d78da48497575455b9be6a3c96951bd1
other PVS6 hardware/software notes: https://gist.github.com/koleson/5c719620039e0282976a8263c068e85c
I don't have access to any SunPower GraphQL API docs. Solely reverse-engineered.
I'm not entirely convinced that SunPower's "Cost Savings" ESS control logic actually meaningfully Saves Costs reliably, so I generally use the following logic:
- Disallow discharge from midnight until 3PM ("Cost Savings")
- Allow discharge in "self-supply" from 3PM until midnight
- "Cost Savings" mode doesn't seem to discharge at all outside the small specified time-of-use window, and for the past several months, it barely seems to use the battery at all.
- "Self-supply" mode 'wastes' battery during off-peak overnight hours that could be profitably used during peak and super peak hours if the following day is cloudy.
It might be that some of the additional modes listed in the dl_cgi
API are useful
for this pattern, but without full documentation, using these modes heuristically
works well enough. For example, maybe MANUAL_CHARGE
would work.
The PVS dl_cgi
API docs, in Swagger json format, are included in the firmware images.
Most SunPower monitoring tasks are better done through the dl_cgi
API, as they can be
performed cloud-free. By contrast, there is no apparent dl_cgi
API to change the
operating mode of the SunVault ESS.
-
Every 6 months or so, my SunPower app stops working. I can log in, but I cannot see production or consumption data, and I cannot change my ESS discharge mode. The app assumes this is an "ICD"/"Internet Connection Down" situation and provides Wi-Fi troubleshooting steps, but my PVS6 is connected to the Internet via hard-wired permanent Ethernet cabling. SunPower support is unable to remotely troubleshoot this state, so my installer has to come on-site to validate that the PVS is in fact connected to the Internet and is on. From there, SunPower will allow an RMA of the PVS to solve the problem - no other repair or software fix is available. This requires another visit from my installer on another day, along with electricity being cut to my home during the relevant part of the replacement.
I am currently awaiting installation of my 5th PVS6.I am currently operating under my 5th PVS6.
Ironically, I've experienced more power-out hours due to this problem than I have due to the PG&E outages I bought the ESS to avoid.
UPDATE 6 July 2024: A new failure mode that made the power-out problem drastically worse:
the MID/MIDC will unexpectedly open the islanding contactor, resulting in the battery/inverter shutting down with faultF.72
(External AC Contactor Malfunction). This causes complete power loss to the home for about two minutes before the system resets. The frequency of these events seems to increase monotonically until a firmware update is performed - from once or twice a month, to once or twice a week, to daily, to multiple times a day. I was at 4 events per day when
installer updated the PVS6 firmware (onsite) and fixed the issue.For me, this issue started at the end of April 2024. I think this may have been a problematic automatic MIDC or PVS firmware update. My installer has updated the PVS and MIDC firmwares as of 1 July 2024; I will update this note if the issue recurs, but so far it has not.
Interestingly, SunPower wished to try resolving the issue with a replacement of the MID and MIDC; this wasn't possible as my installer has no inventory of MIDCs. Further, MIDCs seem to be in shortage nationally. The fact that they wanted to replace the MIDC rather than apply a firmware update suggests that either the firmware update does not contain a fix, or that the folks suggesting repairs don't know that the firmware contains a fix. Neither possibility is great!
I actually don't know if the script will work when the app stops working, but it's worth a try.UPDATE 6 July 2024: The script does not work when the app stops working. Updating firmware on the PVS6 solves several issues with nonresponsiveness, but SunPower, to date, hasn't provided a way for customers to update firmware themselves now that the installer / commissioning web flow has been removed. Installers have access to "Pro Connect" which can be used to update this firmware when onsite, which unfortunately means these firmware updates require a truck roll.
It is unclear if consumer/repair provider access to this tool is required by law under the California Right to repair Act (SB 244) which went into effect on 1 July 2024. If you find out, please let me know!
To date, I haven't figured out what device actually provides the charge/discharge controls.
Candidates include the MIDC (which is controlled by the PVS6 over RS-485) and
the Schneider Conext Gateway (which seems to be controlled via SunSpec / Modbus over TCP).
(The Conext Gateway transitively controls the XW Pro over Xanbus, but it's unclear how much
logic lives elsewhere. It could be that it is simply configured and most logic is on the
gateway.)
UPDATE 6 July 2024: The battery charge/discharge logic operates via Modbus over TCP by setting the mode, maximum charge,
and discharge levels on the XW Pro. The relevant Modbus registers are 40213, 40220, and 40221. The logic to set
these values seems to reside on the PVS6 which has the necessary information on production and consumption power.
The values are written to the registers every 10 seconds.
Ultimately, the goal is to remove all dependency on SunPower for control of the ESS mode, but at the moment I'm still under warranty so I don't want to dig too deeply in the running system. I have a spare PVS6 to experiment with, but it isn't connected to an actual ESS.
If you have any information on other ways to control the charge/discharge logic, please let me know!