Python Plugin: GoodWe solar inverter via SEMS API

Python and python framework

Moderator: leecollings

tonymer
Posts: 16
Joined: Wednesday 15 June 2022 16:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by tonymer »

One of the data that is seen both in the SEMS portal or through PV Master is the energy that is being taken from the grid (in -) or the energy that is being exported to the grid (in +). I know at all times how much energy I have left over and it is injected into the public network or, on the contrary, how much I lack and I buy from the public network. The investor and SEMS know it through the Meter. Sorry for my English
User avatar
waltervl
Posts: 5721
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by waltervl »

When I look in my SEMS portal I only can see what the solar inverter is sending to my home. And that is logical as the only thing my solar inverter can do is create solar generated power. It does not know if it is consumed in my house or sent to the grid.

But perhaps you post a screenshot of your SEMS portal of what you see. As your request confuses me too :)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
tonymer
Posts: 16
Joined: Wednesday 15 June 2022 16:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by tonymer »

This is part of the screen of my SEMS Portal
Flujo de Energia.jpg
Flujo de Energia.jpg (75.94 KiB) Viewed 2480 times
tonymer
Posts: 16
Joined: Wednesday 15 June 2022 16:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by tonymer »

That data is in the inverter because I see it with PV master and SEMS portal. When it consumes from the grid, the arrow goes out towards the house
JanJaap
Posts: 209
Joined: Thursday 12 October 2017 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Dev
Location: the Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by JanJaap »

Looks Fancy ;)

As mentioned, I need the data structure that SEMS API returns, as explained in earlier post (refer to issue 14). Once you provide the info (preferably via PM) I can have a look at it.
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
tonymer
Posts: 16
Joined: Wednesday 15 June 2022 16:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by tonymer »

Hello, if you tell me what program I can use to see the data flow going into the inverter and PM Master. The Pv master connects to a Wifi provided by the inverter. I have done tests with Packet Sender and right now it only responds to its native AA55 protocol. A few days ago it answered modBus sequences but I don't know why now it doesn't.
tonymer
Posts: 16
Joined: Wednesday 15 June 2022 16:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by tonymer »

if you tell me what to do i can help
JanJaap
Posts: 209
Joined: Thursday 12 October 2017 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Dev
Location: the Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by JanJaap »

Hi,

It is kind of in issue 14 on github:
pull the addBattery version of the plug in:

Code: Select all

cd domoticz/plugins/domoticz-GoodWeSEMS
git checkout addBattery
git pull 
the go to domoticz hardware page, enable debug logging in the GoodWE plugin config and hit 'update'

Now after some time there will appear a file called goodwe.log in /domoticz. Get that file off the RPi (you may have to chown it for acces rights), remove any password/user info and send me the info that is returned in a logline that starts with: response station data request
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
tonymer
Posts: 16
Joined: Wednesday 15 June 2022 16:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by tonymer »

Hello, before doing that, comment that I have done tests with Packet Sender and I have the frame of bytes that must be sent to the inverter's IP and I have the frame that it returns with positions 45-46 (Watts Import/Export) and position 87 (0=Standby, 1=Exporting, 2=Importing) in case you want me to send you the request and the response from my investor. Although it is hydrido I do not have a battery for now. Cheers
janvier123
Posts: 36
Joined: Saturday 17 September 2016 22:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by janvier123 »

JanJaap wrote: Monday 20 June 2022 21:02 Looks Fancy ;)

As mentioned, I need the data structure that SEMS API returns, as explained in earlier post (refer to issue 14). Once you provide the info (preferably via PM) I can have a look at it.
I have no idea if its relevant or not, but here is my (personal) dump of the API

https://pastebin.com/kV2aKNR7

and some more info: https://github.com/DiedB/Homey-SolarPan ... -521042829
JanJaap
Posts: 209
Joined: Thursday 12 October 2017 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Dev
Location: the Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by JanJaap »

tonymer wrote: Wednesday 22 June 2022 11:12 Hello, before doing that, comment that I have done tests with Packet Sender and I have the frame of bytes that must be sent to the inverter's IP and I have the frame that it returns with positions 45-46 (Watts Import/Export) and position 87 (0=Standby, 1=Exporting, 2=Importing) in case you want me to send you the request and the response from my investor. Although it is hydrido I do not have a battery for now. Cheers
Hi Tony,

What you are doing does not go via the SEMS web API. My pluging (for which this topic is) accesses the web API (on www.semsportal.com) to fetch the data. You are accessing the inverter directly so I cannot use that info. I need the logging as described earlier (presuming this data is also sent to this cloud server).
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
Darsh
Posts: 12
Joined: Tuesday 21 February 2017 13:37
Target OS: Linux
Domoticz version: 2022.1
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by Darsh »

GoodWe plugin started to crash Domoticz with "Call to function 'onHeartbeat' failed" error message.
domoticz_crash.log has zero size.

occurencies:
Spoiler: show
root@emc2:/var/log/domoticz# grep -i heart /var/log/domoticz/domoticz.log
2022-06-22 02:13:26.583 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 03:36:58.171 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 05:10:56.164 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 07:31:23.176 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 08:29:56.156 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 09:29:41.079 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 14:11:25.156 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 18:55:13.159 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 21:13:26.228 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
full error message from the most recent crash:
Spoiler: show
2022-06-23 21:13:26.228 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 21:13:26.228 Error: Domoticz(pid:2116870, tid:2116895('GoodWe GW2500-N')) received fatal signal 11 (Segmentation fault)
2022-06-23 21:13:26.228 Error: siginfo address=0x7700204d06, address=0x7ff2e3651fe1
2022-06-23 21:13:26.234 Error: Failed to start gdb, will use backtrace() for printing stack frame

2022-06-23 21:13:26.236 Error: #0 /home/domovoi/domoticz/domoticz : + 0x3f1c33 [0x561af3beec33]
2022-06-23 21:13:26.236 Error: #1 /home/domovoi/domoticz/domoticz : signal_handler(int, siginfo_t*, void*) + 0x29d [0x561af3bef71d]
2022-06-23 21:13:26.236 Error: #2 /lib/x86_64-linux-gnu/libpthread.so.0 : + 0x14140 [0x7ff2e3652140]
2022-06-23 21:13:26.236 Error: #3 /lib/x86_64-linux-gnu/libpthread.so.0 : raise + 0x141 [0x7ff2e3651fe1]
2022-06-23 21:13:26.236 Error: #4 /lib/x86_64-linux-gnu/libpthread.so.0 : + 0x14140 [0x7ff2e3652140]
2022-06-23 21:13:26.236 Error: #5 /usr/lib/x86_64-linux-gnu/libpython3.9.so : + 0x1249d8 [0x7ff2e24899d8]
2022-06-23 21:13:26.236 Error: #6 /usr/lib/x86_64-linux-gnu/libpython3.9.so : _PyObject_MakeTpCall + 0x90 [0x7ff2e242ba50]
2022-06-23 21:13:26.236 Error: #7 /usr/lib/x86_64-linux-gnu/libpython3.9.so : _PyEval_EvalFrameDefault + 0x7248 [0x7ff2e23dbf08]
2022-06-23 21:13:26.236 Error: #8 /usr/lib/x86_64-linux-gnu/libpython3.9.so : + 0x1a4ddc [0x7ff2e2509ddc]
2022-06-23 21:13:26.236 Error: #9 /usr/lib/x86_64-linux-gnu/libpython3.9.so : _PyFunction_Vectorcall + 0x9d [0x7ff2e2426c7d]
2022-06-23 21:13:26.236 Error: #10 /usr/lib/x86_64-linux-gnu/libpython3.9.so : + 0xc8724 [0x7ff2e242d724]
2022-06-23 21:13:26.236 Error: #11 /usr/lib/x86_64-linux-gnu/libpython3.9.so : PyObject_CallFunctionObjArgs + 0x9f [0x7ff2e242dbaf]
2022-06-23 21:13:26.236 Error: #12 /home/domovoi/domoticz/domoticz : Plugins::CPlugin::LogPythonException() + 0x1bc [0x561af408c19c]
2022-06-23 21:13:26.236 Error: #13 /home/domovoi/domoticz/domoticz : Plugins::CPlugin::Callback(_object*, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, _object*) + 0x1b6 [0x561af408e806]
2022-06-23 21:13:26.236 Error: #14 /home/domovoi/domoticz/domoticz : Plugins::CPluginMessageBase::Process(Plugins::CPlugin*) + 0x2b [0x561a
f3b6d32b]
2022-06-23 21:13:26.236 Error: #15 /home/domovoi/domoticz/domoticz : Plugins::CPlugin::Do_Work() + 0x490 [0x561af40962f0]
2022-06-23 21:13:26.236 Error: #16 /home/domovoi/domoticz/domoticz : + 0xb546d0 [0x561af43516d0]
2022-06-23 21:13:26.236 Error: #17 /lib/x86_64-linux-gnu/libpthread.so.0 : + 0x8ea7 [0x7ff2e3646ea7]
2022-06-23 21:13:26.236 Error: #18 /lib/x86_64-linux-gnu/libc.so.6 : clone + 0x3f [0x7ff2e3412def]
Version: Domoticz 2022.1 (build 14231), OpenZWave 1.6.1965
Platform: Debian 11 (uname -a: "Linux emc2 5.10.0-10-amd64 #1 SMP Debian 5.10.84-1 (2021-12-08) x86_64 GNU/Linux")
Plugin: domoticz-GoodWeSEMS (https://github.com/JanJaapKo/domoticz-GoodWeSEMS.git)

I've updated the plugin to the latest version with "git pull", restarted domoticz - and got another crash in about an hour.
What can it be? How can this be fixed?


Darsh
JanJaap
Posts: 209
Joined: Thursday 12 October 2017 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Dev
Location: the Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by JanJaap »

Segmentation faults are quite nasty as they provide very little usefull info..... Normally this means, if I understand correctly, that wha tthe plugin does in Python leads to a problem in de C core of Domoticz. Di dyou update anything before this happened?

I'm running bullseye/debian 11 as well with no issue, however on latest development version though.

Interesting is the fact that it runs ok for an hour and then starts crashing. Could be that has something to do with illegal content returned from Web API but not sure.

Maybe @waltervl has an idea how this could be trouble shooted?
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
Darsh
Posts: 12
Joined: Tuesday 21 February 2017 13:37
Target OS: Linux
Domoticz version: 2022.1
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by Darsh »

I didn't do or update anything, it just started crashing out of a blue. Here's the full list of crashes at the moment:
Spoiler: show
root@emc2:~# grep onHeartbeat /var/log/domoticz/domoticz.log
2022-06-22 02:13:26.583 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 03:36:58.171 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 05:10:56.164 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 07:31:23.176 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 08:29:56.156 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 09:29:41.079 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 14:11:25.156 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 18:55:13.159 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-23 21:13:26.228 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-24 03:25:03.236 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-24 05:59:03.161 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-24 08:09:15.857 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-24 09:35:04.396 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-24 13:15:23.151 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
A watchdog script is checking at 17 minutes past each hour if the Domoticz is running, and starting it if it doesn't.

What is this "onHeartbeat" function doing? Can it be that GoodWe did a slight change in their web portal that is causing the crash, as the plugin is waiting for something and then gets an unexpected result?


Darsh
JanJaap
Posts: 209
Joined: Thursday 12 October 2017 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Dev
Location: the Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by JanJaap »

All right the heartbeat function is a periodic callback from the Domoticz plugin framework (see Developing a Python plugin for more info). I use that to poll the SEMS API. You configure the interval in the plugin (default 5 minutes) so it looks like most attempts are OK as the error seems to occur about max 10 times per day. However, it is annoying. I'll see if I can find some places to add try/catch clauses to handle this more elegantly.
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
Darsh
Posts: 12
Joined: Tuesday 21 February 2017 13:37
Target OS: Linux
Domoticz version: 2022.1
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by Darsh »

At the end it started crashing almost every hour:
Spoiler: show
2022-06-25 07:07:13.179 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-25 07:50:13.149 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-25 09:01:04.148 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
2022-06-25 11:02:13.151 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:
So I've removed the devices and respective hardware entry, removed and re-installed the plugin, and then re-created the devices. Looks like this fixed the problem. So far 20 hours of run with no crashes at all.

UPD: this hasn't fixed the problem: yet another crash an hour ago:
2022-06-27 10:20:25.194 Error: GoodWe GW2500-NS: Call to function 'onHeartbeat' failed, exception details:


Darsh
JanJaap
Posts: 209
Joined: Thursday 12 October 2017 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Dev
Location: the Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by JanJaap »

Well I cannot reproduce the error. And we would need the full error description, not just the line you're pasting here. I'd give it a try in the domoticz github, because it is a bit out of my league.......
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
Jeweettoch13
Posts: 7
Joined: Saturday 23 July 2022 16:42
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by Jeweettoch13 »

Hi Jeweettoch,

I'm guessing it ain't all that hard to make, guessing data is there. In both of the plugins.
I'm no coding expert unfortunately to get all 3 phases to readout. Already surprised that i got it all to work, that's all.

When i'm comparing it to the UDP readout you'll get about 3 times more data coming trough.
jslegers
Posts: 34
Joined: Tuesday 23 February 2016 9:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: NL
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by jslegers »

I see a lot of time outs for the eu server. Are other people also getting this? I have this now for a couple of days.
User avatar
waltervl
Posts: 5721
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by waltervl »

Yes, I have the same, a lot of timeouts. This weekend I downscaled the refresh rate from 5 to 10 minutes. It seems less now. Today only 1x.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest