Python Plugin: GoodWe solar inverter via SEMS API

Python and python framework

Moderator: leecollings

JanJaap
Posts: 215
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 »

Good news!

when you precede a command with sudo it is execute as admin.

What I normally do is:
cd domoticz
sudo chown pi "goodwe panelen.log" (fill in correct filename, "" needed due to space in filename)
After that you can either access it through notepad++ with FTP or using winscp transfer to windows PC
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
Zeil
Posts: 7
Joined: Sunday 03 December 2023 15:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by Zeil »

Het is zeker goed nieuws!

I can see in Domoticz that it got its data from Sems portal, i guess it's working.
Also thanks for the little course on how to get admin om my Goodwe logfile in Domoticz,
and got it copied to my windows pc. (there is a lot of data in that file..)

Now beside my solarpanel Inverter, and Zigbee2MQTT (with some powermonitoring) data,
My smart home adventure needs only one thing more, and that is putting my
Mitsubitshi Heavy Industries Airco's in Domoticz, but that seems a hell of a job.
got the Mitsubishi Heatpump MQTT interface Plugin installed but cannot pull data from it..
(but this is another topic)
evb28
Posts: 3
Joined: Sunday 07 April 2024 13:10
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by evb28 »

hello folks

I'm trying to setup the plugin to monitor my newly installed GoodWe inverter, but I'm getting the same error message right after posting data into the plugin's configuration:

2024-04-05 14:57:47,288 - INFO - plugin.py - starting plugin version 4.0.1
2024-04-05 14:57:47,288 - INFO - plugin.py - Starting version: 4.0.1
2024-04-05 14:57:47,288 - DEBUG - plugin.py - checking versions: current '4.0.1', config '4.0.1'
2024-04-05 14:57:47,289 - DEBUG - plugin.py - startDeviceUpdate, token availability: 'False'
2024-04-05 14:57:47,289 - DEBUG - GoodWe.py - build tokenRequest with UN: '[email protected]', pwd: 'xxx'
2024-04-05 14:57:47,289 - DEBUG - GoodWe.py - build apiRequestHeaders with token: '{"client": "web", "version": "v3.1", "language": "en-GB"}'
2024-04-05 14:57:47,290 - ERROR - GoodWe.py - TokenRequestException: Failed to parse: https://www.semsportal.com/api/v2/Common/CrossLogin

The activated debug option doesn't help here since no extra data is available.

Can you please help and push me in the right direction when troubleshooting?

Thanks!
User avatar
waltervl
Posts: 5842
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 »

Do you have strange characters in your email or password? As that sometimes get parsed wrongly... (not knowing if this really is the case).
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
JanJaap
Posts: 215
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 »

This could be the case indeed with special characters in the password. Can you give it a try with only alphanumeric characters in your password?
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
evb28
Posts: 3
Joined: Sunday 07 April 2024 13:10
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by evb28 »

yep, I've just changed the password to letters-and-numbers only (it was the case before, but it's more simplified now) and the error message is the same

2024-04-07 23:32:26,190 - INFO - plugin.py - starting plugin version 4.0.1
2024-04-07 23:32:26,190 - INFO - plugin.py - Starting version: 4.0.1
2024-04-07 23:32:26,207 - ERROR - GoodWe.py - TokenRequestException: Failed to parse: https://www.semsportal.com/api/v2/Common/CrossLogin
JanJaap
Posts: 215
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 »

Hey,

When looking at the first error you will see that changing the loglevel did indeed create additional loglines marked DEBUG which do help to find out where the exception is created (as this error is created in more than 1 place).

Now I did a couple of tests with entering an incorrect password which contained some special characters like !@%& and this was no issue: it correctly reported that I entered a wrong pwd.

Now I did see some (old.....) remarks on stackoverflow about requests lib and its base urllib3 being incompatible, so need some more info:
- what OS + version are you on?
- which python version? is shown in Domoticz log at startup or in the 'about' screen
- which version of requests?
- which version of urllib3?

I'm running python 3.9.2, requests 2.31.0 and urllib3 1.26.5
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
evb28
Posts: 3
Joined: Sunday 07 April 2024 13:10
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by evb28 »

JanJaap wrote: Monday 08 April 2024 22:42 Hey,

When looking at the first error you will see that changing the loglevel did indeed create additional loglines marked DEBUG which do help to find out where the exception is created (as this error is created in more than 1 place).

Now I did a couple of tests with entering an incorrect password which contained some special characters like !@%& and this was no issue: it correctly reported that I entered a wrong pwd.

Now I did see some (old.....) remarks on stackoverflow about requests lib and its base urllib3 being incompatible, so need some more info:
- what OS + version are you on?
- which python version? is shown in Domoticz log at startup or in the 'about' screen
- which version of requests?
- which version of urllib3?

I'm running python 3.9.2, requests 2.31.0 and urllib3 1.26.5
Hey, this is my setup

Debian 11.9
python3.9/oldstable,now 3.9.2-1 amd64 [installed,automatic]
python3-requests/oldstable,now 2.25.1+dfsg-2 all [installed,automatic]
python3-urllib3/oldstable,now 1.26.5-1~exp1 all [installed,automatic]

I see that the difference is only in the requests version (2.25.1 vs 2.31.0).

So after upgrading to Debian 12 - the issue has been resolved and the plugin works now.

Thanks for the hint!
Last edited by evb28 on Tuesday 09 April 2024 10:09, edited 1 time in total.
azonneveld
Posts: 160
Joined: Wednesday 02 October 2019 7:37
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by azonneveld »

I noticed that the log file grows very large, about 1 MB per day (in my case: goodwe Goodwe.log).

domo V2024.7
plugin 4.0.1
Raspbian Bookworm (32 bit)
RPI4



What is wrong?

Here's a snippet of the file

Code: Select all

2025-01-26 17:15:15,657 - INFO     - GoodWe.py          - PowerStation created: 'b1193c2f-ad19-419c-bb41-xxxx'
2025-01-26 17:15:15,658 - INFO     - plugin.py          - creating units for device with serial number: 53000DSNxxxx
2025-01-26 17:15:15,659 - INFO     - plugin.py          - finished creating devices, current count: 18
2025-01-26 17:15:15,659 - INFO     - plugin.py          - Status of GoodWe inverter (SN: 53000DSNxxxx): '1 generating'
2025-01-26 17:16:11,430 - INFO     - GoodWe.py          - PowerStation created: 'b1193c2f-ad19-419c-bb41-xxxx'
2025-01-26 17:16:11,431 - INFO     - plugin.py          - creating units for device with serial number: 53000DSNxxxx
2025-01-26 17:16:11,431 - INFO     - plugin.py          - finished creating devices, current count: 18
2025-01-26 17:16:11,432 - INFO     - plugin.py          - Status of GoodWe inverter (SN: 53000DSNxxxx): '1 generating'
2025-01-26 17:17:11,868 - INFO     - GoodWe.py          - PowerStation created: 'b1193c2f-ad19-419c-bb41-xxxx'
2025-01-26 17:17:11,869 - INFO     - plugin.py          - creating units for device with serial number: 53000DSNxxxx
2025-01-26 17:17:11,870 - INFO     - plugin.py          - finished creating devices, current count: 18
2025-01-26 17:17:11,870 - INFO     - plugin.py          - Status of GoodWe inverter (SN: 53000DSNxxxx): '1 generating'
2025-01-26 17:18:10,488 - INFO     - GoodWe.py          - PowerStation created: 'b1193c2f-ad19-419c-bb41-xxxx'
2025-01-26 17:18:10,488 - INFO     - plugin.py          - creating units for device with serial number: 53000DSNxxxx
2025-01-26 17:18:10,488 - INFO     - plugin.py          - finished creating devices, current count: 18
2025-01-26 17:18:10,489 - INFO     - plugin.py          - Status of GoodWe inverter (SN: 53000DSNxxxx): '1 generating'
2025-01-26 17:19:11,109 - INFO     - GoodWe.py          - PowerStation created: 'b1193c2f-ad19-419c-bb41-xxxx'
2025-01-26 17:19:11,110 - INFO     - plugin.py          - creating units for device with serial number: 53000DSNxxxx
2025-01-26 17:19:11,111 - INFO     - plugin.py          - finished creating devices, current count: 18
2025-01-26 17:19:11,112 - INFO     - plugin.py          - Status of GoodWe inverter (SN: 53000DSNxxxx): '1 generating'
2025-01-26 17:20:10,793 - INFO     - GoodWe.py          - PowerStation created: 'b1193c2f-ad19-419c-bb41-xxxx'
2025-01-26 17:20:10,795 - INFO     - plugin.py          - creating units for device with serial number: 53000DSNxxxx
2025-01-26 17:20:10,795 - INFO     - plugin.py          - finished creating devices, current count: 18
2025-01-26 17:20:10,796 - INFO     - plugin.py          - Status of GoodWe inverter (SN: 53000DSNxxxx): '1 generating'
2025-01-26 17:21:11,103 - INFO     - GoodWe.py          - PowerStation created: 'b1193c2f-ad19-419c-bb41-xxxx'
2025-01-26 17:21:11,104 - INFO     - plugin.py          - creating units for device with serial number: 53000DSNxxxx
2025-01-26 17:21:11,105 - INFO     - plugin.py          - finished creating devices, current count: 18
2025-01-26 17:21:11,105 - INFO     - plugin.py          - Status of GoodWe inverter (SN: 53000DSNxxxx): '1 generating'
2025-01-26 17:22:10,479 - INFO     - GoodWe.py          - PowerStation created: 'b1193c2f-ad19-419c-bb41-xxxx'
2025-01-26 17:22:10,480 - INFO     - plugin.py          - creating units for device with serial number: 53000DSNxxxx
2025-01-26 17:22:10,480 - INFO     - plugin.py          - finished creating devices, current count: 18
2025-01-26 17:22:10,481 - INFO     - plugin.py          - Status of GoodWe inverter (SN: 53000DSNxxxx): '1 generating'
2025-01-26 17:23:11,192 - INFO     - GoodWe.py          - PowerStation created: 'b1193c2f-ad19-419c-bb41-xxxx'
2025-01-26 17:23:11,193 - INFO     - plugin.py          - creating units for device with serial number: 53000DSNxxxx
2025-01-26 17:23:11,194 - INFO     - plugin.py          - finished creating devices, current count: 18
2025-01-26 17:23:11,194 - INFO     - plugin.py          - Status of GoodWe inverter (SN: 53000DSNxxxx): '1 generating'
2025-01-26 17:24:10,626 - INFO     - GoodWe.py          - PowerStation created: 'b1193c2f-ad19-419c-bb41-xxxx'
2025-01-26 17:24:10,627 - INFO     - plugin.py          - creating units for device with serial number: 53000DSNxxxx
2025-01-26 17:24:10,627 - INFO     - plugin.py          - finished creating devices, current count: 18
2025-01-26 17:24:10,628 - INFO     - plugin.py          - Status of GoodWe inverter (SN: 53000DSNxxxx): '1 generating'
2025-01-26 17:25:10,908 - INFO     - GoodWe.py          - PowerStation created: 'b1193c2f-ad19-419c-bb41-xxxx'
2025-01-26 17:25:10,909 - INFO     - plugin.py          - creating units for device with serial number: 53000DSNxxxx
2025-01-26 17:25:10,909 - INFO     - plugin.py          - finished creating devices, current count: 18
2025-01-26 17:25:10,910 - INFO     - plugin.py          - Status of GoodWe inverter (SN: 53000DSNxxxx): '1 generating'
rpi4 - zigbee2mqtt - roborock - espeasy - rfxcom - homewizard p1 - otgw - homebridge - surveillance station - egardia - goodwe - open weather map - wol - BBQ detection - rsync backup
JanJaap
Posts: 215
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 nothing changed. But my own file is also immense...... So I just pushed a change to log only 1 line per update as the other 3 didn't make much sense....
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
azonneveld
Posts: 160
Joined: Wednesday 02 October 2019 7:37
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by azonneveld »

JanJaap wrote: Sunday 26 January 2025 19:36 So I just pushed a change to log only 1 line per update as the other 3 didn't make much sense....
That already saves 66%, thanks!

Is there a way to disable the logging for 'info' status?
rpi4 - zigbee2mqtt - roborock - espeasy - rfxcom - homewizard p1 - otgw - homebridge - surveillance station - egardia - goodwe - open weather map - wol - BBQ detection - rsync backup
User avatar
waltervl
Posts: 5842
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 »

Disable the info logging for an hardware gateway (like a python plugin) is done in the hardware gateway settings. There are 3 setting switches available for showing info, status and/or error logging per gateway.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
JanJaap
Posts: 215
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 it aint that simple Walter as I'm using the logging package to write to a dedicated logfile ;) But I guess I can move that last one to debug too as that is when it makes most sense anyway
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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest