jeffkowalski / sunpower

Unofficial tests of apparent Sunpower API
41 stars 9 forks source link

cumulative energy production #1

Closed humbeecc closed 7 years ago

humbeecc commented 7 years ago

Thanks for finding out about the api!

Any idea how to get the cumulative energy production for a system? Maybe by calling the downloadEnergyOvertimeHistoricData or downloadHistoricData endpoints, but they don't return anything, probably because of wrong parameters.

Thanks in advance, Chris.

jeffkowalski commented 7 years ago

Thanks for your interest, Chris. Take a look at the new commit. It looks like the Sunpower web portal doesn't really expect the server to compute the cumulative energy production, but instead sums the values of the hourly data. I've included some code to do the same.

humbeecc commented 7 years ago

Thanks for the code Jeff. I was already doing something similar, more precisely adding the daily data to calculate the total produced energy. But for some reason it doesn't match the overall total value on the website and on the lcd panel :-(

To be a bit more specific, the overall value on the lcd panel matches the value on https://www.sunpowermonitor.com/partner/ and https://be.sunpowermonitor.com/residential, but not the one on https://monitor.us.sunpower.com (lifetime energy produced). The last one matches the computed one (adding all daily values)

It looks like the overall value from the lcd panel comes directly from the SMA inverters.

A bit confused...

jeffkowalski commented 7 years ago

Regrettably, the sunpowermonitor pages are all flash-based, so they're too opaque for me to learn more about the protocol. By contrast, the monitor.us.sunpower.com portal is straightforward modern javascript, and the unencrypted source leads clearly to the services in use.