pip3 install paho-mqtt --break-system-packages
I don’t think that this will cause any problems for my system (only openhab) but if somebody has an easy but more elegant or correct solution please tell us.
I downloaded the python library and made the goodwetest.py script.
I am not sure were to place it. I am on OH 4.1.1 on a Raspberry 3. I made the file access via samba. I tried:
\…\openHAB-conf\scripts
\…\openHAB-userdata\etc\scripts
None of these places work.
The error message in openhabian via putty is:
python3: can’t open file ‘/home/openhabian/goodwetest.py’: [Errno 2] No such file or directory
How can I fix it?
\\sharename\openHAB-conf\scripts
Apparently python3 looks in your home directory. Before you execute the script, you should go to the correct directory and then execute it:
cd /etc/openhab/scripts
python3 goodwetest.py
Or you can put it in your home directory and execute it without changing directories. But the definitive files goodwejson.py and goodwe.sh must be placed in /etc/openhab/scripts.
I implemented all above and made my changes to the items file etc… (Hopefully it survives the next update).
I get the data into openhab. However, there is an error issued:
2024-02-01 21:26:21.420 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item ‘ZP_JSON_Out’ updated to { “ppv”: 0, “total_inverter_power”: 171, “active_power”: -23, “grid_in_out”: 0, “load_p1”: 18, “load_p2”: 70, “load_p3”: 79, “load_ptotal”: 167, “temperature_air”: 31.3, “pbattery1”: 126, “battery_mode”: 2, “e_day”: 9.4, “house_consumption”: 149, “battery_temperature”: 19.0, “battery_soc”: 53, “battery_soh”: 99, “end”: 0 }
/etc/openhab/scripts/goodwe.sh: line 2: $‘\r’: command not found
/etc/openhab/scripts/goodwe.sh: line 4: $‘\r’: command not found
/etc/openhab/scripts/goodwe.sh: line 2: $‘\r’: command not found
/etc/openhab/scripts/goodwe.sh: line 4: $‘\r’: command not found
The goodwe.sh is copied and pasted as given in the first post. I just re-did it and saved it in UFT-8 format. The error message is still there. This error is issued three times and then all the values come in formated style.
Can anyone spot the issue? What do I need to change?
You used a Windows text editor to save the file.
In Windows each line in a text file ends with two characters: carriage return (CR or \r) and line feed (LF or \n).
In Unix style text files only the linefeed is used.
So you need to convert the file to Unix style. This can be done in different ways. One possibility is:
awk '{ sub("\r$", ""); print }' winfile.txt > unixfile.txt
The errors would probably also go away if you delete the empty lines 2 and 4.
One remark for items definition. Some of the items defined are not energy but power. E.g. for Number:Power zpActivePower “zpActivePower [%.0f W]”
That makes the difference in the items overview. Otherwise there the wrong unit kWh instead of W is shown. When you click into the item the unit is always as defined in “[” “]”.
For information: I changed a little my above script and the things-file:
remove loop from python-script so that only openhab loops
increase looping delay to 180sec, because polling more often breaks the connection of the inverter to the sems-portal. (The critical time seems to be different for different models)
hello guys, I was just on the way to set up openhabian and connect it to Goodwe inverter with battery. Nice work done already acording to that thread. But I did not saw anyone to also send some commands to inverter… Anybody tried for example set up export limit? Or force charging battery?
Best regards, Alex
According to this post, with Debian bookworm you should install the goodwe library for the openhab user:
sudo -u openhab pip install goodwe
Hi all,
At first, thanks for this great solution! I implemented it yesterday, and it provides all the data I missed on the semsportal plugin.
But I have a strange issue since I poll my Inverter. The semsportal doesn’t show any data anymore since I’m doing that. If I stop using the script to get the data, Semsportal show the data again after a few minutes.
Are I’m the only one having this issue? I’m catching the data each minute…
And another question: The binding delivers a value totalkwh month. I can’t find that in the sensor data. What are I’m missing?
Thanks,
Denis
I don’t have this problem. Polling 11 items every minute and no problems with Semsportal.
Are you polling much more items? Or are you using the binding too?
HuberDe:
That’s bad! Maybe I should ask goodwe if this is a known issue. Thanks for the info!
Even better would be a proper modbus/tcp-support. So better ask for that.
On the other hand: What’s wrong with polling every 2 or 3 minutes? That should IMHO be enough for a decent control of devices so that they use surplus power.
Polling every 2-3 minutes doesn’t work. It has to be at least 4 minutes. There are more bad things on that world. But my shellys report the power several times per minute. If I want to do charts where the usage of the house matches the different power lanes, it’s more accurate if I get more values from the goodwe, too.
But yes I can live with 4 minutes, too…