diff --git a/soliscloud/soliscloud.py b/soliscloud/soliscloud.py
--- a/soliscloud/soliscloud.py
+++ b/soliscloud/soliscloud.py
#
@@ -44,6 +44,19 @@ import datetime
#
+ ''' Build a dict of configuration settings based on environment variables
#
+ "api_id" : int(os.getenv("API_ID", 1234)),
#
+ "api_secret" : os.getenv("API_SECRET", "abcde"),
#
+ "api_url" : os.getenv("API_URL", "https://tobeconfirmed")
#
def createHMAC(signstr,secret,algo):
#
''' Create a HMAC of signstr using secret and algo
#
@@ -112,6 +125,46 @@ def doAuth(key_id, secret, req_path, req_body, method="POST", content_type="appl
#
+def fetchStationList(config, session):
#
+ ''' Fetch the list of stations.
#
+ In the Solicloud UI these are referred to as plants
#
+ Basically, the site at which devices are deployed.
#
+ So, if you had multiple inverters in one location this
#
+ would return the total values
#
+ TODO: may want to implement iterating through pages at some
#
+ # Construct the request body
#
+ req_body = json.dumps(req_body_d)
#
+ req_path = "/v1/api/userStationList"
#
+ # Construct an auth header
#
+ auth_header = doAuth(config['api_id'], config['api_secret'], req_path, req_body)
#
+ # Construct headers dict
#
+ "Authorization" : auth_header,
#
+ "Content-Type" : "application/json"
#
+ url = f"{config['api_url']}{req_path}",
#
@@ -128,3 +181,7 @@ if __name__ == "__main__":
#
content_type="application/json",
#
datestring='Fri, 26 Jul 2019 06:00:46 GMT')
#
+ session = requests.session()
#
+ config = configFromEnv()
#
+ stations = fetchStationList(config, session)