sincze / Domoticz-Growatt-Webserver-Plugin

16 stars 10 forks source link

Using Grott proxy #37

Closed Reinvented0 closed 1 year ago

Reinvented0 commented 1 year ago

Hi there,

is it possible to use https://github.com/johanmeijer/grott with this plugin? The data is then far more reliable and we are no longer depended of the growatt servers.

fgerrits commented 1 year ago

I have had a lot of mail contact with the service line of growatt, it appears that they have problems with the growatt servers, the server-api.growatt.com is an old server and it will be out soon, the server.growatt.com server can now not responding to the many requests and will therefore block the IP addresses. I also have the problem that the IP address is released again at 4 o'clock at night and blocked again around 3 p.m. The solution they propose is to make a request every minute instead of domoticz, to do this every 5 minutes, which reduces the number of requests by 400% so that the servers continue to work.

So if an adjustment can be made to the script that makes a request for data every 5 minutes, that would be a nice solution.

Reinvented0 commented 1 year ago

The idea is that with the solution with https://github.com/johanmeijer/grott (it’s a proxy) you can directly get the data from the growatt inverter into domoticz and therefore don’t hammer the growatt server every minute, or 5 minutes. Only now you need a mqtt server and setting things up. I thought maybe you can combine this solution with this plugin and your done.

jan-vandenberg commented 1 year ago

I have had a lot of mail contact with the service line of growatt, it appears that they have problems with the growatt servers, the server-api.growatt.com is an old server and it will be out soon, the server.growatt.com server can now not responding to the many requests and will therefore block the IP addresses. I also have the problem that the IP address is released again at 4 o'clock at night and blocked again around 3 p.m. The solution they propose is to make a request every minute instead of domoticz, to do this every 5 minutes, which reduces the number of requests by 400% so that the servers continue to work.

So if an adjustment can be made to the script that makes a request for data every 5 minutes, that would be a nice solution.

Have a look at this post (by me): https://www.domoticz.com/forum/viewtopic.php?p=299171#p299171 It's fairly trivial to adjust the script to make it fetch data at different intervals (e.g. 5 minutes), the gist is this:

"After a successful API call, the plugin does 12 heartbeats (10 seconds per beat = 2 minutes). After these hardcoded heartbeats the plugin uses the runAgain variable to determine after how many EXTRA beats it should do another API call. The default is 6 (6 x 10 = 1 minute). So effectively you get an API call every 3 minutes (2+1).

I changed the runAgain variable on line 83 and line 227 to 18 (=3 minutes): so now I get an API call every 5 minutes (2+3)."

fgerrits commented 1 year ago

I have had a lot of mail contact with the service line of growatt, it appears that they have problems with the growatt servers, the server-api.growatt.com is an old server and it will be out soon, the server.growatt.com server can now not responding to the many requests and will therefore block the IP addresses. I also have the problem that the IP address is released again at 4 o'clock at night and blocked again around 3 p.m. The solution they propose is to make a request every minute instead of domoticz, to do this every 5 minutes, which reduces the number of requests by 400% so that the servers continue to work. So if an adjustment can be made to the script that makes a request for data every 5 minutes, that would be a nice solution.

Have a look at this post (by me): https://www.domoticz.com/forum/viewtopic.php?p=299171#p299171 It's fairly trivial to adjust the script to make it fetch data at different intervals (e.g. 5 minutes), the gist is this:

"After a successful API call, the plugin does 12 heartbeats (10 seconds per beat = 2 minutes). After these hardcoded heartbeats the plugin uses the runAgain variable to determine after how many EXTRA beats it should do another API call. The default is 6 (6 x 10 = 1 minute). So effectively you get an API call every 3 minutes (2+1).

I changed the runAgain variable on line 83 and line 227 to 18 (=3 minutes): so now I get an API call every 5 minutes (2+3)."

Is not working for me, its not calling the Heartbeat but says 'Connection - Keep Alive'

" 2023-03-08 21:46:28.402 (Zonnepanelen) Pushing 'onMessageCallback' on to queue 2023-03-08 21:46:28.402 (Zonnepanelen) Processing 'onMessageCallback' message 2023-03-08 21:46:28.402 (Zonnepanelen) Calling message handler 'onMessage'. 2023-03-08 21:46:28.402 (Zonnepanelen) HTTP Details (3): 2023-03-08 21:46:28.402 (Zonnepanelen) >'Status':'200' 2023-03-08 21:46:28.402 (Zonnepanelen) >'Headers': 2023-03-08 21:46:28.402 (Zonnepanelen) ---->'Date':'Wed, 08 Mar 2023 20:46:28 GMT' 2023-03-08 21:46:28.403 (Zonnepanelen) ---->'Content-Type':'application/json;charset=UTF-8' 2023-03-08 21:46:28.403 (Zonnepanelen) ---->'Transfer-Encoding':'chunked' 2023-03-08 21:46:28.403 (Zonnepanelen) ---->'Connection':'keep-alive' 2023-03-08 21:46:28.403 (Zonnepanelen) ---->'Set-Cookie': 2023-03-08 21:46:28.403 (Zonnepanelen) --------['JSESSIONID=E1F93E00EDB42A5DB39B57D995A81753; Path=/; HttpOnly'] 2023-03-08 21:46:28.403 (Zonnepanelen) --------['SERVERID=9d189ffa15079b5878f6a64999a8bdbc|1678308388|1678308388;Path=/'] 2023-03-08 21:46:28.403 (Zonnepanelen) >'Data':'b'{"back":{"msg":"507","success":false}}'' 2023-03-08 21:46:28.403 (Zonnepanelen) Retrieved following json: {"back": {"msg": "507", "success": false}} 2023-03-08 21:46:28.403 (Zonnepanelen) Not received anything useful! "

Maybe it is because im running on a synology instead of a raspberry ?

i dont see this : " 2023-02-12 21:47:45.083 GroWatt Web API: onHeartbeat called, run again in 17 heartbeats. 2023-02-12 21:47:55.059 GroWatt Web API: onHeartbeat called, run again in 16 heartbeats. 2023-02-12 21:48:05.080 GroWatt Web API: onHeartbeat called, run again in 15 heartbeats. 2023-02-12 21:48:15.053 GroWatt Web API: onHeartbeat called, run again in 14 heartbeats. 2023-02-12 21:48:25.076 GroWatt Web API: onHeartbeat called, run again in 13 heartbeats. 2023-02-12 21:48:35.099 GroWatt Web API: onHeartbeat called, run again in 12 heartbeats. 2023-02-12 21:48:45.067 GroWatt Web API: onHeartbeat called, run again in 11 heartbeats. 2023-02-12 21:48:55.096 GroWatt Web API: onHeartbeat called, run again in 10 heartbeats. 2023-02-12 21:49:05.065 GroWatt Web API: onHeartbeat called, run again in 9 heartbeats. 2023-02-12 21:49:15.090 GroWatt Web API: onHeartbeat called, run again in 8 heartbeats. 2023-02-12 21:49:25.070 GroWatt Web API: onHeartbeat called, run again in 7 heartbeats. 2023-02-12 21:49:35.094 GroWatt Web API: onHeartbeat called, run again in 6 heartbeats. 2023-02-12 21:49:45.069 GroWatt Web API: onHeartbeat called, run again in 5 heartbeats. 2023-02-12 21:49:55.093 GroWatt Web API: onHeartbeat called, run again in 4 heartbeats. 2023-02-12 21:50:05.070 GroWatt Web API: onHeartbeat called, run again in 3 heartbeats. 2023-02-12 21:50:15.091 GroWatt Web API: onHeartbeat called, run again in 2 heartbeats. 2023-02-12 21:50:25.059 GroWatt Web API: onHeartbeat called, run again in 1 heartbeats. 2023-02-12 21:50:35.095 GroWatt Web API: Transport set to: 'TCP/IP', server-api . growatt . com : 80. 2023-02-12 21:50:35.105 GroWatt Web API: Connect directive received, action initiated successfully. 2023-02-12 21:50:35.155 GroWatt Web API: Growatt connected successfully. "

fgerrits commented 1 year ago

Got it working, there was a . after line 83, had to set it to 24 to get a 5min and 7 sec delay. (every heartbeat is 10sec) Also made a sub account under mine main account, where in i can see when it's on which time did the update.

So thx for the info to get it working how it should.

Reinvented0 commented 1 year ago

Nice topic hijack 😉, still good info!

sincze commented 1 year ago

Updated with these tips to 1.0.4