Solar Protocol - Open API:V2 Documentation
This server is: {"name":"Solar Power for Artists"}
Note: This is the publicly available open-access API. Developers on the network can view the complete API documentation on Github.
Solar Protocol is a network of servers located all over the world. The primary server, which we call the "point of entry" or "POE", is determined by whichever server is in the most sunlight at a given time (determined by wattage scaled to a 50 watt module). The data returned from these GET requests pertains to the POE server only (calls to other servers in the system are explained below). This means that every call you make to the API might get a response from a different device with different values of data.
There are 2 main types of data this API provides:
- Charge controller data - This pertains to the PV system, such as solar power production, battery status, etc.
- System information - This pertains to local server info, such as location and hardware specs.
By default, these results are queried from the POE, which means the results may change if the POE changes. By using the server argument you can collect data from a specific server or from all the servers in the network. In this API explorer, the results from these API calls are displayed in the browser console. All times are in the timezone for the server that logged that data and have not been adjusted. Use the networkInfo = tz call to get the time zones to make the adjustments.
Using this API explorer
Enter the value you want return in the form provided. The syntax for the call will be show in the browser bar and the results of the call will open up in the browser console. The console can be opened via the browser's developer settings or by pression the Fn and F12 keys simultaniously (works on most browsers).
Charge Controller Data
Charge controller data:
- value: Individual pieces of data i.e. a single value like PV wattage or battery percentage.
- value & duration: Individual pieces of data over a particular length of time.
- line: Individual lines or a range of lines of data. Each line contains all the possible values for a particular time.
- day: An entire calendar day's worth of lines i.e. all the data collected on a particular date.
Value
value returns the specified value from the most recently collected line of data.
Example: http://solarprotocol.net/api/v2/opendata.php?value=PV-voltage
Possible values:
- PV-current
- PV-power-H
- PV-power-L
- PV-voltage
- battery-percentage
- battery-voltage
- charge-current
- charge-power-H
- charge-power-L
- load-current
- load-power
- load-voltage
- datetime
- scaled-wattage
Optional modifier: duration returns the specified value over a given amount of days, from 1 to 7.
Example: http://solarprotocol.net/api/v2/opendata.php?value=PV-voltage&duration=2
Response: { header : {datetime : PV-voltage}, data {[...]}}
Example: http://solarprotocol.net/api/v2/opendata.php?value=PV-current
Response: { "PV-current": "0.76" }
Line
line returns a line of data containing all of the possible values from the most recent file
Example: http://solarprotocol.net/api/v2/opendata.php?line=0
Possible values:
- len - returns the number of rows in the file
- head - returns the column headers
- [an integer from 0 through number if rows-1] - returns the specified line of data from the most recent day of data collected. For example, 0 will return the most recent row of data, 1 will return the 2nd most recent row, etc.
Day
day returns all the data from a specific day or range of days. Note that days may not be consequetive if the server was off for an extended period of time.
Example: http://solarprotocol.net/api/v2/opendata.php?day=2
Possible values:
- [an integer from 1-7] - returns the most recent X number of days of data. 1 returns the most recent day of data, 2 returns the most recent days of data, etc.
- list - Returns a list of all the available files. Each file represents 1 day of data.
- len - Return count of all available files. Each file represents 1 day of data.
- [file name without file type suffix] - Returns all the data from that particular day. Example: http://solarprotocol.net/api/v2/chargecontroller.php?day=tracerData2020-05-17
System Info
systemInfo returns information about the system and that server's local variables
Example: http://solarprotocol.net/api/v2/opendata.php?systemInfo=tz
Possible values:
- tz - returns the timezone for the server
- color - returns the color that was set by the steward
- description - returns the description of the server that was set by the steward
- name - returns the name for the server
- location - returns the location
- city - returns the city the server is located in
- country - returns the country the server is located in
- wattage-scaler -returns the scaler value based on a standard of a 50 watt module
- pvWatts -returns the wattage of the module
- pvVoltage - returns the voltage of the module
- dump - returns a dictionary containing all of the above system info
Network Info
networkInfo returns information about the network
Example: http://solarprotocol.net/api/v2/opendata.php?networkInfo=devices
Possible values:
- deviceList - returns a list of the names of servers
- tz - returns a list of the timezones of each server. This is the prefered way to get all the timezones (rather than making a tz call via the server argument)
- poe - returns the list of point of entry time stamps by server. note that these time stamps are in the local time of their server and haven't been adjusted.
- timestamp - returns the time stamp from when the devices most recently posted their data. Note that this time stamp is in Unix time - seconds since epoch (1/1/1970) in UTC regardless of the server's timezone.
- dump - returns an array containing all network info values
Remote Server Data
server returns 4 calendar days worth of data from the specified server.
Example: http://solarprotocol.net/api/v2/opendata.php?server=1
Possible values:
- all - returns the specified value for all servers
- an integer - the integer corresponds to the order of servers returned from the device list query. The call returns the specified value for the specified server
- server name without spaces - the name of the server (as listed in the deviceList query) with spaces removed. The call returns the specified value for the specified server. This is not case sensitive.
- If 'err' is returned it indicates a failed response, likely because the remote data for that server isn't stored locally.
API Response
API call:
http://solarprotocol.net/api/v2/opendata.php?
API response (also available in browser console):