Coder Social home page Coder Social logo

janjaapko / domoticz-goodwesems Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dylian94/domoticz-goodwesems

6.0 5.0 4.0 130 KB

Domoticz GoodWe Solar Inverter plugin (SEMS API)

Home Page: http://www.domoticz.com/forum/viewtopic.php?f=65&t=28983

License: MIT License

Python 100.00%
domoticz goodwe

domoticz-goodwesems's Introduction

Domoticz GoodWe Solar Inverter plugin (SEMS API)

This plugin provides information about your GoodWe solar inverter too Domoticz. This plugin has been made by analysing requests made by the GoodWe SEMS Portal website and following the API documentation provided by GoodWe.

This plugin was created by Dylian94 (/dylian94/domoticz-GoodWeSEMS) but that version is out of maintenance. Additional credits to Mark Ruys' gw2pvo for getting the API calls right.......

Important update note (v4)

Per version 4 (November 2023), I've updated the plugin to the Domoticz Extend Framework, which means the device definition is changed. To make sure that you still have your historical sensor data, please read the wiki.

Installation and setup

Follow the Domoticz guide on Using Python Plugins. Check limitations on the bottom of the page. The following Python modules should be installed. Login to a shell:

sudo apt-get update
sudo apt-get install python3-requests

Then, go to the domoticz plugin directory and clone this repository (eith SSH, requires git account):

cd domoticz/plugins
git clone [email protected]:janjaapko/domoticz-GoodWeSEMS.git

OR

Login to a shell, go to the domoticz plugin directory and clone this repository (with https, requires no git account):

cd domoticz/plugins
git clone https://github.com/JanJaapKo/domoticz-GoodWeSEMS.git

Restart Domoticz server, you can try one of these commands (on Linux):

sudo systemctl restart domoticz.service
sudo service domoticz.sh restart

Open the Domoticz interface and go to: Setup > Hardware. You can add new Hardware add the bottom, in the list of hardware types choose for: GoodWe inverter (via SEMS portal).

Follow the instructions shown in the form.

Updating

Login to a shell, go to the plugin directory inside the domoticz plugin directory and execute git pull:

cd domoticz/plugins/domoticz-GoodWeSEMS
git pull

Contributing

Even if you do not know how to develop software you can help by using the GitHub Issues for feature request or bug reports. If you DO know how to develop software please help improving this project by submitting pull-requests. Make sure to update and run the included unit tests (python plugin_test.py) prior to submitting

Current features

  1. Get all stations for a specific user account
  2. Automatically get data for all inverters (for one station)
  3. The following devices are added to Domoticz for each inverter:
Unit Description Type Remark
1 (Hardware name) - Inverter temperature (SN: (your S/N)) LaCrosse TX3
2 (Hardware name) - Inverter output current (SN: (your S/N)) Current
3 (Hardware name) - Inverter output voltage (SN: (your S/N)) Voltage
4 (Hardware name) - Inverter output power (SN: (your S/N)) kWh default: used
5 (Hardware name) - Inverter input 1 voltage (SN: (your S/N)) Voltage
6 (Hardware name) - Inverter input 1 Current (SN: (your S/N)) Current
7 (Hardware name) - Inverter input 2 voltage (SN: (your S/N)) Voltage
8 (Hardware name) - Inverter input 2 Current (SN: (your S/N)) Current
9 (Hardware name) - Inverter state (SN: (your S/N)) Selector Switch default: used
10 (Hardware name) - Solar inverter input 3 voltage (SN: (your S/N)) Voltage
11 (Hardware name) - Solar inverter input 3 Current (SN: (your S/N)) Current
12 (Hardware name) - Solar inverter input 4 voltage (SN: (your S/N)) Voltage
13 (Hardware name) - Solar inverter input 4 Current (SN: (your S/N)) Current
14 (Hardware name) - Inverter input 1 power (SN: (your S/N)) kWh default: used. calculated in plugin
15 (Hardware name) - Inverter input 2 power (SN: (your S/N)) kWh calculated in plugin
16 (Hardware name) - Inverter input 3 power (SN: (your S/N)) kWh calculated in plugin
17 (Hardware name) - Inverter input 4 power (SN: (your S/N)) kWh calculated in plugin
18 (Hardware name) - Inverter output frequency 1 Custom Sensor

There is a lot more information available trough the GoodWe API if you would like to have a specific feature added to this plugin please submit an issue as indicated in the paragraph above.

Current limitations

  1. You can only fetch data for 1 powerstation (which can consist of more than 1 inverter). The field Power Station ID is now mandatory
  2. The GoodWE API does not always respond in time, leading to errors like below. This is not a problem, data will be updated on the next try.
Error: Zonnepanelen: (Zonnepanelen) RequestException: HTTPSConnectionPool(host='eu.semsportal.com', port=443): Read timed out. (read timeout=10)
Error: Zonnepanelen: (Zonnepanelen) Failed to request data: Failed to call GoodWe API (too many retries)

domoticz-goodwesems's People

Contributors

janjaapko avatar dylian94 avatar

Stargazers

 avatar  avatar Tebogo avatar Dehler avatar  avatar E J avatar

Watchers

Elmer van Chastelet avatar Tebogo avatar  avatar E J avatar Dehler avatar

domoticz-goodwesems's Issues

Domoticz - GoodWe plug in not working

Describe the bug
JanJaapKo - installed your latest version of the GoodWe python plugin onto the latest Domoticz on RPI4B
RPI running raspbian 11 bullseye - yesterday installed
Setting up new hardware and devices is ok, can add the P1 data of my smart meter.
Adding the latest download clone into the plugins of the GoodWE SEMS python does not result in data
The hardware not seen and can not add devices - after restarting the domotica service and rebooting the RPI get a black screen with white narrow stripes vertical ...

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
I expected to be able to add the power output of my solar array

Screenshots
image

Domoticz environment (please complete the following information):

  • Domoticz Version: can not see anymore, the server is down
  • Python Version: 3.9.2 on the RPI

Additional context
Add any other context about the problem here.

Inverter input 2 empty

After the update the inverter input 2 voltage, current, power etc are not updated anymore

Some error's in the log

first thank you for making the plugin

i have already install the plugin and it works. but it is not perfect i have some error's in the log and no input power and voltage ad string 2, the rest is working perfect. I can not find the issue maby can annyboddy help me.

the error's in the log:
Error: Zonnepanelen: Call to function 'onHeartbeat' failed, exception details:
Error: Zonnepanelen: Traceback (most recent call last):
Error: Zonnepanelen: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 483, in onHeartbeat
Error: Zonnepanelen: _plugin.onHeartbeat()
Error: Zonnepanelen: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 408, in onHeartbeat
Error: Zonnepanelen: self.startDeviceUpdateV2()
Error: Zonnepanelen: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 125, in startDeviceUpdateV2
Error: Zonnepanelen: self.updateDevices(DeviceData)
Error: Zonnepanelen: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 155, in updateDevices
Error: Zonnepanelen: newCounter = calculateNewEnergy(theInverter.inputPower1Unit, inputPower)
Error: Zonnepanelen: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 432, in calculateNewEnergy
Error: Zonnepanelen: previousPower = previousPower.replace("w","").replace("W","")
Error: Zonnepanelen: AttributeError: 'int' object has no attribute 'replace'

domoticz version 2022.2
python version 3.9.2

Entering wrong pasword crashes plugin

Describe the bug
When a wrong pass word is entered the plugin crashes
2022-04-12 12:43:02.271 Zonnepanelen: onStop - Plugin is stopping.
2022-04-12 12:43:02.672 Zonnepanelen: Worker thread started.
2022-04-12 12:43:02.271 Status: Zonnepanelen: Stop directive received.
2022-04-12 12:43:02.579 Status: Zonnepanelen: Exiting work loop.
2022-04-12 12:43:02.671 Status: Zonnepanelen: Stopping threads.
2022-04-12 12:43:02.671 Status: Zonnepanelen: Stopped.
2022-04-12 12:43:02.672 Status: Zonnepanelen: Entering work loop.
2022-04-12 12:43:02.672 Status: Zonnepanelen: Started.
2022-04-12 12:43:03.537 Status: Zonnepanelen: Initialized version 2.0.7, author 'Jan-Jaap Kostelijk'
2022-04-12 12:43:04.977 Zonnepanelen: Failed to call GoodWe API (no valid token), will be refreshed
2022-04-12 12:43:10.110 Error: Zonnepanelen: RequestException: HTTPSConnectionPool(host='eu.semsportal.com', port=443): Read timed out. (read timeout=5)
2022-04-12 12:43:11.285 Zonnepanelen: Failed to call GoodWe API (no valid token), will be refreshed
2022-04-12 12:43:16.421 Error: Zonnepanelen: RequestException: HTTPSConnectionPool(host='eu.semsportal.com', port=443): Read timed out. (read timeout=5)
2022-04-12 12:43:24.615 Zonnepanelen: Failed to call GoodWe API (no valid token), will be refreshed
2022-04-12 12:43:27.521 Error: Zonnepanelen: Call to function 'onStart' failed, exception details:
2022-04-12 12:43:27.525 Error: Zonnepanelen: Traceback (most recent call last):
2022-04-12 12:43:27.525 Error: Zonnepanelen: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 441, in onStart
2022-04-12 12:43:27.525 Error: Zonnepanelen: _plugin.onStart()
2022-04-12 12:43:27.525 Error: Zonnepanelen: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 208, in onStart
2022-04-12 12:43:27.525 Error: Zonnepanelen: self.startDeviceUpdateV2()
2022-04-12 12:43:27.525 Error: Zonnepanelen: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 125, in startDeviceUpdateV2
2022-04-12 12:43:27.525 Error: Zonnepanelen: DeviceData = self.goodWeAccount.stationDataRequestV2(Parameters["Mode1"])
2022-04-12 12:43:27.525 Error: Zonnepanelen: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/GoodWe.py", line 399, in stationDataRequestV2
2022-04-12 12:43:27.525 Error: Zonnepanelen: self.tokenRequest()
2022-04-12 12:43:27.525 Error: Zonnepanelen: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/GoodWe.py", line 333, in tokenRequest
2022-04-12 12:43:27.525 Error: Zonnepanelen: raise Exception(data['msg'])
2022-04-12 12:43:27.525 Error: Zonnepanelen: NameError: name 'data' is not defined

Expected behavior
clear error stating 'wrong password/username'.

Domoticz environment (please complete the following information):

  • Domoticz Version: 2022.1 (build 14299)
  • Python Version: 3.9

Additional context
Add any other context about the problem here.

Crash of Domoticz

Several times a day domoticz crashes.

When i look in the crash log i find:

23 Thread 0x6a0f7200 (LWP 1046) "Goodwe Uitbouw" __waitpid (options=0, stat _loc=0x6a0f5690, pid=31108) at ../sysdeps/unix/sysv/linux/waitpid.c:30

Thread 23 (Thread 0x6a0f7200 (LWP 1046)):
#0 __waitpid (options=0, stat_loc=0x6a0f5690, pid=31108) at ../sysdeps/unix/sys v/linux/waitpid.c:30
#1 __waitpid (pid=31108, stat_loc=0x6a0f5690, options=0) at ../sysdeps/unix/sys v/linux/waitpid.c:25
#2 0x002868cc in dumpstack_gdb(bool) ()
#3 0x00286e98 in signal_handler(int, siginfo_t*, void*) ()
#4
#5 raise (sig=11) at ../sysdeps/unix/sysv/linux/raise.c:50
#6
#7 0x75ccbd0c in ?? () from /usr/lib/arm-linux-gnueabihf/libpython3.7m.so
#8 0x75ccc17c in ?? () from /usr/lib/arm-linux-gnueabihf/libpython3.7m.so
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

The strange thing is that i first had the same problem with a Growatt inverter plugin.
I delete everything from that inverter and after 2 days it started with the Goodwe inverter plugin.

Als deleted the Goodwe plugin and downloaded a the last version. Same problem.

Any ideau what is cousing this problem?

In hardware is see 2 SemsApi types.. How do i know what is the good one or doesn't it matter which i choose.

.

Domoticz environment (please complete the following information):

  • Domoticz Version: 2023.1
  • Python Version: 3.7.3

Battery

It would be great to see batt level (%) and batt power (W) for automation purposes

After update trying to convert database

Describe the bug
Updated the plugin, found some errors in the log.

2023-11-15 22:04:36.628 Error: GoodWe GW5000-DT: Call to function 'onStart' failed, exception details:
2023-11-15 22:04:36.631 Error: GoodWe GW5000-DT: Traceback (most recent call last):
2023-11-15 22:04:36.631 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 620, in onStart
2023-11-15 22:04:36.631 Error: GoodWe GW5000-DT: _plugin.onStart()
2023-11-15 22:04:36.631 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 337, in onStart
2023-11-15 22:04:36.631 Error: GoodWe GW5000-DT: self.startDeviceUpdateV2()
2023-11-15 22:04:36.631 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 150, in startDeviceUpdateV2
2023-11-15 22:04:36.631 Error: GoodWe GW5000-DT: self.updateDevices(DeviceData)
2023-11-15 22:04:36.631 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 158, in updateDevices
2023-11-15 22:04:36.631 Error: GoodWe GW5000-DT: self.createDevices(inverter["sn"])
2023-11-15 22:04:36.631 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 217, in createDevices
2023-11-15 22:04:36.631 Error: GoodWe GW5000-DT: numDevs = len(Devices[serialNumber].Units)
2023-11-15 22:04:36.631 Error: GoodWe GW5000-DT: KeyError: '95000DTU193W0183'

Found out on this Github-page I have to convert the database.
Followed the instructions, but on import I got a error...

To Reproduce
Steps to reproduce the behavior:
After convert the ID's

pi@Domoticz:~/domoticz $ sqlite3 domoticz.db
SQLite version 3.34.1 2021-01-20 14:10:07
Enter ".help" for usage hints.
sqlite> DROP TABLE IF EXISTS DeviceStatus;
sqlite> .mode csv
sqlite> .separator ";"
sqlite> .import devicedata.csv
ERROR: missing TABLE argument. Usage:
.import FILE TABLE Import data from FILE into TABLE
Options:
--ascii Use \037 and \036 as column and row separators
--csv Use , and \n as column and row separators
--skip N Skip the first N rows of input
-v "Verbose" - increase auxiliary output
Notes:
* If TABLE does not exist, it is created. The first row of input
determines the column names.
* If neither --csv or --ascii are used, the input mode is derived
from the ".mode" output mode
* If FILE begins with "|" then it is a command that generates the
input text.

Expected behavior
That import would work as supposed

Screenshots
pi@Domoticz:~/domoticz $ sqlite3 domoticz.db
SQLite version 3.34.1 2021-01-20 14:10:07
Enter ".help" for usage hints.
sqlite> DROP TABLE IF EXISTS DeviceStatus;
sqlite> .mode csv
sqlite> .separator ";"
sqlite> .import devicedata.csv
ERROR: missing TABLE argument. Usage:
.import FILE TABLE Import data from FILE into TABLE
Options:
--ascii Use \037 and \036 as column and row separators
--csv Use , and \n as column and row separators
--skip N Skip the first N rows of input
-v "Verbose" - increase auxiliary output
Notes:
* If TABLE does not exist, it is created. The first row of input
determines the column names.
* If neither --csv or --ascii are used, the input mode is derived
from the ".mode" output mode
* If FILE begins with "|" then it is a command that generates the
input text.

Domoticz environment (please complete the following information):

  • Domoticz V2023.2 (build 15650)
  • Python version '3.9.2',

Additional context
Add any other context about the problem here.

Plugin not showing

After a fresh install, according to the guide, i'm not seeing the harware being available.
Nothing in the logs either.

Any clues?

'onMessage' failed 'TypeError':'string indices must be integers'.

2022-04-12 15:33:10.376 Error: Zonnepanelen2: 'onMessage' failed 'TypeError':'string indices must be integers'.
2022-04-12 15:33:10.376 Error: Zonnepanelen2: Exception traceback:
2022-04-12 15:33:10.376 Error: Zonnepanelen2: ----> Line 309 in '/home/pi/domoticz/plugins/SEMS_backup/plugin.py', function onMessage
2022-04-12 15:33:10.376 Error: Zonnepanelen2: ----> Line 217 in '/home/pi/domoticz/plugins/SEMS_backup/plugin.py', function onMessage

Runnning on :
Domoticz v2022.1 stable
RPI4

Seems to work but errors in Log

Describe the bug
I have your code running, installed as instructed, and seems to work.
But when you check the you see a lot of repeating errors. How to solve these errors?

Update: I see in Domoticz, that my second string is not updated...

To Reproduce
Domoticz and your code running, logging on debug. Check log of Domoticz

Expected behavior
No errors in the log.

Update of both strings...

Screenshots

2021-08-21 11:02:26.054 GoodWe GW5000-DT: (GoodWe GW5000-DT) onHeartbeat called, starting device update.
2021-08-21 11:02:26.054 GoodWe GW5000-DT: (GoodWe GW5000-DT) startDeviceUpdate, token availability: 'True'
2021-08-21 11:02:26.054 GoodWe GW5000-DT: (GoodWe GW5000-DT) build stationDataRequest for 1 station, attempt: 1
2021-08-21 11:02:26.054 GoodWe GW5000-DT: (GoodWe GW5000-DT) build apiRequestHeaders with token: '{"uid": "****************************", "timestamp": 1629495111054, "token": "*****************", "client": "web", "version": "v3.1", "language": "en-GB"}'
2021-08-21 11:02:26.265 GoodWe GW5000-DT: (GoodWe GW5000-DT) building station data request on URL: https://eu.semsportal.com/api/v2/PowerStation/GetMonitorDetailByPowerstationId which returned status code: 200 and response length = 28114
2021-08-21 11:02:26.267 GoodWe GW5000-DT: (GoodWe GW5000-DT) create station with id: '***************' and inverters: 1
2021-08-21 11:02:26.267 GoodWe GW5000-DT: (GoodWe GW5000-DT) inverter created: '*************'
2021-08-21 11:02:26.267 GoodWe GW5000-DT: (GoodWe GW5000-DT) PowerStation created: '*****************'
2021-08-21 11:02:26.267 GoodWe GW5000-DT: (GoodWe GW5000-DT) inverter found with SN: '****************'
2021-08-21 11:02:26.267 GoodWe GW5000-DT: (GoodWe GW5000-DT) Status of GoodWe inverter (SN: ****************): '1 generating'
2021-08-21 11:02:26.277 GoodWe GW5000-DT: (GoodWe GW5000-DT) inverter generating, log temp
2021-08-21 11:02:26.285 GoodWe GW5000-DT: (GoodWe GW5000-DT) Update Goodwe solar - Current: nValue 0 - sValue 3.4A - BatteryLevel 255
2021-08-21 11:02:26.293 GoodWe GW5000-DT: (GoodWe GW5000-DT) Update Goodwe solar - Voltage: nValue 0 - sValue 234.7V - BatteryLevel 255
2021-08-21 11:02:26.301 GoodWe GW5000-DT: (GoodWe GW5000-DT) Update Zonnepanelen: nValue 0 - sValue 2397W;11055800.0 - BatteryLevel 255
2021-08-21 11:02:26.308 GoodWe GW5000-DT: (GoodWe GW5000-DT) Update Goodwe solar - string 1 Voltage: nValue 0 - sValue 215V - BatteryLevel 255
2021-08-21 11:02:26.315 GoodWe GW5000-DT: (GoodWe GW5000-DT) Update Goodwe solar - string 1 Current: nValue 0 - sValue 5.8A - BatteryLevel 255
2021-08-21 11:02:26.334 GoodWe GW5000-DT: (GoodWe GW5000-DT) Update Goodwe solar - string 1 Power: nValue 0 - sValue 1247.0;0 - BatteryLevel 255
2021-08-21 11:02:26.335 Error: GoodWe GW5000-DT: (GoodWe GW5000-DT) 'onHeartbeat' failed 'ValueError':'not enough values to unpack (expected 2, got 1)'.
2021-08-21 11:02:26.335 Error: GoodWe GW5000-DT: (GoodWe GW5000-DT) ----> Line 461 in '/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py', function onHeartbeat
2021-08-21 11:02:26.335 Error: GoodWe GW5000-DT: (GoodWe GW5000-DT) ----> Line 399 in '/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py', function onHeartbeat
2021-08-21 11:02:26.335 Error: GoodWe GW5000-DT: (GoodWe GW5000-DT) ----> Line 133 in '/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py', function startDeviceUpdateV2
2021-08-21 11:02:26.335 Error: GoodWe GW5000-DT: (GoodWe GW5000-DT) ----> Line 164 in '/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py', function updateDevices
2021-08-21 11:02:36.059 GoodWe GW5000-DT: (GoodWe GW5000-DT) onHeartbeat called, starting device update.
2021-08-21 11:02:36.059 GoodWe GW5000-DT: (GoodWe GW5000-DT) startDeviceUpdate, token availability: 'True'
2021-08-21 11:02:36.059 GoodWe GW5000-DT: (GoodWe GW5000-DT) build stationDataRequest for 1 station, attempt: 1
2021-08-21 11:02:36.059 GoodWe GW5000-DT: (GoodWe GW5000-DT) build apiRequestHeaders with token: '{"uid": "**************************", "timestamp": 1629495111054, "token": "***********************", "client": "web", "version": "v3.1", "language": "en-GB"}'
2021-08-21 11:02:36.286 GoodWe GW5000-DT: (GoodWe GW5000-DT) building station data request on URL: https://eu.semsportal.com/api/v2/PowerStation/GetMonitorDetailByPowerstationId which returned status code: 200 and response length = 28114
2021-08-21 11:02:36.288 GoodWe GW5000-DT: (GoodWe GW5000-DT) create station with id: '************' and inverters: 1
2021-08-21 11:02:36.288 GoodWe GW5000-DT: (GoodWe GW5000-DT) inverter created: '************'
2021-08-21 11:02:36.288 GoodWe GW5000-DT: (GoodWe GW5000-DT) PowerStation created: '***************'
2021-08-21 11:02:36.288 GoodWe GW5000-DT: (GoodWe GW5000-DT) inverter found with SN: '**************'
2021-08-21 11:02:36.288 GoodWe GW5000-DT: (GoodWe GW5000-DT) Status of GoodWe inverter (SN: **************): '1 generating'
2021-08-21 11:02:36.298 GoodWe GW5000-DT: (GoodWe GW5000-DT) inverter generating, log temp
2021-08-21 11:02:36.306 GoodWe GW5000-DT: (GoodWe GW5000-DT) Update Goodwe solar - Current: nValue 0 - sValue 3.4A - BatteryLevel 255
2021-08-21 11:02:36.313 GoodWe GW5000-DT: (GoodWe GW5000-DT) Update Goodwe solar - Voltage: nValue 0 - sValue 234.7V - BatteryLevel 255
2021-08-21 11:02:36.321 GoodWe GW5000-DT: (GoodWe GW5000-DT) Update Zonnepanelen: nValue 0 - sValue 2397W;11055800.0 - BatteryLevel 255
2021-08-21 11:02:36.328 GoodWe GW5000-DT: (GoodWe GW5000-DT) Update Goodwe solar - string 1 Voltage: nValue 0 - sValue 215V - BatteryLevel 255
2021-08-21 11:02:36.336 GoodWe GW5000-DT: (GoodWe GW5000-DT) Update Goodwe solar - string 1 Current: nValue 0 - sValue 5.8A - BatteryLevel 255
2021-08-21 11:02:36.355 GoodWe GW5000-DT: (GoodWe GW5000-DT) Update Goodwe solar - string 1 Power: nValue 0 - sValue 1247.0;0 - BatteryLevel 255
2021-08-21 11:02:36.355 Error: GoodWe GW5000-DT: (GoodWe GW5000-DT) 'onHeartbeat' failed 'ValueError':'not enough values to unpack (expected 2, got 1)'.
2021-08-21 11:02:36.355 Error: GoodWe GW5000-DT: (GoodWe GW5000-DT) ----> Line 461 in '/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py', function onHeartbeat
2021-08-21 11:02:36.355 Error: GoodWe GW5000-DT: (GoodWe GW5000-DT) ----> Line 399 in '/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py', function onHeartbeat
2021-08-21 11:02:36.355 Error: GoodWe GW5000-DT: (GoodWe GW5000-DT) ----> Line 133 in '/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py', function startDeviceUpdateV2
2021-08-21 11:02:36.355 Error: GoodWe GW5000-DT: (GoodWe GW5000-DT) ----> Line 164 in 

Domoticz environment (please complete the following information):
Version: 2021.1
Build Hash: 8547c5b7e
Compile Date: 2021-04-17 17:29:11
dzVents Version: 3.1.7
Python Version: 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]

Additional context
None

Thank you!

Can't get it working

Hi,
I have used the older plugin before, deleted it, restarted domoticz, installed your plugin, restarted domoticz.
I entered my credentials in the Hardware tab, and now I see this in the logs:

2022-12-27 16:49:17.594 Error: ZP: (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'.
2022-12-27 16:49:17.616 Error: ZP: Traceback (most recent call last):
2022-12-27 16:49:17.616 Error: ZP: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 77, in
2022-12-27 16:49:17.616 Error: ZP: from GoodWe import GoodWe
2022-12-27 16:49:17.616 Error: ZP: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/GoodWe.py", line 28, in
2022-12-27 16:49:17.616 Error: ZP: import requests
2022-12-27 16:49:17.616 Error: ZP: ModuleNotFoundError: No module named 'requests'

There are no new devices to be seen.
Can you help me?

Errors in log

Describe the bug
Every day I see the following errors a lot of times? But also a lot of times without errors. I don't change anything. What is causing these errors, and how to solve.

2023-02-25 08:11:58.211 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 119, in startDeviceUpdateV2
2023-02-25 08:11:58.211 Error: GoodWe GW5000-DT: DeviceData = self.goodWeAccount.stationDataRequestV2(Parameters["Mode1"])
2023-02-25 08:11:58.211 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/GoodWe.py", line 404, in stationDataRequestV2
2023-02-25 08:11:58.211 Error: GoodWe GW5000-DT: responseData = self.stationDataRequest(stationId)
2023-02-25 08:11:58.211 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/GoodWe.py", line 435, in stationDataRequest
2023-02-25 08:11:58.212 Error: GoodWe GW5000-DT: logging.debug("response station data request : " + json.dumps(r.json()))
2023-02-25 08:11:58.212 Error: GoodWe GW5000-DT: File "/usr/lib/python3/dist-packages/requests/models.py", line 900, in json
2023-02-25 08:11:58.212 Error: GoodWe GW5000-DT: return complexjson.loads(self.text, **kwargs)
2023-02-25 08:11:58.212 Error: GoodWe GW5000-DT: File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
2023-02-25 08:11:58.212 Error: GoodWe GW5000-DT: return _default_decoder.decode(s)
2023-02-25 08:11:58.212 Error: GoodWe GW5000-DT: File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
2023-02-25 08:11:58.212 Error: GoodWe GW5000-DT: obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2023-02-25 08:11:58.212 Error: GoodWe GW5000-DT: File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
2023-02-25 08:11:58.212 Error: GoodWe GW5000-DT: raise JSONDecodeError("Expecting value", s, err.value) from None
2023-02-25 08:11:58.212 Error: GoodWe GW5000-DT: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2023-02-25 08:12:09.352 Error: GoodWe GW5000-DT: Call to function 'onHeartbeat' failed, exception details:
2023-02-25 08:12:09.354 Error: GoodWe GW5000-DT: Traceback (most recent call last):
2023-02-25 08:12:09.354 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 483, in onHeartbeat
2023-02-25 08:12:09.354 Error: GoodWe GW5000-DT: _plugin.onHeartbeat()
2023-02-25 08:12:09.354 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 408, in onHeartbeat
2023-02-25 08:12:09.354 Error: GoodWe GW5000-DT: self.startDeviceUpdateV2()
2023-02-25 08:12:09.354 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 119, in startDeviceUpdateV2
2023-02-25 08:12:09.354 Error: GoodWe GW5000-DT: DeviceData = self.goodWeAccount.stationDataRequestV2(Parameters["Mode1"])
2023-02-25 08:12:09.355 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/GoodWe.py", line 417, in stationDataRequestV2
2023-02-25 08:12:09.355 Error: GoodWe GW5000-DT: self.tokenRequest()
2023-02-25 08:12:09.355 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/GoodWe.py", line 343, in tokenRequest
2023-02-25 08:12:09.355 Error: GoodWe GW5000-DT: apiResponse = r.json()
2023-02-25 08:12:09.355 Error: GoodWe GW5000-DT: File "/usr/lib/python3/dist-packages/requests/models.py", line 900, in json
2023-02-25 08:12:09.355 Error: GoodWe GW5000-DT: return complexjson.loads(self.text, **kwargs)
2023-02-25 08:12:09.355 Error: GoodWe GW5000-DT: File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
2023-02-25 08:12:09.355 Error: GoodWe GW5000-DT: return _default_decoder.decode(s)
2023-02-25 08:12:09.355 Error: GoodWe GW5000-DT: File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
2023-02-25 08:12:09.355 Error: GoodWe GW5000-DT: obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2023-02-25 08:12:09.355 Error: GoodWe GW5000-DT: File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
2023-02-25 08:12:09.355 Error: GoodWe GW5000-DT: raise JSONDecodeError("Expecting value", s, err.value) from None
2023-02-25 08:12:09.355 Error: GoodWe GW5000-DT: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2023-02-25 08:32:18.307 Error: GoodWe GW5000-DT: Call to function 'onHeartbeat' failed, exception details:
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: Traceback (most recent call last):
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 483, in onHeartbeat
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: _plugin.onHeartbeat()
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 408, in onHeartbeat
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: self.startDeviceUpdateV2()
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 119, in startDeviceUpdateV2
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: DeviceData = self.goodWeAccount.stationDataRequestV2(Parameters["Mode1"])
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/GoodWe.py", line 404, in stationDataRequestV2
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: responseData = self.stationDataRequest(stationId)
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/GoodWe.py", line 435, in stationDataRequest
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: logging.debug("response station data request : " + json.dumps(r.json()))
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: File "/usr/lib/python3/dist-packages/requests/models.py", line 900, in json
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: return complexjson.loads(self.text, **kwargs)
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: return _default_decoder.decode(s)
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: raise JSONDecodeError("Expecting value", s, err.value) from None
2023-02-25 08:32:18.310 Error: GoodWe GW5000-DT: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2023-02-25 09:27:28.408 Error: GoodWe GW5000-DT: Call to function 'onHeartbeat' failed, exception details:
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: Traceback (most recent call last):
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 483, in onHeartbeat
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: _plugin.onHeartbeat()
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 408, in onHeartbeat
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: self.startDeviceUpdateV2()
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py", line 119, in startDeviceUpdateV2
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: DeviceData = self.goodWeAccount.stationDataRequestV2(Parameters["Mode1"])
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/GoodWe.py", line 417, in stationDataRequestV2
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: self.tokenRequest()
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: File "/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/GoodWe.py", line 343, in tokenRequest
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: apiResponse = r.json()
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: File "/usr/lib/python3/dist-packages/requests/models.py", line 900, in json
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: return complexjson.loads(self.text, **kwargs)
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: return _default_decoder.decode(s)
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: raise JSONDecodeError("Expecting value", s, err.value) from None
2023-02-25 09:27:28.410 Error: GoodWe GW5000-DT: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)```

**To Reproduce**
Steps to reproduce the behavior:
1. Install as described
2. Look in the log of Domoticz

**Expected behavior**
No errors, because it also a lot of times  it's working fine!

**Screenshots**
none

**Domoticz environment (please complete the following information):**
Version: 2023.1
Build Hash: f9b9ac774
Compile Date: 2023-02-14 15:06:40
dzVents Version: 3.1.8
Python Version: 3.9.2 (default, Mar 12 2021, 04:06:34) [GCC 10.2.1 20210110]

**Additional context**
none

Still not working under Bullseye

Hello,

This very nice plugin is working perfectly under Buster, but not under Bullseye.
I know it's due the Phyton version. Does anybody got this working under Bullseye?
It works in Domoticz Beta version. But I would like to use in production.

Please help me with the right instructions how to adjust Phyton to the working version under Bullseye.

Thanks!

Pieter

Transfer from old plugin to new

Actually not an issue, but my Github skills are insufficient.

In my case, I installed the original plugin (dylian94).
Now I wanted to move to this newer plugin.

I stopped domoticz, removed the old plugin folder, and followed the instructions given.

Now the new plugin runs and it is creating new devices.
To preserve the historical data I tried replace the old power generated device with the new.

This was not possible, because the old device included 'W' in it's state.

By adding this line at before the 'newCount=' as line 432, the problem was solved (in plugin.py).
previousPower = previousPower.replace("w","").replace("W","")

OLD

    #average current and previous power (Watt) and multiply by elapsed time (hour) to get Watt hour
    newCount = round(((float(previousPower) + inputPower ) / 2) * elapsedTime.total_seconds()/3600,2)
    newCounter = newCount + float(currentCount) #add the amount of energy since last update to the already logged energy
    logging.debug("Test power, previousPower: {}, currentCount: {:6.2f}, newCounter: {:6.2f}, added: {:6.2f}".format(previousPower, float(currentCount), newCounter, newCount))
    return newCounter

NEW

    #average current and previous power (Watt) and multiply by elapsed time (hour) to get Watt hour
    previousPower = previousPower.replace("w","").replace("W","")
    newCount = round(((float(previousPower) + inputPower ) / 2) * elapsedTime.total_seconds()/3600,2)
    newCounter = newCount + float(currentCount) #add the amount of energy since last update to the already logged energy
    logging.debug("Test power, previousPower: {}, currentCount: {:6.2f}, newCounter: {:6.2f}, added: {:6.2f}".format(previousPower, float(currentCount), newCounter, newCount))
    return newCounter

Clean install crashes on Bullseye

Describe the bug
Domoticz crashes completly after fatal error.

The error is caused when creating the first device.
As I am not familiar with the Domoticz plugin implementation I could not investigate any further.

To Reproduce
Steps to reproduce the behavior:

  1. Clean Domoticz installation
  2. git clone into plugins folder
  3. Restart service
  4. Add Hardware device as documented.
  5. Go to Devices tab, and Domoticz has crashed.

Expected behavior
I would expect that all the devices would be visible.

Screenshots
N/A

Domoticz environment (please complete the following information):

  • Domoticz Version: V2022.1
  • Python Version: 3.9.2

Additional context
log:

2022-04-16 14:56:15.201  Omvormer: create station with id: '***' and inverters: 1
2022-04-16 14:56:15.202  Omvormer: inverter created: '***'
2022-04-16 14:56:15.202  Omvormer: PowerStation created: '***'
2022-04-16 14:56:15.202  Omvormer: inverter found with SN: '***'
2022-04-16 14:56:15.203  Error: Domoticz(pid:3235, tid:3256('Omvormer')) received fatal signal 11 (Segmentation fault)
2022-04-16 14:56:15.203  Error: siginfo address=0xca3, address=(nil)

Failure at:
Stack trace:

Domoticz.Device(Name="Inverter temperature (SN: " + self.serialNumber + ")",
Unit=(self.inverterTemperatureUnit), Type=80, Subtype=5).Create()

from:
theStation.inverters[inverter["sn"]].createDevices(Devices)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.