Skip to content

Commit beda98e

Browse files
committed
added soliscloud_station_index configuration item
1 parent 3e4fa06 commit beda98e

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# SolisCloud to PVOutput and/or Domoticz
1515
Simple Python3 script to copy latest (normally once per 5 minutes) SolisCloud portal inverter update to PVOutput portal and/or Domoticz.
1616

17-
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:
17+
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:
1818
* timestamp
1919
* DC PV voltage (assuming no more than 4 strings)
2020
* watt (current)
@@ -73,6 +73,7 @@ Change in soliscloud_to_pvoutput.cfg the following lines with your above obtaine
7373
soliscloud_api_id = 1300386381123456789
7474
soliscloud_api_secret = 304abf2bd8a44242913d704123456789
7575
soliscloud_api_url = https://www.soliscloud.com:13333
76+
soliscloud_station_index = 0
7677
soliscloud_inverter_index = 0
7778
pvoutput_api_key = 0f2dd8190d00369ec893b059034dde1123456789
7879
pvoutput_system_id = 12345
@@ -145,14 +146,14 @@ Log files are written in the home subdirectory solis
145146

146147
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.
147148

148-
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.
149+
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.
149150

150151
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:
151152
- solis
152153
- solis2
153154

154155
In solis2 directory you change the following:
155-
- 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)
156+
- 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)
156157
- rename solis.sh to solis2.sh and modify solis2.sh to go to directory solis2 (line 9: cd ~/solis2)
157158

158159
Have two cronrabs running (for solis.sh and solis2.sh)

soliscloud_to_pvoutput.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
soliscloud_api_id = 1300386381123456789
33
soliscloud_api_secret = 304abf2bd8a44242913d704123456789
44
soliscloud_api_url = https://www.soliscloud.com:13333
5+
soliscloud_station_index = 0
56
soliscloud_inverter_index = 0
67
pvoutput_api_key = 0f2dd8190d00369ec893b059034dde1123456789
78
pvoutput_system_id = 12345

soliscloud_to_pvoutput.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def get_bool(dictionary: dict, key: str, default: bool = True) -> bool:
4646
SOLISCLOUD_API_ID = get(api_secrets, "soliscloud_api_id") # userId
4747
SOLISCLOUD_API_SECRET = get(api_secrets, "soliscloud_api_secret").encode("utf-8")
4848
SOLISCLOUD_API_URL = get(api_secrets, "soliscloud_api_url")
49+
SOLISCLOUD_STATION_INDEX = int(get(api_secrets, "soliscloud_station_index", "0"))
4950
SOLISCLOUD_INVERTER_INDEX = int(get(api_secrets, "soliscloud_inverter_index", "0"))
5051
PVOUTPUT_API_KEY = get(api_secrets, "pvoutput_api_key")
5152
PVOUTPUT_SYSTEM_ID = get(api_secrets, "pvoutput_system_id")
@@ -213,7 +214,9 @@ def get_inverter_list_body() -> str:
213214
"""get inverter list body"""
214215
body = '{"userid":"' + SOLISCLOUD_API_ID + '"}'
215216
content = get_solis_cloud_data(USER_STATION_LIST, body)
216-
station_info = json.loads(content)["data"]["page"]["records"][0]
217+
station_info = json.loads(content)["data"]["page"]["records"][
218+
SOLISCLOUD_STATION_INDEX
219+
]
217220
station_id = station_info["id"]
218221

219222
body = '{"stationId":"' + station_id + '"}'

0 commit comments

Comments
 (0)