Git Product home page Git Product logo

zuinigerijder / soliscloud2pvoutput Goto Github PK

View Code? Open in Web Editor NEW
15.0 4.0 5.0 1.64 MB

Simple Python3 script to copy latest (normally once per 5 minutes) SolisCloud portal inverter update to PVOutput portal, Domoticz, and/or MQTT Broker (e.g. HomeAssistant, ioBroker).

License: Apache License 2.0

Python 96.90% Shell 3.10%
pvoutput python solis-pv-inverters soliscloud solis raspberry-pi domoticz

soliscloud2pvoutput's People

Contributors

josephw avatar zuinigerijder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

soliscloud2pvoutput's Issues

socket.timeout: The read operation timed out

My python script stopped working yesterday after running for a few months without a problem:

socket.timeout: The read operation timed out

Apparently not all exceptions are catched in the urlopen call.
Stacktrace:

Traceback (most recent call last):
  File "/home/rick/solis/soliscloud_to_pvoutput.py", line 210, in <module>
    main_loop()
  File "/home/rick/solis/soliscloud_to_pvoutput.py", line 154, in main_loop
    content = get_solis_cloud_data(INVERTER_DETAIL, inverter_detail_body)
  File "/home/rick/solis/soliscloud_to_pvoutput.py", line 95, in get_solis_cloud_data
    content = execute_request(SOLISCLOUD_API_URL+url_part, data, headers)
  File "/home/rick/solis/soliscloud_to_pvoutput.py", line 53, in execute_request
    with urlopen(request, timeout=10) as response:
  File "/usr/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.9/urllib/request.py", line 517, in open
    response = self._open(req, data)
  File "/usr/lib/python3.9/urllib/request.py", line 534, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 1389, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/lib/python3.9/urllib/request.py", line 1350, in do_open
    r = h.getresponse()
  File "/usr/lib/python3.9/http/client.py", line 1347, in getresponse
    response.begin()
  File "/usr/lib/python3.9/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.9/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.9/socket.py", line 704, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.9/ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.9/ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

So exception socket.timeout should be catched. Also any other exception should be catched, for the retry mechanism.
Probably it would be good to increase the timeout from 10 to 30 (seconds).

generation remains at 20 Watts

Hi,
From sunset, the generated amount remains at 20 Watts while the inverter produces 0 Watts. This value is written to PV output after which it is read into Domoticz and provides an incorrect summation of 20 Watts per 5 minutes until 11:59 PM.

20231030 17:22:16: INFO: data=20231030,17:22,3510,20,,226.3,24.8,161.9 20231030 17:27:18: INFO: data=20231030,17:27,3511,20,,225.0,24.7,124.3 20231030 17:32:20: INFO: data=20231030,17:32,3512,20,,227.8,24.6,109.8 20231030 17:37:23: INFO: data=20231030,17:37,3513,20,,227.1,24.5,91.1 20231030 17:42:25: INFO: data=20231030,17:42,3514,20,,227.1,24.5,0 20231030 23:00:23: INFO: Outside solar generation hours (5..23) Exiting program to start fresh tomorrow

20231030 17:42:25: INFO: data=20231030,17:42,3514,20,,227.1,24.5,0
This is the last value and doesn't go to 0 Watt

Thank you in advance

Power Used always at 250W

Not sure if this by design however the Power Used is always displaying at 250W is there a way to show what my actual power used each time?

Outcome gets not updated

In line 277 is a faulty code
send_to_domoticz(str(DOMOTICZ_AC_VOLT_ID), str(volt))
It must be
send_to_domoticz(str(DOMOTICZ_VOLT_ID), str(volt)) without the AC part.
It otherwise won't update it to domoticz.

Cron task has stopped existing tasks running

Hi - I set this python script up on my freenas Linux install, it runs OK thanks
But the cron job stops all the existing cron jobs running on my system now as soon as it runs they stop :(
I setup cron using the web UI interface on freenas

I also since modified the cron command and still have the issue of other tasks not running once the soliscloud2pvoutput one runs.

D7972053-FEFE-4DD6-8014-276ED0473682

Raspberry pi Wheezy no longer possible to connect

Running the script worked well for 2 days in my Raspberry pi, however the Raspberry pi can no longer be reached remote and the router does not show an ip address for the pi. Further investigation of the root cause is ongoing.

Unknow url type

In log I have ERROR:
20230607 09:52:59: ERROR: https://www.soliscloud.com:13333/v1/api/userStationList -> unknown url type: https

solidcould_to_pvoutput.cfg file filled according to README, of course with my API data to solis.

I have Raspberry PI 4B with Domoticz and Python 3.11.2 with R1.12.0 and I can not get data from solis_cloud.
Please send me what I am doing wrong.

This is my config file:

[api_secrets]
send_to_pvoutput = False
soliscloud_api_id = myAPIkey
soliscloud_api_secret = mysecretAPI
soliscloud_api_url = https://www.soliscloud.com:13333
soliscloud_inverter_index = 0
pvoutput_api_key = 0
pvoutput_system_id = 0

[Domoticz]
send_to_domoticz = True
domot_url = http://192.168.8.166:8082
domot_power_generated_id = 374
domot_ac_volt_id = 379
domot_inverter_temp_id = 376
domot_volt_id = 36

SolisCloud API https://www.soliscloud.com:13333/v1/api/userStationList no longer returns station_id

SolisCloud API no longer returns the inverter list.

Traceback (most recent call last):
File "C:\Users\Rick\git\Python\soliscloud_to_pvoutput.py", line 206, in
main_loop()
File "C:\Users\Rick\git\Python\soliscloud_to_pvoutput.py", line 147, in main_loop
inverter_detail_body = get_inverter_list_body()
File "C:\Users\Rick\git\Python\soliscloud_to_pvoutput.py", line 131, in get_inverter_list_body
station_info = json.loads(content)['data']['page']['records'][0]
IndexError: list index out of range

If I look what is now returned for my inverter, this is much different than it was before (I checked also with older code, does no longer work). This is now returned for the call https://www.soliscloud.com:13333/v1/api/userStationList
{
"success": true,
"code": "0",
"msg": "success",
"data": {
"stationStatusVo": {
"all": 1,
"normal": 1,
"fault": 0,
"offline": 0,
"building": 0,
"mppt": 0
},
"page": {
"records": [],
"total": 0,
"size": 10,
"current": 1,
"orders": [],
"optimizeCountSql": true,
"searchCount": true,
"pages": 0
},
"mpptSwitch": 1
}
}

Python script error

Hi after issues with cron on my NAS , I copied the scripts to my raspberry pi

Which version of python 3 should I use?
I get this error running python 3.9
Previous Python 3.4 had other issues, so upgraded to 3.9.15

9152E292-1BEC-4715-8AB5-9E79D71AC972

Not python3 compatible

hmac_obj = hmac.new(
SOLISCLOUD_API_SECRET,
msg=encrypt_str.encode("utf-8"),
digestmod=hashlib.sha1,
)
trows error

ZeroDivisionError

Nice script. Had it running for a few hours this evening and noticed it crashed.

20220919 17:54:13: body: {"id":"1306215032078569474","sn":"154AD1199290068"}
20220919 17:55:14: data=20220919,17:53,11100,510,-1,237.9,108.5,360.0
20220919 17:59:17: data=20220919,17:58,11135,430,-1,238.7,107.8,363.4
20220919 18:04:21: data=20220919,18:03,11200,460,-1,238.8,107.2,356.0
20220919 18:09:24: data=20220919,18:08,11237,450,-1,238.7,107.1,356.0
20220919 18:14:28: data=20220919,18:13,11300,510,-1,238.4,106.5,360.1
20220919 18:19:32: data=20220919,18:18,11351,620,-1,237.9,106.9,360.1
20220919 18:24:36: data=20220919,18:23,11392,500,-1,238.5,106.9,367.9
20220919 18:29:40: data=20220919,18:28,11421,350,-1,238.3,106.0,352.1
20220919 18:34:43: data=20220919,18:33,11442,260,-1,238.3,105.3,348.1
20220919 18:39:47: data=20220919,18:38,11455,160,-1,237.8,104.5,347.4
20220919 18:44:52: data=20220919,18:43,11460,60,-1,238.1,103.8,336.1
20220919 18:48:55: data=20220919,18:48,11461,20,-1,238.2,102.6,313.8
20220919 18:53:59: data=20220919,18:53,11462,20,-1,238.0,101.1,309.0
20220919 18:59:02: data=20220919,18:58,11463,20,-1,237.7,100.4,304.5
20220919 19:04:06: data=20220919,19:04,11464,20,-1,237.3,99.7,298.5
20220919 19:09:09: data=20220919,19:09,11465,20,-1,242.2,99.1,294.5
20220919 19:14:13: data=20220919,19:14,11466,20,-1,240.7,98.6,330.8
20220919 19:19:17: data=20220919,19:19,11467,20,-1,240.8,97.9,329.3
20220919 19:24:20: data=20220919,19:24,11500,20,-1,240.4,97.3,289.4
20220919 19:29:24: data=20220919,19:29,11501,20,-1,240.9,97.0,286.6
20220919 19:34:29: data=20220919,19:34,11502,20,-1,241.1,96.4,284.0
20220919 19:39:33: data=20220919,19:39,11503,20,-1,241.2,96.3,281.79999999999995
Traceback (most recent call last):
  File "solis.py", line 223, in <module>
    main_loop()
  File "solis.py", line 200, in main_loop
    hi_res_watthour_today += int(watt/(60/elapsed_minutes))
ZeroDivisionError: division by zero

It seems to be right as the data stopped uploading from the inverter to the soliscloud.

Transmission stopped without any changes

From December 17th, the script stopped transmitting data to pvoutput.org without doing any changes. When I enable the debug mode in the logging_config.ini, I see that the script polls data from the Solis cloud, but no data will be transmitted to pvoutput. I checked all API keys and log in data, nothing has changed.

20240111 16:48:18: DEBUG: {"success":true,"code":"0","msg":"success","data":{"id":"xxxxx","userId":"xxxxx","sn":"xxxx","inverterMeterModel" ...

Any idea what could be wrong ? There's also absolute no debug output for transmitting data (failing or success).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.