Python Plugin: GoodWe solar inverter via SEMS API

Python and python framework

Moderator: leecollings

User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by Brutus »

JanJaap wrote: Monday 06 September 2021 22:44 Right, so the W(att) is not something the plugin does but that comes from how Domoticz deals with these devices, so can't help you there (and I try to avoid lua because python is much nicer). This topic is about the plugin, not about anything you can do with the data in domoticz.

I'll have a look at the updates later, although they look OK on my RPi.
The updates are going right now after installing the latest update..

I resolved the W issue with this line of code in my LUA:

Code: Select all

    local PowerGeneration = ""..PowerGeneration1..""
    PowerGeneration = PowerGeneration:sub(1, #PowerGeneration-1)
Thnx!

Greetings
Last edited by Brutus on Wednesday 08 September 2021 18:20, edited 3 times in total.
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
vinjon
Posts: 7
Joined: Tuesday 24 March 2020 9:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by vinjon »

it's working again for both inverters.
Thanx!
JanJaap
Posts: 191
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,

Well on my RPi 3 I do not have the issue with the update time, it behaves as expected:
1 minute setting (at 20:28):
5 minute setting (at 20:32);
log 1 and 5 minutes
log 1 and 5 minutes
log 1 5 minute.PNG (39.82 KiB) Viewed 2732 times
The code just counts down how often onHeartbeat is called. It could be that the heartbeat routine is called too often? I do not influence that from the plugin (although it is/should be possible to do so but in other plugins I found that that mechanism doesn't work).

Do you have other plugins where you can try this on?

In the meantime I also made some smaller updates to the plugin on error handling.
Attachments
log 1 minute
log 1 minute
log 1 minute.PNG (6.43 KiB) Viewed 2732 times
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
plenkske
Posts: 5
Joined: Saturday 01 February 2020 15:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by plenkske »

I have updated the plugin using "git pull", but I cant get it to work.
Getting the following error:

Code: Select all

2021-09-13 10:23:05.775 Error: Python Plugin System: (GoodWeSEMS) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2021-09-13 10:23:05.775 Error: Python Plugin System: (Zonnepanelen) Module Import failed, exception: 'ModuleNotFoundError'
2021-09-13 10:23:05.775 Error: Python Plugin System: (Zonnepanelen) Module Import failed: ' Name: requests'
2021-09-13 10:23:05.775 Error: Python Plugin System: (Zonnepanelen) Error Line details not available.
What I tried:
- checked the pyhton paths and they are there
- updated the urllib3 package like suggested in this thread
- restarted domoticz service
- with and without station ID

Nothing resulted in a change of the error message. Still getting the same.
Someone knows what I can try ?
User avatar
waltervl
Posts: 5149
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 »

plenkske wrote: Monday 13 September 2021 10:27 I have updated the plugin using "git pull", but I cant get it to work.
Getting the following error:

Code: Select all

2021-09-13 10:23:05.775 Error: Python Plugin System: (GoodWeSEMS) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2021-09-13 10:23:05.775 Error: Python Plugin System: (Zonnepanelen) Module Import failed, exception: 'ModuleNotFoundError'
2021-09-13 10:23:05.775 Error: Python Plugin System: (Zonnepanelen) Module Import failed: ' Name: requests'
2021-09-13 10:23:05.775 Error: Python Plugin System: (Zonnepanelen) Error Line details not available.
What I tried:
- checked the pyhton paths and they are there
- updated the urllib3 package like suggested in this thread
- restarted domoticz service
- with and without station ID

Nothing resulted in a change of the error message. Still getting the same.
Someone knows what I can try ?
You should now also have the python module requests installed.
Should be done with

Code: Select all

sudo pip3 install requests
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5149
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 »

waltervl wrote: Thursday 26 August 2021 16:24
Brutus wrote: Thursday 26 August 2021 13:56 The timings of the refresh interval are not working the way it needs to be.

When setting the refresh interval to 10 seconds the script pulls every second...
When setting the refresh interval to 30 seconds the script pulls the first time after 30 seconds after that it puls every second...
When setting the refresh interval to 1 minute the script pulls every 10 seconds.
When setting the refresh interval to 5 minutes the script pulls the first time after 5 minutes after that it pulls every 10 seconds...

Greetings
I can confirm, did not notice it yet, was happy that it worked again at last.
For me it is fixed with the latest version update. Now working on normal interval (1 min in my case).
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
plenkske
Posts: 5
Joined: Saturday 01 February 2020 15:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by plenkske »

waltervl wrote: Monday 13 September 2021 11:08
plenkske wrote: Monday 13 September 2021 10:27 I have updated the plugin using "git pull", but I cant get it to work.
Getting the following error:

Code: Select all

2021-09-13 10:23:05.775 Error: Python Plugin System: (GoodWeSEMS) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2021-09-13 10:23:05.775 Error: Python Plugin System: (Zonnepanelen) Module Import failed, exception: 'ModuleNotFoundError'
2021-09-13 10:23:05.775 Error: Python Plugin System: (Zonnepanelen) Module Import failed: ' Name: requests'
2021-09-13 10:23:05.775 Error: Python Plugin System: (Zonnepanelen) Error Line details not available.
What I tried:
- checked the pyhton paths and they are there
- updated the urllib3 package like suggested in this thread
- restarted domoticz service
- with and without station ID

Nothing resulted in a change of the error message. Still getting the same.
Someone knows what I can try ?
You should now also have the python module requests installed.
Should be done with

Code: Select all

sudo pip3 install requests
Haha, makes sense. I forgot to check that "requests" module... must be the monday morning ;)
It works now ! Thanks.

And just an FYI: without station ID I get this error message:
2021-09-13 11:23:48.927 Error: Python Plugin System: (Zonnepanelen) No Power Station ID provided, exiting

So thats very clear.
And for me the interval works fine too.
bldewit
Posts: 59
Joined: Tuesday 09 May 2017 23:31
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by bldewit »

In my case, a new device is created, Inverter Input Test Power. I see data being collected in this new device. My old devices Inveerter Input Power and Inverter Output Power however, where all of my previous data is stored of course, are not being updated anymore.

Anyone recognize this?

Verstuurd vanaf mijn SM-T590 met Tapatalk

-‐----------------------------------------------------------
Running on rPi 3b (main) and rPi 2b (somfy), both RFLink
IthoRemote, Xiaomi Gateway, KAKU
JanJaap
Posts: 191
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 »

In my case, all devices work fine (provided the sun shines :D ).

I need some more info:
- do you see errors in the logging?
- how many input strings?
- which exact devices are not being updated?
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
bldewit
Posts: 59
Joined: Tuesday 09 May 2017 23:31
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by bldewit »

I now see that i do have errormessages:

2021-09-15 08:52:15.127 Error: (Goodwe direct) RequestException: HTTPSConnectionPool(host='eu.semsportal.com', port=443): Read timed out. (read timeout=10)

2021-09-15 08:52:26.334 Error: (Goodwe direct) RequestException: HTTPSConnectionPool(host='eu.semsportal.com', port=443): Read timed out. (read timeout=10)

2021-09-15 08:52:44.525 Error: (Goodwe direct) RequestException: HTTPSConnectionPool(host='eu.semsportal.com', port=443): Read timed out. (read timeout=10)

2021-09-15 08:53:09.292 Error: Goodwe direct hardware (14) thread seems to have ended unexpectedly

2021-09-15 08:53:11.540 Error: (Goodwe direct) Failed to request data: Failed to call GoodWe API (too many retries)

Powerstation ID is provided in settings...Image

Verstuurd vanaf mijn SM-T590 met Tapatalk

-‐----------------------------------------------------------
Running on rPi 3b (main) and rPi 2b (somfy), both RFLink
IthoRemote, Xiaomi Gateway, KAKU
bldewit
Posts: 59
Joined: Tuesday 09 May 2017 23:31
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by bldewit »

bldewit wrote:I now see that i do have errormessages:

2021-09-15 08:52:15.127 Error: (Goodwe direct) RequestException: HTTPSConnectionPool(host='eu.semsportal.com', port=443): Read timed out. (read timeout=10)

2021-09-15 08:52:26.334 Error: (Goodwe direct) RequestException: HTTPSConnectionPool(host='eu.semsportal.com', port=443): Read timed out. (read timeout=10)

2021-09-15 08:52:44.525 Error: (Goodwe direct) RequestException: HTTPSConnectionPool(host='eu.semsportal.com', port=443): Read timed out. (read timeout=10)

2021-09-15 08:53:09.292 Error: Goodwe direct hardware (14) thread seems to have ended unexpectedly

2021-09-15 08:53:11.540 Error: (Goodwe direct) Failed to request data: Failed to call GoodWe API (too many retries)

Powerstation ID is provided in settings...Image

Verstuurd vanaf mijn SM-T590 met Tapatalk
Hold on, seems like i am starting to get data. Still don't understand the "test" device though... that was getting data sooner!

Verstuurd vanaf mijn SM-T590 met Tapatalk

-‐----------------------------------------------------------
Running on rPi 3b (main) and rPi 2b (somfy), both RFLink
IthoRemote, Xiaomi Gateway, KAKU
bldewit
Posts: 59
Joined: Tuesday 09 May 2017 23:31
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by bldewit »

Actual power is the same for "Test" and "1"- device, daily power however is not....

Verstuurd vanaf mijn SM-T590 met Tapatalk

-‐----------------------------------------------------------
Running on rPi 3b (main) and rPi 2b (somfy), both RFLink
IthoRemote, Xiaomi Gateway, KAKU
bldewit
Posts: 59
Joined: Tuesday 09 May 2017 23:31
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by bldewit »

Sorry, forgot the screenprint...Image

Verstuurd vanaf mijn SM-T590 met Tapatalk

-‐----------------------------------------------------------
Running on rPi 3b (main) and rPi 2b (somfy), both RFLink
IthoRemote, Xiaomi Gateway, KAKU
JanJaap
Posts: 191
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 »

OK, so some remarks here:
  • the time-out errors are not really a problem. The data is fetched during the next pol, error can be ignored.
  • the input devices only provide the power (in Watt), not the generated energy (in kWh). This information is not provided by SEMS
  • the test device is a test for me to calculate the generated energy in kWh by multiplying the power by the elapsed time, so that I can resolve the previous point. However the multiplication is not correct (yet). It needs to take into account the missed polls, for example and then still it will be an estimate since the actual power is not averaged over the polled time. SEMS by default only updates the values once per 5 minutes, so a lot of clouds could be passing by in that time.
So all in all, your plugin works as how I expect it to work 8-)
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
bldewit
Posts: 59
Joined: Tuesday 09 May 2017 23:31
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by bldewit »

Errormessages seem to have stopped.

Verstuurd vanaf mijn SM-T590 met Tapatalk

-‐----------------------------------------------------------
Running on rPi 3b (main) and rPi 2b (somfy), both RFLink
IthoRemote, Xiaomi Gateway, KAKU
bldewit
Posts: 59
Joined: Tuesday 09 May 2017 23:31
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by bldewit »

JanJaap wrote:OK, so some remarks here:
  • the time-out errors are not really a problem. The data is fetched during the next pol, error can be ignored.
  • the input devices only provide the power (in Watt), not the generated energy (in kWh). This information is not provided by SEMS
  • the test device is a test for me to calculate the generated energy in kWh by multiplying the power by the elapsed time, so that I can resolve the previous point. However the multiplication is not correct (yet). It needs to take into account the missed polls, for example and then still it will be an estimate since the actual power is not averaged over the polled time. SEMS by default only updates the values once per 5 minutes, so a lot of clouds could be passing by in that time.
So all in all, your plugin works as how I expect it to work 8-)
Thank god (and you) Image

Verstuurd vanaf mijn SM-T590 met Tapatalk

-‐----------------------------------------------------------
Running on rPi 3b (main) and rPi 2b (somfy), both RFLink
IthoRemote, Xiaomi Gateway, KAKU
JanJaap
Posts: 191
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 »

Dear all,

I just published version 2.0.7 of the plugin. It has the following improvements:
  • The input strings now give an estimate of the generated energy in Wh (iso only logging the generated power in W)
  • Reduced time out on the API calls to 5 seconds to avoid blocking the plugin framework, which leads to other plugins reporting "hardware thread seems to have ended unexpectedly"
Have fun ;)
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
Merlin1201
Posts: 10
Joined: Friday 07 June 2019 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by Merlin1201 »

Is this plugin stil working?


pi@raspberrypi:~/domoticz/plugins $ git clone [email protected]:janjaapko/domoticz-GoodWeSEMS.git
Cloning into 'domoticz-GoodWeSEMS'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
JanJaap
Posts: 191
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 »

yes it does, I just think I typed something wrong at the clone command, let me check it

edit

I'm guessing you need a Git account to clone via SSH (the instructions work for me), so I added the instruction to do it with HTTP, needs no account
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
Merlin1201
Posts: 10
Joined: Friday 07 June 2019 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by Merlin1201 »

Yes that works.
strange thing is that Domoticz is crashing after installing that plugin, it's the 2e time today I try installing this plugin and my web interface is gone.
after deleting the plugin manual system is online..
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest