from environment.js
w.__envapidom = 'https://elhapi.edp.sunpower.com/';
from envcfg.js:
__env = {
SP_ELH_VERSION: 'SP_ELH_VERSION_2', // SP_ELH_VERSION must match SP_ELH_VERSION lambda variable in ElhApi cloudformation
ELH_API_USER: w.__envapidom + 'v1/elh/user/',
ELH_API_ADDRESS: w.__envapidom + 'v1/elh/address/',
ELH_API_ADDRESS_V2: w.__envapidom + 'v2/elh/address/',
ELH_API_ASYNC_RESULT: w.__envapidom + 'v1/elh/asyncResult',
ELH_API_PASSWORD_RESET: w.__envapidom + 'v1/elh/passwordreset/',
ELH_API_AUTHENTICATE: w.__envapidom + 'v1/elh/authenticate',
ELH_API_SESSION: w.__envapidom + 'v1/elh/session',
ELH_API_AUTHENTICATEKIOSK: w.__envapidom + 'v1/elh/authenticatekiosk',
ELH_API_FEEDBACK: w.__envapidom + 'v1/elh/processFeedback',
ELH_API_CHECK_EMAIL: w.__envapidom + 'v1/elh/register/checkEmail',
ELP_API_VALIDATE_SN: w.__envapidom + 'v1/elh/register/validateSerial/',
ELH_API_CREATE_ACCOUNT: w.__envapidom + 'v1/elh/register/createAccount',
ELH_API_SEND_ACCOUNT_NOTIFICATION: w.__envapidom + 'v1/elh/register/sendAccountNotification',
ELH_API_VALIDATE_EMAIL: w.__envapidom + 'v1/elh/register/validateEmail',
ELH_API_COLLECTOR: w.__envapidom + 'v1/elh/wifi/collector',
ELH_API_DEVICE_STATUS: w.__envapidom + 'v1/elh/wifi/status',
ELH_API_WIFI_NETWORKS: w.__envapidom + 'v1/elh/wifi/networks',
ELH_API_SET_WIFI_NETWORK: w.__envapidom + 'v1/elh/wifi/setNetwork',
ELH_API_SET_WIFI_NETWORK_STATUS: w.__envapidom + 'v1/elh/wifi/setNetwork/status',
ELH_API_TOU: w.__envapidom + 'v1/elh/tou',
ELH_API_SET_TOU: w.__envapidom + 'v1/elh/setTou',
ELH_API_REFERRAL: w.__envapidom + 'v1/elh/referral'
};
---
username: "username"
password: "password"
isPersistent: true
require 'yaml'
require 'json'
p YAML.load_file(file).to_json
require 'json'
result = JSON.parse(string)
name.split('.').each { |key| result = result[key] }
p result
(json-reformat-from-string data)
curl -H "Content-Type:application/json" -X POST -d "$credentials" "$api/authenticate"
curl --silent --header "Authorization: SP-CUSTOM $token" "$api/address/$address/activity?async=false"
curl --silent --header "Authorization: SP-CUSTOM $token" "$api/address/$address/alerts?async=false"
curl --silent --header "Authorization: SP-CUSTOM $token" "$api/address/$address/components"
Returns the “current” power. The time of the reading is not specified, and I’ve noticed these are often quite stale.
curl --silent --header "Authorization: SP-CUSTOM $token" "$api/address/$address/power?async=false"
curl --silent --header "Authorization: SP-CUSTOM $token" "$api/address/$address/energy/hour?async=false&startepm=1565805600000"
The payload is an array of string records. Each record has the following comma-separated fields:
timestamp of sample | YYYY-MM-DDTHH:MM:SS |
energy produced | float kWh |
curl --silent --header "Authorization: SP-CUSTOM $token" "$api/address/$address/energy/minute?endepm=1565827200000&startepm=1565740800000"
The payload is an array of string records. Each record has the following comma-separated fields:
timestamp of sample | YYYY-MM-DDTHH:MM:SS |
energy produced | float kWh |
curl --silent --header "Authorization: SP-CUSTOM $token" "$api/wifi/status?cacheBreaker=1565824273640&serialNumber=ZT163185000441C1876"