Skip to content

Commit

Permalink
added soliscloud_station_index configuration item
Browse files Browse the repository at this point in the history
  • Loading branch information
ZuinigeRijder committed Jan 12, 2024
1 parent 3e4fa06 commit beda98e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# SolisCloud to PVOutput and/or Domoticz
Simple Python3 script to copy latest (normally once per 5 minutes) SolisCloud portal inverter update to PVOutput portal and/or Domoticz.

The soliscloud_to_pvoutput.py script will get the first station id with the secrets of SolisCloud (see next section). Thereafter it will get the inverter id and serial number via the configured SOLISCLOUD_INVERTER_INDEX (default the first inverter). Then in an endless loop the inverter details are fetched and the following information is used:
The soliscloud_to_pvoutput.py script will get the station id via the configured soliscloud_station_index (default the first station) with the secrets of SolisCloud (see next section). Thereafter it will get the inverter id and serial number via the configured soliscloud_inverter_index (default the first inverter). Then in an endless loop the inverter details are fetched and the following information is used:
* timestamp
* DC PV voltage (assuming no more than 4 strings)
* watt (current)
Expand Down Expand Up @@ -73,6 +73,7 @@ Change in soliscloud_to_pvoutput.cfg the following lines with your above obtaine
soliscloud_api_id = 1300386381123456789
soliscloud_api_secret = 304abf2bd8a44242913d704123456789
soliscloud_api_url = https://www.soliscloud.com:13333
soliscloud_station_index = 0
soliscloud_inverter_index = 0
pvoutput_api_key = 0f2dd8190d00369ec893b059034dde1123456789
pvoutput_system_id = 12345
Expand Down Expand Up @@ -145,14 +146,14 @@ Log files are written in the home subdirectory solis

Make 2 PVOutput accounts (you need 2 email addresses) for each inverter a separate PVOutput account. Make sure to configure the PVOutput accounts and get the PVOutput API keys.

The solution is to have 2 scripts running in different directories (one for each inverter) and for the each directory you do modifications, e.g. the configuration to get the appropriate inverter (setting soliscloud_inverter_index) and send the output to a appropriate PVOutput account as target.
The solution is to have 2 scripts running in different directories (one for each inverter) and for the each directory you do modifications, e.g. the configuration to get the appropriate station (setting soliscloud_station_index) and inverter (setting soliscloud_inverter_index) and send the output to a appropriate PVOutput account as target.

Create two directories, copy the SolisCloud2PVOutput files (soliscloud_to_pvoutput.py, soliscloud_to_pvoutput.cfg, solis.sh and logging_config.ini) to each directory and configure in each directory soliscloud_to_pvoutput.cfg:
- solis
- solis2

In solis2 directory you change the following:
- modify soliscloud_to_pvoutput.cfg to point the second PVOutput account secrets and change the soliscloud_inverter_index to 1 (to get the data of the second inverter)
- modify soliscloud_to_pvoutput.cfg to point the second PVOutput account secrets and change the soliscloud_station_index to 1 (to get the second station) and/or soliscloud_inverter_index to 1 (to get the data of the second inverter)
- rename solis.sh to solis2.sh and modify solis2.sh to go to directory solis2 (line 9: cd ~/solis2)

Have two cronrabs running (for solis.sh and solis2.sh)
Expand Down
1 change: 1 addition & 0 deletions soliscloud_to_pvoutput.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
soliscloud_api_id = 1300386381123456789
soliscloud_api_secret = 304abf2bd8a44242913d704123456789
soliscloud_api_url = https://www.soliscloud.com:13333
soliscloud_station_index = 0
soliscloud_inverter_index = 0
pvoutput_api_key = 0f2dd8190d00369ec893b059034dde1123456789
pvoutput_system_id = 12345
Expand Down
5 changes: 4 additions & 1 deletion soliscloud_to_pvoutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def get_bool(dictionary: dict, key: str, default: bool = True) -> bool:
SOLISCLOUD_API_ID = get(api_secrets, "soliscloud_api_id") # userId
SOLISCLOUD_API_SECRET = get(api_secrets, "soliscloud_api_secret").encode("utf-8")
SOLISCLOUD_API_URL = get(api_secrets, "soliscloud_api_url")
SOLISCLOUD_STATION_INDEX = int(get(api_secrets, "soliscloud_station_index", "0"))
SOLISCLOUD_INVERTER_INDEX = int(get(api_secrets, "soliscloud_inverter_index", "0"))
PVOUTPUT_API_KEY = get(api_secrets, "pvoutput_api_key")
PVOUTPUT_SYSTEM_ID = get(api_secrets, "pvoutput_system_id")
Expand Down Expand Up @@ -213,7 +214,9 @@ def get_inverter_list_body() -> str:
"""get inverter list body"""
body = '{"userid":"' + SOLISCLOUD_API_ID + '"}'
content = get_solis_cloud_data(USER_STATION_LIST, body)
station_info = json.loads(content)["data"]["page"]["records"][0]
station_info = json.loads(content)["data"]["page"]["records"][
SOLISCLOUD_STATION_INDEX
]
station_id = station_info["id"]

body = '{"stationId":"' + station_id + '"}'
Expand Down

0 comments on commit beda98e

Please sign in to comment.