Page 1 of 2

Growatt-inverter.php does not work anymore

Posted: Friday 29 September 2023 6:57
by rick8245
Hi ,

I recently got this update php script for my solar panels.
https://github.com/sincze/Domoticz/blob ... verter.php

It worked fine for months but since yesterday it is not working anymoer.

The app on the phone still works ok so the apnels also still work fine :mrgreen:

Anyone who has the same problems ?
What alternative or utility in Domoticz do you use ??

Thanks in advance,
Rick8245

Re: Growatt-inverter.php does not work anymore

Posted: Friday 29 September 2023 8:09
by rick8245
The growaat.cookie gives this info:

# Netscape HTTP Cookie File
# https://curl.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.

#HttpOnly_server.growatt.com FALSE / TRUE 0 JSESSIONID 047BC800FB00EB830ABA355BD8A89D00
server.growatt.com FALSE / FALSE 0 SERVERID 2a4c72768b4e0dec5cce3de1a0dfde3f|1695967656|1695967656

Re: Growatt-inverter.php does not work anymore

Posted: Friday 29 September 2023 11:36
by waltervl
There is also a plugin but that seems to have the same issue due to changes implemented by Growatt https://github.com/sincze/Domoticz-Grow ... /issues/44

Re: Growatt-inverter.php does not work anymore

Posted: Friday 29 September 2023 12:05
by rick8245
Thank you Waltervl.
This is exactly the issue i have (also since yesterday 09:00 AM)

Let's hope for a quick solution soon.

Re: Growatt-inverter.php does not work anymore

Posted: Friday 29 September 2023 12:22
by PieterS
My suggestion is to use this application:

https://github.com/johanmeijer/grott

Several ways to run it. Native mode on a Raspberry, in Docker on the Raspberry, etc. I run it in Docker on my Synology.

You can configure it as a Proxy or as a server, so no data any more to China. And no longer available from their servers.

You can send your data as a MQTT-message by Node-Red to Domoticz. The flow is made by @Firewizard :D

Code: Select all

[
    {
        "id": "936b12da.8ecb78",
        "type": "tab",
        "label": "MQTT Growatt naar Domoticz",
        "disabled": false,
        "info": ""
    },
    {
        "id": "f01b6ff0.ce4878",
        "type": "mqtt in",
        "z": "936b12da.8ecb78",
        "name": "Growatt in",
        "topic": "energy/growatt",
        "qos": "0",
        "datatype": "json",
        "broker": "7fb3e06.2d91f2",
        "nl": false,
        "rap": false,
        "inputs": 0,
        "x": 80,
        "y": 120,
        "wires": [
            [
                "9ce4ad303671b7b2"
            ]
        ]
    },
    {
        "id": "6bed263.b6565d8",
        "type": "debug",
        "z": "936b12da.8ecb78",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 650,
        "y": 200,
        "wires": []
    },
    {
        "id": "733eede6.d10984",
        "type": "mqtt out",
        "z": "936b12da.8ecb78",
        "name": "To Domoticz op Syno",
        "topic": "domoticz/in",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "7fb3e06.2d91f2",
        "x": 660,
        "y": 120,
        "wires": []
    },
    {
        "id": "9ce4ad303671b7b2",
        "type": "function",
        "z": "936b12da.8ecb78",
        "name": "MQTT Growatt naar JSON voor Syno",
        "func": "let pvstatustext;\nlet result = msg.payload;\n\nswitch (msg.payload.values.pvstatus) {\n    case 0:\n        pvstatustext = \"Wachten\";\n        break;\n    case 1:\n        pvstatustext = \"Normaal\";\n        break;\n    case 2:\n        pvstatustext = \"Storing\";\n        break;\n}\n\nmsg.payload = {\"command\":\"udevice\",\"idx\":1261,\"nvalue\": result.values.pvstatus,\"svalue\": pvstatustext}\nnode.send (msg);\nnode.done;\n\nmsg.payload = { \"command\": \"udevice\", \"idx\": 2306, \"nvalue\": 0, \"svalue\": (result.values.pvpowerin/10).toString() };\nnode.send (msg);\nnode.done;\n\nmsg.payload = { \"command\": \"udevice\", \"idx\": 1263, \"nvalue\": 0, \"svalue\": (result.values.pv1voltage/10).toString() };\nnode.send (msg);\nnode.done;\n\nmsg.payload = { \"command\": \"udevice\", \"idx\": 1264, \"nvalue\": 0, \"svalue\": (result.values.pv1current/10).toString() };\nnode.send (msg);\nnode.done;\n\nmsg.payload = { \"command\": \"udevice\", \"idx\": 2315, \"nvalue\": 0, \"svalue\": (result.values.pvfrequentie/100).toString() };\nnode.send (msg);\nnode.done;\n\nmsg.payload = { \"command\": \"udevice\", \"idx\": 1266, \"nvalue\": 0, \"svalue\": (result.values.pvgridvoltage/10).toString() };\nnode.send (msg);\nnode.done;\n\nmsg.payload = { \"command\": \"udevice\", \"idx\": 1267, \"nvalue\": 0, \"svalue\": (result.values.pvgridcurrent/10).toString() };\nnode.send (msg);\nnode.done;\n\nmsg.payload = { \"command\": \"udevice\", \"idx\": 1268, \"nvalue\": 0, \"svalue\": (result.values.pvgridpower/10).toString() };\nnode.send (msg);\nnode.done;\n\nmsg.payload = { \"command\": \"udevice\", \"idx\": 1269, \"nvalue\": 0, \"svalue\": (result.values.pvtemperature/10).toString() };\nnode.send (msg);\nnode.done;\n\nmsg.payload = { \"command\": \"udevice\", \"idx\": 1272, \"nvalue\": 0, \"svalue\": (result.values.pvipmtemperature/10).toString() };\nnode.send (msg);\nnode.done;\n\nmsg.payload = { \"command\": \"udevice\", \"idx\": 1275, \"nvalue\": 0, \"svalue\": (result.values.totworktime/7200).toFixed(1) };\nnode.send (msg)\nnode.done;\n\nmsg.payload = { \"command\": \"udevice\", \"idx\": 2311, \"nvalue\": 0, \"svalue\": (result.values.pvpowerout/10).toString() + \";\" + (result.values.pvenergytotal*100).toString() };\nnode.send (msg);\nnode.done;\n\nmsg.payload = { \"command\": \"udevice\", \"idx\": 1276, \"nvalue\": 0, \"svalue\": (result.values.pvenergytotal *100).toString() };\nnode.send(msg);\nnode.done;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 350,
        "y": 120,
        "wires": [
            [
                "733eede6.d10984",
                "6bed263.b6565d8"
            ]
        ]
    },
    {
        "id": "7fb3e06.2d91f2",
        "type": "mqtt-broker",
        "name": "",
        "broker": "192.168.1.18",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
]
Maybe some work to do. But very nice solution.
Pieter

Re: Growatt-inverter.php does not work anymore

Posted: Friday 29 September 2023 12:24
by zicht
I am getting a 403 currently.
Searching the web it looks like i am not alone. Its reported from everywhere (the servers get sometimes unstable)

Re: Growatt-inverter.php does not work anymore

Posted: Friday 29 September 2023 12:28
by PieterS
My only problem today is lack of sunshine.. 8-)

Re: Growatt-inverter.php does not work anymore

Posted: Monday 02 October 2023 10:59
by rick8245
Still does not work,
Does anybody know an alternative ??

Re: Growatt-inverter.php does not work anymore

Posted: Monday 02 October 2023 13:23
by waltervl
If you search github on Growatt then it seems a lot of projects have the same issue. Some suggest that it is a failure on the Growatt server. So you have to wait for someone (or Growatt) to be able to fix it. Or use the grott application that does not use the Growatt server but is also not that easy to install.

Re: Growatt-inverter.php does not work anymore

Posted: Monday 02 October 2023 13:34
by rick8245
Thanks Waltervl.
Do you have link of the grott application ? At least I can take a look at it.
Does it work in Domoticz ? if not I will wait for a solution .

I now use the gui and the app on my phone. they still work ok but Domoticz is not updated

Re: Growatt-inverter.php does not work anymore

Posted: Monday 02 October 2023 14:30
by wim57
https://github.com/johanmeijer/grott

I use it for more than 2 years with a self-coded extension to interface with Domoticz via http but you can alo use MQTT.

Re: Growatt-inverter.php does not work anymore

Posted: Monday 02 October 2023 14:38
by PieterS
This is the result of the data from the Growatt inverter in Domoticz.

Image

My inverter is a single string and single fase.

No idea what info you have from that inverter in Domoticz. You did not tell much about your setup.
But there is some common info in my message above.

Re: Growatt inverter php does not work anymore

Posted: Monday 02 October 2023 21:55
by phkpr
I hope it will be solved soon.
Until then, I use a self-made script to enter the kwH values manually.
I run it at least 1 time in the evening.
You must use the cumulative kWh value that your ShinPhone app shows.

1. Login to Domoticz via SSH
2. Install mosquitto including mosquitto_pub

3, Create a script called: updateSun (with vi or nano)
Copy the lines below into the file, modify the idx value as descripbed in the comment line and save the file.
Make it executable: chmod +x ./updateSun
Run it: ./updateSun 123456 (example, you can use decimals using a dot)
#################################
#set -x
Sun=`echo " $1 * 1000 "| bc`
echo Sun $Sun

# Replace the idx value in line below with the idx value of your "SUN Inverter (kWh)" device
C1='{"idx": 25, "svalue": "100;'
C2=$Sun
C3='", "parse" : false }'
COMMANDO=$C1$C2$C3
/usr/bin/mosquitto_pub -h localhost -p 1883 -m "$COMMANDO" -t domoticz/in
#################################

Re: Growatt-inverter.php does not work anymore

Posted: Monday 02 October 2023 22:33
by waltervl
Hmm, it is easier to use an html API cal (Url)

Code: Select all

http://DomoticzIP:Port/json.htm?type=command&param=udevice&idx=IDX&nvalue=0&svalue=POWER;ENERGY
See also wiki for more info https://www.domoticz.com/wiki/Domoticz_ ... counter.29

Multiply the Energy kWh with 1000 as it is stored in Domoticz in Wh.

Re: Growatt-inverter.php does not work anymore

Posted: Tuesday 03 October 2023 7:30
by rick8245
Thank you guys for helping me out on this.

Re: Growatt-inverter.php does not work anymore

Posted: Tuesday 03 October 2023 9:35
by rick8245
hi phkpr,

If I use your script I get this error:
(standard_in) 1: syntax error
Sun
Connection error: Connection Refused: not authorised.
Error: The connection was refused.

regards, Richard

Re: Growatt-inverter.php does not work anymore

Posted: Tuesday 03 October 2023 11:00
by waltervl
as mentioned it is far more easy to use the URL as you can run it from any system in your network.
for POWER fill in 0.
So for example
cumulative kWh is 123254

Code: Select all

http://192.1.1.25:808/json.htm?type=command&param=udevice&idx=123&nvalue=0&svalue=0;123254000

Re: Growatt-inverter.php does not work anymore

Posted: Tuesday 03 October 2023 11:20
by rick8245
Ho Waltervl

I tried that json lin also but i does not really update the counters.

If I insert svalue=0;1122223 is updates the counters to 0 and 1122223
If I insert svalue=300;1122223 is updates the counters to 300 and 1122223

So this deos not seem to be the real values or do i something wrong

Re: Growatt-inverter.php does not work anymore

Posted: Tuesday 03 October 2023 12:22
by waltervl
The API call depends somewhaT on the type of device you are using.
From the php script is should be a Virtual Sensor -> Electric (instant+Counter), the API link is created for this device.

You have to multiply the value you read from the app with 1000. So in the app cumulative kWh is 1122223 you should send 1122223000
And you should not send fake values here else you get issues in reporting the correct data.
POWER is current Watt (but only used to display, not used for calculation)
Energy = cumulative kWh*1000 and is used to calculate the daily usage.

Posted: Wednesday 04 October 2023 11:37
by Achterhoeker
For who is interested:
I have made the switch now to the grott implementation. (on git hub) That worked directly without problems.

But I didn't want to use mqtt, so i made a simple little extension that only updates my energy counters in domoticz. (that is all i need)
The example extension for this can be found under: pull request 433 in the github grott repo.