sincze / Domoticz

Pass2PHP Domoticz Scripts
17 stars 12 forks source link

growatt script does not work anymore #18

Open ariankoster opened 1 year ago

ariankoster commented 1 year ago

Since some days no values get in any more

sincze commented 1 year ago

Unfortunately Growatt changed their login mechanism. So needs work to fix.

In meantime I easily migrated to Node-Red and now I have even more devices to chose from. image

Cees2439867 commented 1 year ago

Unfortunately it is broken again as the data this morning show: afbeelding Wrote an email to Dutch branch of Growatt how to get data from their servers...... Have little hope but one can try!

Achterhoeker commented 1 year ago

Unfortunately it is broken again as the data this morning show: afbeelding Wrote an email to Dutch branch of Growatt how to get data from their servers...... Have little hope but one can try!

I can confirm it is indeed broken again :-(

sincze commented 1 year ago

The Node-Red version is still working. image

Any error messages in from the script??

I notice 3 login attempts.

  1. POST https://oss.growatt.com/login / Host: oss.growatt.com userName=xx&password=&lang=en&loginTime=2023-08-22+10%3A49%3A58&noRecord=true&type=1&passwordCrc=xx

{"result":0,"msg":"Username needs to be at least 8 digits long"}

  1. POST https://oss.growatt.com/login / Host: oss.growatt.com userName=xx&password=&lang=en&loginTime=2023-08-22+10%3A49%3A58&type=1&passwordCrc=xx

{"result":0,"msg":"Username needs to be at least 8 digits long"}

  1. POST https://server.growatt.com/login Host: server.growatt.com account=xx&password=&validateCode=&isReadPact=0&passwordCrc=xx

{"result":1}

Using the script we see an HTTP Response of 403. (Not Authorized)

Achterhoeker commented 1 year ago

the plugin on https://github.com/sincze/Domoticz-Growatt-Webserver-Plugin/ is working again, the php script isn't.

sincze commented 1 year ago

that is interesting indeed

sincze commented 1 year ago

Will need some minor config changes. I need to add a additional function to extract the plantID and use that to request for the data.

define('HEADER',array('Content-Type: application/x-www-form-urlencoded;charset=UTF-8',
                      'Connection: keep-alive',
                      'Host: server.growatt.com',
                      'User-Agent: Domoticz/1.0'));
sincze commented 1 year ago

the plugin on https://github.com/sincze/Domoticz-Growatt-Webserver-Plugin/ is working again, the php script isn't.

can you try with the current version ???

2023-08-22 20:29:02.467 Status: --->> Growatt inverter: Analyze HTTP for function retrieve_data called with HTTP code: 200
2023-08-22 20:29:02.471 Status: --->> Growatt inverter: Expected HTTP code: 200
2023-08-22 20:29:02.476 Status: --->> Growatt inverter: Let have a look at the received data!
2023-08-22 20:29:02.478 Status: --->> Growatt inverter: I did find JSON data to work with!
2023-08-22 20:29:02.481 Status: --->> Growatt Inverter: 0 Watt. Today: 10.9 kWH and total inverter is: 13997700 Wh for domoticz: 0;13997700
Achterhoeker commented 1 year ago

@sincze It works again:

2023-08-22 21:00:46.936 Status: --->> Cookie File: /home/ronald/domoticz/scripts/pass2php/growatt.cookie exists!
2023-08-22 21:00:46.938 Status: --->> Cookie File: /home/ronald/domoticz/scripts/pass2php/growatt.cookie is writable!
2023-08-22 21:00:47.015 Status: --->> Growatt Inverter: 16.5 for domoticz: 16.5;9528600
2023-08-22 21:00:47.025 Status: --->> (udevice) | 1757 => 0,16.5;9528600

But first it didn't then i compared with the plugin. There i saw i was using http. In the script i changed the https calls into http and that did the job. Thanks for changing the script so it works again. :-)

Cees2439867 commented 1 year ago

With me it does not work yet. Yesterday I used the new growatt-inverter.php updated username/password, Idx and domotics url. Then executed the file with the following result: Het gaat helemaal fout

Then, at night time I added a piece of code not to update if the counter is not above zero: lg('Growatt Inverter: '. $nowpower.' for domoticz: '.$str); IF ($todaypower > 0) { ud(DOMOTICZDEVICE,0,$str,'GrowattInverter: Generation updated'); } I have this because I used to have many times that the counter retrieved was zero. After fixing the database with the correct values for yesterday I kept up the hopes for this morning but no luck. I do not get data from Growatt.

Maybe you have a hint?

sincze commented 1 year ago

Put the variable in the script debug to true and share the results shown in the domoticz.log. With the supplied info there is nothing we can do as we don't see what it is doing.

On Wed, Aug 23, 2023 at 8:13 AM Cees Bakker @.***> wrote:

With me it does not work yet. Yesterday I used the new growatt-inverter.php updated username/password, Idx and domotics url. Then executed the file with the following result: [image: Het gaat helemaal fout] https://user-images.githubusercontent.com/33065120/262570737-1177943d-8fa6-4a47-976f-228554c395bf.png

Then, at night time I added a piece of code not to update if the counter is not above zero: lg('Growatt Inverter: '. $nowpower.' for domoticz: '.$str); IF ($todaypower > 0) { ud(DOMOTICZDEVICE,0,$str,'GrowattInverter: Generation updated'); } I have this because I used to have many times that the counter retrieved was zero. I kept up the hopes for this morning but no luck. I do not get data from Growatt.

— Reply to this email directly, view it on GitHub https://github.com/sincze/Domoticz/issues/18#issuecomment-1689340006, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMCHTLIATN6GNXZUOTWYXLXWWNRPANCNFSM6AAAAAA3WTI7VM . You are receiving this because you were mentioned.Message ID: @.***>

Cees2439867 commented 1 year ago

Just now I took the file growatt-converter.php and carefully looked if I made any mistake. Searching the file for "debug" gave no hit. The output of the read out from Growatt shows the following: 2023-08-23 13:15:02.525 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie exists! 2023-08-23 13:15:02.526 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie is writable! 2023-08-23 13:15:02.616 Status: --->> Growatt Inverter: 0 for domoticz: 0;0

What else can I look at?

Achterhoeker commented 1 year ago

@Cees2439867 For me only http is working, still no https from the growatt servers with data. So in the growatt-inverter.php i've changed all https calls in http.

Cees2439867 commented 1 year ago

It is not working unfortunately. Thanks for your work to help me (and others). I will enter the data manually for a while. Just bought a KWh meter from Home Wizard ([Wi-Fi kWh meter 1-fase) which promise a API. Hope this works.

sincze commented 1 year ago

Homewizard stuff works great. Is simple URL parsing to get it into Domoticz. There is already a Domoticz plugin (p1. Water, plug) hopefully for the Meter as well.

On Thu, 24 Aug 2023, 11:46 Cees Bakker, @.***> wrote:

It is not working unfortunately. Thanks for your work to help me (and others). I will enter the data manually for a while. Just bought a KWh meter from Home Wizard ([Wi-Fi kWh meter 1-fase) which promise a API. Hope this works.

— Reply to this email directly, view it on GitHub https://github.com/sincze/Domoticz/issues/18#issuecomment-1691363816, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMCHTIMIEOJNKBGOFHHXSDXW4PIRANCNFSM6AAAAAA3WTI7VM . You are receiving this because you were mentioned.Message ID: @.***>

Marinus48 commented 1 year ago

I am a newbee so do not kill me if I talk nonsense... I changed my password , from 6 to 8 positions. I changed line 116 in:

$url='https://server.growatt.com/newPlantAPI.do?action=getUserCenterEnertyData';
Now growatt-inverter.php works.....

I can not explain why.... Enjoy..

sincze commented 1 year ago

Well the hint could as well been in the clue of Growatt themselves.

{"result":0,"msg":"Username needs to be at least 8 digits long"}

But then again ;-) who knows.

Marinus48 commented 1 year ago

2023-08-24 15:16:01.717 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie exists! 2023-08-24 15:16:01.718 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie is writable! 2023-08-24 15:16:01.781 Status: --->> Growatt Inverter: 1772.2 for domoticz: 1772.2;14647800 2023-08-24 15:16:01.786 Status: --->> (udevice) | 80 => 0,1772.2;14647800

sincze commented 1 year ago

2023-08-24 15:16:01.717 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie exists! 2023-08-24 15:16:01.718 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie is writable! 2023-08-24 15:16:01.781 Status: --->> Growatt Inverter: 1772.2 for domoticz: 1772.2;14647800 2023-08-24 15:16:01.786 Status: --->> (udevice) | 80 => 0,1772.2;14647800

This indeed shows how it should be indeed.

ntpckr commented 1 year ago

I updated the file, but I get only 0.0 values:

2023-08-29 10:42:11.008 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie exists! 2023-08-29 10:42:11.010 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie is writable! 2023-08-29 10:42:11.049 Status: --->> Growatt Inverter: 0 for domoticz: 0;0 2023-08-29 10:42:11.060 Status: --->> (udevice) | 367 => 0,0;0

Cees2439867 commented 1 year ago

Hi Sandor, You where so right about HomeWizard! Now I have a constant flow of data in house without interfering with the data from the supplier. Thanks for your work during the past three years. Regards, Cees.

⁣TypeApp voor Android downloaden ​

Op 24 aug. 2023 12:05, om 12:05, Sandor @.***> schreef:

Homewizard stuff works great. Is simple URL parsing to get it into Domoticz. There is already a Domoticz plugin (p1. Water, plug) hopefully for the Meter as well.

On Thu, 24 Aug 2023, 11:46 Cees Bakker, @.***> wrote:

It is not working unfortunately. Thanks for your work to help me (and others). I will enter the data manually for a while. Just bought a KWh meter from Home Wizard ([Wi-Fi kWh meter 1-fase) which promise a API. Hope this works.

— Reply to this email directly, view it on GitHub

https://github.com/sincze/Domoticz/issues/18#issuecomment-1691363816, or unsubscribe

https://github.com/notifications/unsubscribe-auth/ABMCHTIMIEOJNKBGOFHHXSDXW4PIRANCNFSM6AAAAAA3WTI7VM . You are receiving this because you were mentioned.Message ID: @.***>

-- Reply to this email directly or view it on GitHub: https://github.com/sincze/Domoticz/issues/18#issuecomment-1691391317 You are receiving this because you were mentioned.

Message ID: @.***>

sincze commented 1 year ago

I updated the file, but I get only 0.0 values:

2023-08-29 10:42:11.008 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie exists! 2023-08-29 10:42:11.010 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie is writable! 2023-08-29 10:42:11.049 Status: --->> Growatt Inverter: 0 for domoticz: 0;0 2023-08-29 10:42:11.060 Status: --->> (udevice) | 367 => 0,0;0

That is annoying indeed. I just checked mine:

2023-08-29 20:08:31.674 Status: --->> Growatt inverter: 1. Cookie file Found: /var/tmp/growatt.cookies 2023-08-29 20:08:31.682 Status: --->> Growatt inverter: Retrieve Data function called! 2023-08-29 20:08:31.829 Status: --->> Growatt inverter: Analyze HTTP for function retrieve_data called with HTTP code: 200 2023-08-29 20:08:31.832 Status: --->> Growatt inverter: Expected HTTP code: 200 2023-08-29 20:08:31.836 Status: --->> Growatt inverter: Let have a look at the received data! 2023-08-29 20:08:31.838 Status: --->> Growatt inverter: I did find JSON data to work with! 2023-08-29 20:08:31.841 Status: --->> Growatt Inverter: 22 Watt. Today: 8.2 kWH and total inverter is: 14065300 Wh for domoticz: 22;14065300

Slightly modified the online version again can you check again ??

sincze commented 1 year ago

Hi Sandor, You where so right about HomeWizard! Now I have a constant flow of data in house without interfering with the data from the supplier. Thanks for your work during the past three years. Regards, Cees. ⁣TypeApp voor Android downloaden ​Op 24 aug. 2023 12:05, om 12:05, Sandor @.> schreef: Homewizard stuff works great. Is simple URL parsing to get it into Domoticz. There is already a Domoticz plugin (p1. Water, plug) hopefully for the Meter as well. On Thu, 24 Aug 2023, 11:46 Cees Bakker, @.> wrote: > It is not working unfortunately. Thanks for your work to help me (and > others). I will enter the data manually for a while. Just bought a KWh > meter from Home Wizard ([Wi-Fi kWh meter 1-fase) which promise a API. Hope > this works. > > — > Reply to this email directly, view it on GitHub > <#18 (comment)>, > or unsubscribe > https://github.com/notifications/unsubscribe-auth/ABMCHTIMIEOJNKBGOFHHXSDXW4PIRANCNFSM6AAAAAA3WTI7VM > . > You are receiving this because you were mentioned.Message ID: > @.> > -- Reply to this email directly or view it on GitHub: #18 (comment) You are receiving this because you were mentioned. Message ID: @.>

You are most welcome. Enjoy their hardware.

Marinus48 commented 1 year ago

I chequed mine and it is still working.....

2023-08-29 20:12:01.743 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie exists! 2023-08-29 20:12:01.744 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie is writable! 2023-08-29 20:12:01.968 Status: --->> Growatt Inverter: 4.4 for domoticz: 4.4;14728500 2023-08-29 20:12:01.972 Status: --->> (udevice) | 80 => 0,4.4;14728500 2023-08-29 20:14:02.206 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie exists! 2023-08-29 20:14:02.206 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie is writable! 2023-08-29 20:14:02.277 Status: --->> Growatt Inverter: 4.4 for domoticz: 4.4;14728500 2023-08-29 20:14:02.280 Status: --->> (udevice) | 80 => 0,4.4;14728500

ntpckr commented 1 year ago

Slightly modified the online version again can you check again ??

Now it works again, thanks! What did you change?

sincze commented 1 year ago

Github allows you to track the changes between versions Have a look ;-)

ntpckr commented 1 year ago

Where is the data stored of the data of the Growatt readings? I want to alter the comparing usage, because it is not correct.

image

sincze commented 1 year ago

I would say it is stored in Domoticz DB ;-)

ntpckr commented 1 year ago

Yes, it is, but I cannot find the exact line or table. I know where the day values are stored. So I wonder where the years are stored. Or is it calculated when I load the page?

sincze commented 1 year ago

Ok great. Stop domoticz before changing something in the DB.

Check for a column named calendar_meter or meter_calendar. Just go through the values and look for the idx of your device.

Marinus48 commented 11 months ago

Since today the script works fine… I do not know why…but enjoy! IMG_1454

ntpckr commented 11 months ago

Since today the script works fine… I do not know why…but enjoy! IMG_1454

Yes, mine too!