This repository contains the executable python module goodwe_sec1000_info
and the script goodwe_sec1000_info_test.py
.
The module goodwe_sec1000_info
allows to obtain the data of the inverters power and the mains power from the GoodWe SEC1000 Smart Energy Controller device. In particular, the data is obtained from the EzLogger device inside the SEC1000.
In the module goodwe_sec1000_info
, inside the __main
function, set the variables host
and port
to the address and port of your GoodWe SEC1000 device. Usually the port is 1234, unless you are accessing through some gateway with port forwarding.
Then, the module can be executed directly to obtain the SEC1000 data in JSON format. For example, the output may be:
{
"v1": 241.0,
"v2": 240.4,
"v3": 240.9,
"i1": 4.8100000000000005,
"i2": 3.9,
"i3": 5.08,
"p1": 0.293,
"p2": -0.117,
"p3": -0.532,
"meters_power": -0.355,
"inverters_power": 3.386
}
Where
v1
,v2
, andv3
are voltage data in volts.i1
,i2
, andi3
are current data in amperes.p1
,p2
, andp3
are power data in kilowatts.meters_power
is the power being consumed from the mains in kilowatts.inverters_power
is the power being generated by the inverters in kilowatts.
The information about the application protocol used to query the SEC1000 data is not public. The only way of querying the data provided by the GoodWe company is to use its proprietary ProMate application.
Using Wireshark, we analyzed the packets exchanged between the ProMate application and the SEC1000 device and saw that a simple binary protocol is used. The script sec1000_info_test.py
can be executed to print an analysis of the fields of the data received. An example of the output of this script is the following:
Total number of bytes received: 56
Bytes:
b"\x04REVO\x001\x01\x01\x0b\x00\x00\tj\x00\x00\td\x00\x00\ti\x00\x00\x01\xe0\x00\x00\x01\x86\x00\x00\x01\xfc\x00\x00\x01'\xff\xff\xff\x8e\xff\xff\xfd\xec\xff\xff\xfe\xa1\x00\x00\r:\x0fB"
Fields:
045245564F00 Header: \x04REV0\x00
31 Data lenght: 49
01010B Unknown (request code?)
0000096A Voltage 1 (0.1V units): 2410
00000964 Voltage 2 (0.1V units): 2404
00000969 Voltage 3 (0.1V units): 2409
000001E0 Current 1 (0.01A units): 480
00000186 Current 2 (0.01A units): 390
000001FC Current 3 (0.01A units): 508
00000127 Power 1 (1W units): 295
FFFFFF8E Power 2 (1W units): -114
FFFFFDEC Power 3 (1W units): -532
FFFFFEA1 Meter power (1W units): -351
00000D3A Inverters power (1W units): 3386
0F42 Data checksum, calculated = F42
We found two problems when querying the data of the SEC1000. These also happen with the ProMate application, so it is something related to the SEC1000 and not to the way we are querying the data. These problems are:
-
Sometimes the SEC1000 response is not correct. The expected response size (i.e., the size field in the response message from the SEC1000) should be 49, but sometimes is 6. To solve this we retry the query until we obtain a correct response.
-
Sometimes the "inverters power" field has unexpectedly a value of 0. We have checked that the SEC1000 updates the "inverters power" value in intervals of approximately 30 seconds, but sometimes it sets this value to 0. This seems to be some problem within the SEC1000, since if the "inverters power" is 0, we would also expect the "meter power" (i.e., the power from the mains power grid) to increase accordingly, but this does not happen. To solve this we use a cache file to store a queue of some given size of the previous received values of "inverters power", then if we receive a "inverters power" of 0 we return the last non-zero value from the cache, or a 0 if there are no non-zero values in the cache.
This code is available as open source under the terms of the MIT License.