May 4, 20224 yr Thank you Mike for this. Works like a charm for me. The csv file, in particular, is very helpful.
May 4, 20224 yr Hurrah - glad to help! Main issues were therefore around permissions / paths in Linux rather than the script itself. Do bear in mind that /tmp (as a temporary directory) gets wiped each time the server restarts. Enjoy
May 4, 20224 yr Author Mike - I got another permissions error so I went back and set the Tmp folder permissions with sudo chmod -R 777 /tmp/ via terminal. When I run the file with or without Sudo it gives the following error python3 ./processToFiles_light.py dayToProcess is: 2022-05-04 Traceback (most recent call last): File "/home/Growatt/Script/./processToFiles_light.py", line 90, in <module> chartData = mix_detail['chartData'] TypeError: 'NoneType' object is not subscriptable Edited May 4, 20224 yr by L_D
May 8, 20224 yr Author On 2022/05/04 at 5:42 PM, Mike_C said: Hurrah - glad to help! Main issues were therefore around permissions / paths in Linux rather than the script itself. Do bear in mind that /tmp (as a temporary directory) gets wiped each time the server restarts. Enjoy Hi Mike - I created a AWS Linux AMI and I am MUCH closer. [ec2-user@ip-172-31-20-164 Growatt]$ python3 processToFiles.py dayToProcess is: 2022-05-08 Traceback (most recent call last): File "processToFiles.py", line 38, in <module> user_id = login_response['user']['id'] KeyError: 'user' I checked, the username pwd combo is correct and able to login via web browser, above error seems like it is kicking me out becasue of a bad username? I get the same error using these example python scripts where you have to enter your username and password. Browser login URL is: https://server.growatt.com/login user_name = "ldusername" # add server login here user_pass = "LDpassword" # add server password here Edited May 8, 20224 yr by L_D
May 8, 20224 yr I don’t believe running as sudo is actually needed hence worth removing that. Keen to understand steps that 0xEF did to get working. I’m unsure from here. Clearly the username / password combo via the scripts should work as well as per the API. I have found that the app has been a bit hit and miss today - with timeouts. Perhaps retrying the API at another time??
May 9, 20224 yr Author 12 hours ago, Mike_C said: I don’t believe running as sudo is actually needed hence worth removing that. Keen to understand steps that 0xEF did to get working. I’m unsure from here. Clearly the username / password combo via the scripts should work as well as per the API. I have found that the app has been a bit hit and miss today - with timeouts. Perhaps retrying the API at another time?? You are right Mike, the login is somewhat unstable. This morning it managed to get past the login and then gave this error:- any ideas as to why? During handling of the above exception, another exception occurred: Traceback (most recent call last): File "./GW.py", line 22, in <module> login_response = api.login(username, user_pass) File "/home/ec2-user/.local/lib/python3.7/site-packages/growattServer/__init__.py", line 59, in login 'password': password_md5 File "/home/ec2-user/.local/lib/python3.7/site-packages/requests/sessions.py", line 577, in post return self.request('POST', url, data=data, json=json, **kwargs) File "/home/ec2-user/.local/lib/python3.7/site-packages/requests/sessions.py", line 529, in request resp = self.send(prep, **send_kwargs) File "/home/ec2-user/.local/lib/python3.7/site-packages/requests/sessions.py", line 645, in send r = adapter.send(request, **kwargs) File "/home/ec2-user/.local/lib/python3.7/site-packages/requests/adapters.py", line 517, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='server.growatt.com', port=443): Max retries exceeded with url: /LoginAPI.do (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)'))) Edited May 9, 20224 yr by L_D
June 21, 20224 yr On 2022/05/01 at 10:32 PM, Mike_C said: can't download this script... is there a way I can get it? On 2022/05/01 at 10:32 PM, Mike_C said: processToFiles.pyUnavailable
June 23, 20224 yr Many thanks Mike for sharing your script, it was almost exactly what I was looking for. It was all working fine, as was another script I wrote, until the other day and now it seems to error on the login part. Is anyone else having these issues?
June 23, 20224 yr Yes. It’s the same via the app though. Logins (mainly timeouts I feel) are a problem. There are definitely times in the day when it’s more common to have timeouts. perhaps there is a timeout configuration for the api client (and / or some error handling) that can be added. I’ve not checked
June 23, 20224 yr 46 minutes ago, Mike_C said: Yes. It’s the same via the app though. Logins (mainly timeouts I feel) are a problem. There are definitely times in the day when it’s more common to have timeouts. perhaps there is a timeout configuration for the api client (and / or some error handling) that can be added. I’ve not checked OK thanks - I will do some digging too.
June 30, 20224 yr On 2022/06/23 at 11:38 AM, Graham_S said: OK thanks - I will do some digging too. Just an update on this, it kept happening until I stumbled on another thread advising to update the login in growattServer/init.py to "newTwoLoginApi.do" rather than "newLoginAPI.do". Seems they changed this in the latest update.
September 4, 20223 yr hi, i also get this response (as normal user or with sudo): dayToProcess is: 2022-09-04 Traceback (most recent call last): File "processToFiles.py", line 91, in <module> ppvToday_dayAPI = mix_detail_day['chartData']['ppv'][DayOfMonth_i] TypeError: 'NoneType' object is not subscriptable the /tmp/-folder-solution did not work. any other ideas on how to fix this? there are a few json-files created, but in none of them is the required data (e.g. the content of the file growatt-mix_detail-2022-09-04.json is "null"..?)
February 2, 20233 yr Hi, To those who concerned, for the growatt grid tied inverter you can get the access to the data at "https://server.growatt.com/plant.do" Login with the credentials. In the page, click on "Device List" tab then on "MIN/MIC/MOD/NEO", which shows a table of devices connected. Double click on the device you wish to query the data, a pop window appears with history. There is search button and export button. Export will give the excel tabulated data for the current day. In the search tab you can download the data for any day, I could go upto 4 months of data at max. At a time you can download data for 4 days in a single excel, though the website says maximum 7 days it prints "Too large file" if you select more than 4 or 5 days at a time. Attaching the screenshots for the reference. Regards, antarya Edited February 2, 20233 yr by antarya
February 9, 20233 yr Author @antarya, once logged in I dont have the "Device List" option. See screensnip below:
February 9, 20233 yr 1 hour ago, L_D said: once logged in I dont have the "Device List" option. Same here. Problem is the URL given does not seem to exist anymore, or rather it auto directs to http://server.growatt.com/index
February 11, 20233 yr Hi, I have just bought Growatt inverter and would like to extract data from growatt server and send it to PVOutput.Org as i have data there for my 2 inverters for 10 years, but one inverter failed recently, and i got a new Growatt. I would like to transfer data to the PVOutput to be able to compare my invertes ect. I have tried to run the script ProcessToFile.py. I have none to little experience with Python and have no experience setting up api calls. I have installed python 3.11 on windows. I have included the module : growattServer but when i tried to run the script it gave me a login error. I cannot figure out if i have miss something in the script setup ?. plants Id, api key, inverter name or it is a commen error in the login setup. I have only changed 2 lines in the script :user_name and user_pass has i changed to my credentials i use to login on http://server-api.growatt.com/login Here are the output when i run the script. Python 3.11.2 (tags/v3.11.2:878ead1, Feb 7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. = RESTART: C:\Users\ottos\AppData\Local\Programs\Python\Python311\processToFiles.py dayToProcess is: 2023-02-11 Traceback (most recent call last): File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\processToFiles.py", line 37, in <module> login_response = api.login(user_name, user_pass) File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\growattServer\__init__.py", line 131, in login response = self.session.post(self.get_url('newTwoLoginAPI.do'), data={ File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 635, in post return self.request("POST", url, data=data, json=json, **kwargs) File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 587, in request resp = self.send(prep, **send_kwargs) File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 708, in send r = dispatch_hook("response", hooks, r, **kwargs) File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\hooks.py", line 30, in dispatch_hook _hook_data = hook(hook_data, **kwargs) File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\growattServer\__init__.py", line 41, in <lambda> 'response': lambda response, *args, **kwargs: response.raise_for_status() File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://server-api.growatt.com/newTwoLoginAPI.do The result in VS2019 Kind Regards, Otto Sembach
February 18, 20233 yr On 2023/02/09 at 11:03 PM, L_D said: @antarya, once logged in I dont have the "Device List" option. See screensnip below: Ah! I see the problem. So the Growatt maintains two types of interfaces both has similar name. I am not sure how it is done but if you go directly to https://server.growatt.com it takes you to the above interface but instead, goto https://server.growatt.com/login.do URL has to be https:// not http:// It takes you to the interface I have posted in my previous posts. I suggest clearing cookies or opening in "Private Window" to avoid your browser from reloading using previously stored cookies. Let me know if you could get the access. Edited February 18, 20233 yr by antarya
February 18, 20233 yr On 2023/02/10 at 12:16 AM, zsde said: Same here. Problem is the URL given does not seem to exist anymore, or rather it auto directs to http://server.growatt.com/index Try this URL instead https://server.growatt.com/login.do URL has to be https:// not http:// Edited February 18, 20233 yr by antarya
February 18, 20233 yr On 2023/02/11 at 9:17 PM, OttoS said: Hi, I have just bought Growatt inverter and would like to extract data from growatt server and send it to PVOutput.Org as i have data there for my 2 inverters for 10 years, but one inverter failed recently, and i got a new Growatt. I would like to transfer data to the PVOutput to be able to compare my invertes ect. I have tried to run the script ProcessToFile.py. I have none to little experience with Python and have no experience setting up api calls. I have installed python 3.11 on windows. I have included the module : growattServer but when i tried to run the script it gave me a login error. I cannot figure out if i have miss something in the script setup ?. plants Id, api key, inverter name or it is a commen error in the login setup. I have only changed 2 lines in the script :user_name and user_pass has i changed to my credentials i use to login on http://server-api.growatt.com/login Here are the output when i run the script. Python 3.11.2 (tags/v3.11.2:878ead1, Feb 7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. = RESTART: C:\Users\ottos\AppData\Local\Programs\Python\Python311\processToFiles.py dayToProcess is: 2023-02-11 Traceback (most recent call last): File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\processToFiles.py", line 37, in <module> login_response = api.login(user_name, user_pass) File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\growattServer\__init__.py", line 131, in login response = self.session.post(self.get_url('newTwoLoginAPI.do'), data={ File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 635, in post return self.request("POST", url, data=data, json=json, **kwargs) File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 587, in request resp = self.send(prep, **send_kwargs) File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 708, in send r = dispatch_hook("response", hooks, r, **kwargs) File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\hooks.py", line 30, in dispatch_hook _hook_data = hook(hook_data, **kwargs) File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\growattServer\__init__.py", line 41, in <lambda> 'response': lambda response, *args, **kwargs: response.raise_for_status() File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://server-api.growatt.com/newTwoLoginAPI.do The result in VS2019 Kind Regards, Otto Sembach Hi, I have not got into the code part yet but generally for the api access you need API key from the vendor. If there's any other way to get the data using the code I'll try to figure it out and post it. In the meantime, you can download the data from here https://server.growatt.com/login.do Check my posts above for more details. In the web, you can't access data beyond 60-90 days depending on the model so get the data downloaded soon. URL has to be https:// not http:// Edited February 18, 20233 yr by antarya
February 18, 20233 yr On 2022/05/01 at 10:32 PM, Mike_C said: My overdue update of #3. I have found it to be stable enough / gives me what I want that I have not explored option #2 at all. I have found that growattServer 1.2.0 to be the best for my needs. It can be installed via: pip install growattServer Details can be found here: https://pypi.org/project/growattServer I have no affiliation to this project; I am just one customer / user that has found it to give me what I need. I have this running on an m1 mac and have attached my python3 script. I can't comment on how easier it is to translate this to windows / linux (if any 'translation' is needed at all). Either way, before running, complete the set up variables configuration (line 11 to 15). To run (based on today’s date) : python3 ./processToFiles.py To run (based on YYYY-MM-DD) provide three separate parameters : python3 ./processToFiles.py YYYY MM DD The files generated are a combination of direct API call output and some calculated values. A summary csv is generated detailing (and this is how I think about energy created / used): Solar (PV) to battery (i.e. stored) Solar (PV) to user (i.e. used at time of generation) Solar (PV) to grid (i.e. exported) Battery to user (i.e. used post generation) Grid to battery (should be close to zero but fluctuates) Grid to User (imported energy) I then compare this CSV in Excel to that provided by my energy provider - i.e. exported and imported values. processToFiles.py 11.16 kB · 40 downloads Mike, What was the API key? Did you get it from the Growatt by writing to them or is it available anywhere in public fourm? Thanks Edited February 18, 20233 yr by antarya
February 18, 20233 yr On 2023/02/11 at 9:17 PM, OttoS said: Hi, I have just bought Growatt inverter and would like to extract data from growatt server and send it to PVOutput.Org as i have data there for my 2 inverters for 10 years, but one inverter failed recently, and i got a new Growatt. I would like to transfer data to the PVOutput to be able to compare my invertes ect. I have tried to run the script ProcessToFile.py. I have none to little experience with Python and have no experience setting up api calls. I have installed python 3.11 on windows. I have included the module : growattServer but when i tried to run the script it gave me a login error. I cannot figure out if i have miss something in the script setup ?. plants Id, api key, inverter name or it is a commen error in the login setup. I have only changed 2 lines in the script :user_name and user_pass has i changed to my credentials i use to login on http://server-api.growatt.com/login Here are the output when i run the script. Python 3.11.2 (tags/v3.11.2:878ead1, Feb 7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. = RESTART: C:\Users\ottos\AppData\Local\Programs\Python\Python311\processToFiles.py dayToProcess is: 2023-02-11 Traceback (most recent call last): File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\processToFiles.py", line 37, in <module> login_response = api.login(user_name, user_pass) File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\growattServer\__init__.py", line 131, in login response = self.session.post(self.get_url('newTwoLoginAPI.do'), data={ File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 635, in post return self.request("POST", url, data=data, json=json, **kwargs) File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 587, in request resp = self.send(prep, **send_kwargs) File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 708, in send r = dispatch_hook("response", hooks, r, **kwargs) File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\hooks.py", line 30, in dispatch_hook _hook_data = hook(hook_data, **kwargs) File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\growattServer\__init__.py", line 41, in <lambda> 'response': lambda response, *args, **kwargs: response.raise_for_status() File "C:\Users\ottos\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://server-api.growatt.com/newTwoLoginAPI.do The result in VS2019 Kind Regards, Otto Sembach Their API guide says to write to them for API access. https://growatt.pl/wp-content/uploads/2020/01/Growatt-Server-API-Guide.pdf I suppose one can try that
February 18, 20233 yr 1 hour ago, antarya said: Try this URL instead Thank you, that did the trick to get to the URL Edited February 18, 20233 yr by zsde
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.