-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
405 Client Error #74
Comments
This may be because of previous requests getting your user agent blocked. |
It is already in Randon user ID. self.api = growattServer.GrowattApi(add_random_user_id = True, agent_identifier =(GROWATTSERVER.GrowattApi.agent_identifier)) Dalvik/2.1.0 (Linux; U; Android 12; https://github.com/indykoning/PyPi_GrowattServer) - 21545 |
same error , random User-Agent doesnt work for me , any other solution? |
See #73 |
Independent of the user agent, the error persist. @Derko01 Is it work now for your? |
version: growattServer (1.4.0) And the above combination works for me. |
That is it. The problem is that the Server was in server-api and not just server. Thank you @Derko01 |
That's Worked , thank you ^_^ |
@indykoning I hope this message finds you well. I am writing to report an issue I encountered while attempting to access the Growatt API via the following server URL: https://server-api.growatt.com/ Issue Details: Server URL: https://server-api.growatt.com/ When making a request to the endpoint "/newTwoLoginAPI.do" using the HTTP POST method, I am consistently met with a 405 error, indicating that the request is not allowed for the specified URL. This occurs even when I make the request without including any User-Agent in the header. Further Observation: In an attempt to address this, I added a random User-Agent to the request header. However, I encountered the same error message, indicating that the problem persisted. Alternative API URL: I also tried changing the API URL to https://server.growatt.com/. Unfortunately, this led to a different error. Specifically, upon attempting to log in, I received the following error: "No connection adapters were found for 'https://server.growatt.comnewtwologinapi.do/'." |
@indykoning i tried using an npm library https://www.npmjs.com/package/growatt. -> This one was working for me . |
This could be a result of omitting the final slash when configuring |
@Sjord import requests def authenticate (username , password ):
def generation_get_data(asset):
This works for me . |
What do I have to change for example simple.py to get this working again? For a few days ago everything worked fine. But with a server update by Growatt this error occurred to me. |
Yeah, if anyone works out what change needs to be made to make things work again I'd love to see it. |
+1 for the same issue. Things I've tried:
Doing some quick google research it seems other libraries for pulling Growatt data are also having the same issue
Hopefully this helps someone with a bit more experience with python to fix the issue |
Yeah i'm getting errors trying to get my data from Growatt as well. I do hope they fix it soon, i'm afraid we're out of user-friendly ways to get Growatt data otherwise... This is great information though thank you!
To add to this, and why i believe it's Growatt messing up bot detection: |
@indykoning You're welcome, I tried to figure it out but got nowhere, I'm not much of a developer though 🤣 For what it's worth, for me the ShinePhone app is working, although I'm on iOS. It may be that just the android app is having issue but sadly I don't have an android device to test with. From your screenshot I would agree their WAF is incorrectly configured, it might be that they fix this in a few days when they realise the android app is broken. I will try to raise issue of the broken android app with their support in the hopes they fix their side! |
FYI - ShinePhone App working fine on my Android devices right now. |
Growatt has just released a ShineApp update for the iPhone. Optimise Login Logic I think there was a server change, the apps had to be adjusted. The third-party systems are excluded for now. |
ah @indykoning - you found my home-assistant/core#100874 (comment) FWIW I think that the newTwoLoginAPI.do has been expanded out. view-source:https://server.growatt.com/login in the login2() function. I'm not sure there's a radical change in the behaviour of the backend. The main login page files have just been rejigged. I'm kinda busy in the week, so I've not really had the time to deep dive, but my investigations were going to centralize on that, as I think there just needs to be a tweak in this repo around init.py:131 to work against the new server code. |
It is seem that login url change and cookies is a input as well. POST /newTwoLoginAPIV2.do HTTP/1.1 |
Yes. That was my conclusion too. My starting point for fixing this was to walk the web version. I think the Android app was using the same services and they all got rejigged. You can see from the website this isn't a well honed code base but a simple series of hacked up files meeting various product needs. The changes seem to have moved code, but also added support for some unreleased EV charger product, which has its own server to access data from. I don't think it's impossible to fix. Just that the new code needs to be unfurled. I was going to look at the WayBackMachine to see what was in the original /newTwoLoginAPIV2.do file, so I can piece it all back together. |
If you could fix it that would be absolutely brilliant. The sole purpose of my Home Assistant installation is to link my Growatt system to my immersion (hot water tank) heater. I am not able to use Grott as my installer monitors my system and after checking with them they say that any alteration of the WiFi dongle will invalidate my service agreement. |
I'm really interested in a fix for this, mainly because I spent a few hours the other night looking at the new API and the netSSL output etc and I've made a carbon copy of what the app does and I still get the error so I can't work out what it does! |
Did you try this? 35d50c4 |
No, I was exclusively trying to replicate the behaviour of the app. |
For the registration via https://server.growatt.com/login I get - reproduced in Postman - at least once {"result":1} and PlantID etc. back. However, I do not manage to retrieve any more data. Step 1: https://server.growatt.com/login?account=xxxx&passwordCrc=yyyy&login_type="web" |
Many many thanks - I will take a look later |
Then the answer is simple. Run the Inspector, turn off page clearing. Log in, and then replay what it did in its POSTs. |
Oh wait. I thought you wanted to all get to server-api.growatt.com. You gave the impression it was specifically needed. |
I'm referring to server-api.growatt.com, that's what the android app uses. When I do a full signout of the app and then sign back in, there's a few other sites it reaches out to for login, but I'm not sure if they're essential or not. |
Hi - sorry to bother you yet again. If I run the latest gotest.py it returns my plant ID, the device SN and the DataLoger serial number. It then fails with the following error highlevel test |
This is a good example of the type of problem you hit with these fluxy POSTs from the growatt servers. You should check the return variable device like this: device = self.rawGetSPAstatusData() You'll then know if your data values match mine from the server. I'm guessing they don't. Later I'll post a document I build of all the JSON I could find. Then at least people can compare responses. |
@vtraveller Thank you for the work you have done on this! I think I can now get all the data again that I need to fix my iOS shortcut to display a graph in a widget. However, I could not find one more parameter that we need for fixing the Growatt integration in the Homey SolarPanels App. Were you able to get the "Current Power (in W)"? If so, with which API call? |
Ah. Maybe. A lot of the units have switched to kWh and show with a decimal. If you look at getStatusData you'll see ppv, ChargePower, pdisCharge1 grid etc Multiply all by 1000 and then use simple maths if a value is missing. |
Thank you. Very helpful. |
Hello, |
Hello dear, I've completed the procedure to receive the key/URL via email. I validated the access through a browser, and it worked. So, how can I integrate this with Home Assistant to access the measurements? |
@muppet3000 - I just noticed 3 days ago the API started working again, I guess they have changed something once more. |
If that's the case, that's pretty cool. I'm currently on holiday but I'll test when I'm back next week. |
This URL: https://openapi.growatt.com/ appears to work (for now) |
@muppet3000 Do you already test this openapi with the application? I am trying to do it, but without success. |
It worked the other day, I haven't checked since last week though. |
I tested the following URLs today (from The Netherlands):
In all cases I tested the results are the same regardless of the request method (this API, a web browser, different user agent or IP). I guess once the WAF decides a certain type of request or endpoint is getting suspicious traffic, it blocks a lot more traffic from that point on. In order to attempt to mitigate future blocks it might be handy to check the documentation and understand how the WAF works: https://www.alibabacloud.com/help/en/web-application-firewall Changing the default url to |
maybe I'm misunderstand and just need to edit the init.py. but shouldn't I be able to change the server url with this in my code?
|
https://www.showdoc.com.cn/262556420217021/1494055033077450 |
@marcovtwout This is official Growatt WEB API regularly updated. |
@Saentist I was looking into that API but I cannot figure out where to get the API token form. Do you know how I could get it? |
@patcher-ms before token can be seen in https://server.growatt.com in Settings > Account Management now in https://oss.growatt.com with is not possible for self installed systems |
@Saentist Thats really nice and could mean the way forward, but I suggest to create a seperate issue/feature request for this to keep things on topic. |
Just FYI, the updated URL still works after 2+ months of testing: #74 (comment) |
When I try to Login the error below is happing.
requests.exceptions.HTTPError: 405 Client Error: Not Allowed for url: https://server-api.growatt.com/newTwoLoginAPI.do
Someone with the same error?
The text was updated successfully, but these errors were encountered: