Unofficial tests of apparent Sunpower API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Gemfile
Gemfile.lock
README.org
sunpower.rb

README.org

Sunpower

https://codeclimate.com/github/jeffkowalski/sunpower/badges/gpa.svg

API

API point: https://monitor.us.sunpower.com/CustomerPortal

Services mapped from dataServices.js:

AUTH: 'Auth/Auth.svc/',
AUTHENTICATION: 'Auth/Authentication.svc/',
SYSTEM_INFO: 'SystemInfo/SystemInfo.svc/',
CURRENT_POWER: 'CurrentPower/CurrentPower.svc/',
SITE_INFO: 'SiteInfo/SiteInfo.svc/',
ALERTS_INFO: 'AlertsInfo/AlertsInfo.svc/',
ALERTS: 'Alerts/Alerts.svc/',
NOTIFY: 'Notify/Notify.svc/',
BILL_SAVINGS: 'BillSavings/BillSavings.svc/',
CUSTOMER_INFO: 'CustomerInfo/CustomerInfo.svc/',
SITE_LIST: 'SiteList/SiteList.svc/',
CONFIG: 'Config/Config.svc/',
REFERRALS: 'Referrals/Referrals.svc/',
SCHEDULE: 'Schedule/Schedule.svc/'

Notable services

https://monitor.us.sunpower.com/CustomerPortal/Auth/Auth.svc/help https://monitor.us.sunpower.com/CustomerPortal/Auth/Auth.svc/help/operations/Authenticate https://monitor.us.sunpower.com/CustomerPortal/CurrentPower/CurrentPower.svc/help https://monitor.us.sunpower.com/CustomerPortal/CurrentPower/CurrentPower.svc/help/operations/GetCurrentPower https://monitor.us.sunpower.com/CustomerPortal/SystemInfo/SystemInfo.svc/help https://monitor.us.sunpower.com/CustomerPortal/SystemInfo/SystemInfo.svc/help/operations/getHourlyEnergyData

Real time net display

Helpers

Example credentials file

---
username: "username"
password: "password"
isPersistent: true

get credentials

require 'yaml'
require 'json'
p YAML.load_file(file).to_json

get json value

require 'json'
result = JSON.parse(string)
name.split('.').each { |key| result = result[key] }
p result

pretty-print json

(json-reformat-from-string data)

Authenticate

curl -H "Content-Type:application/json" -X POST -d "$credentials" https://monitor.us.sunpower.com/CustomerPortal/Auth/Auth.svc/Authenticate

Get Current Power

curl --silent "https://monitor.us.sunpower.com/CustomerPortal/CurrentPower/CurrentPower.svc/GetCurrentPower?id=$token"

Get Hourly Energy Data

curl --silent "https://monitor.us.sunpower.com/CustomerPortal/SystemInfo/SystemInfo.svc/getHourlyEnergyData?tokenid=$token&timestamp=2016-08-08T00:00:00"

The payload is string with an array of “|”-delimited records. Each record has the following comma-separated fields:

bttimestamp of sampleYYYY-MM-DDTHH:MM:SS
epenergy producedfloat kWh
euenergy usedfloat
mpunknownfloat