Skip to content

Commit

Permalink
api documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexnathanson committed Sep 2, 2021
1 parent 13ef7c2 commit 3f84207
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions frontend/api/v1/chargecontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
"location" => $infoArray["location"],
"city" => $infoArray["city"],
"country" => $infoArray["country"],
"wattage-scaler" => wattageScaler(),
"pvWatts" => $infoArray["pvWatts"],
"pvVolts" => $infoArray["pvVolts"]);
echo json_encode($infoDump);
Expand Down
16 changes: 12 additions & 4 deletions frontend/api/v1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@ <h1>Solar Protocol - Open API Documentation</h1>
Note: This is the publicly available open-access API, developers on the network can view the complete API documentation on <a href="https://github.com/alexnathanson/solar-protocol/blob/master/API.md" target="_blank">Github</a>.
</p>

There are 4 types of data this interface provides.
<p>
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. The data returned from these GET requests pertains to the POE server only. This means that every call you make to the API might get a response from a different device with different values of data.
</p>

There are 4 types of data this API provides:
<ol>
<li>Individual values</li>
<li>Individual pieces of data from the charge controller for PV, battery, and load status</li>
<li>Individual lines of data containing all the given values for a particular time</li>
<li>An entire day's worth of data</li>
<li>System information</li>
</ol>
The results from these API calls are displayed in the browser console. (fn + f12 to open console on most browsers)
All of these results are only for the current primary server. The results from these API calls are displayed in the browser console. (fn + f12 to open console on most browsers)

<h2>Value</h2>
<strong>value</strong> returns the specified value from the most recently collected line of data.
Expand All @@ -43,6 +47,7 @@ <h2>Value</h2>
<li>load-power</li>
<li>load-voltage</li>
<li>datetime</li>
<li>scaled-wattage</li>
</ul>
</p>
Optional modifier: <strong>duration</strong> returns the specified value over a given amount of days, from 1 to 7.
Expand Down Expand Up @@ -93,7 +98,7 @@ <h2>Day</h2>

<h2>System Info</h2>

<strong>systemInfo</strong> returns information about the system.
<strong>systemInfo</strong> returns information about the system and that server's local variables
<p>Example: <a href="http://solarprotocol.net/api/v1/chargecontroller.php?systemInfo=tz" target="_blank">http://solarprotocol.net/api/v1/chargecontroller.php?systemInfo=tz</a></p>
<p>Possible values:
<ul>
Expand All @@ -104,6 +109,9 @@ <h2>System Info</h2>
<li>location - returns the location</li>
<li>city - returns the city the server is located in</li>
<li>country - returns the country the server is located in</li>
<li>wattage-scaler -returns the scaler value based on a standard of a 50 watt module</li>
<li>pvWatts -returns the wattage of the module</li>
<li>pvVoltage - returns the voltage of the module</li>
<li>dump - returns a dictionary containing all of the above system info</li>
</ul>
</p>
Expand Down
4 changes: 4 additions & 0 deletions featureUpdateLog.md → updateLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Software Update Log

## 9/1/21

Cleaned up repository and added documentation

## 8/31/21

refactored solarprotocol.py, created a DNS gateway on that will enable a lot more future functionality and network reliability (such as managing DNS access, distributing access lists, and taking on some 3rd party functions like public IP identification, started messing around with an ascii visualization of the network (which has been added to the admin console).
Expand Down

0 comments on commit 3f84207

Please sign in to comment.