goodwe 0.3.6__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
goodwe/sensor.py CHANGED
@@ -183,7 +183,7 @@ class Energy(Sensor):
183
183
 
184
184
  def read_value(self, data: ProtocolResponse):
185
185
  value = read_bytes2(data)
186
- return float(value) / 10 if value is not None else None
186
+ return float(value) / 10 if value else None
187
187
 
188
188
 
189
189
  class Energy4(Sensor):
@@ -194,18 +194,7 @@ class Energy4(Sensor):
194
194
 
195
195
  def read_value(self, data: ProtocolResponse):
196
196
  value = read_bytes4(data)
197
- return float(value) / 10 if value is not None else None
198
-
199
-
200
- class Energy8(Sensor):
201
- """Sensor representing energy [kWh] value encoded in 8 bytes"""
202
-
203
- def __init__(self, id_: str, offset: int, name: str, kind: Optional[SensorKind]):
204
- super().__init__(id_, offset, name, 8, "kWh", kind)
205
-
206
- def read_value(self, data: ProtocolResponse):
207
- value = read_bytes8(data)
208
- return float(value) / 100 if value is not None else None
197
+ return float(value) / 10 if value else None
209
198
 
210
199
 
211
200
  class Apparent(Sensor):
@@ -827,14 +816,6 @@ def read_bytes4_signed(buffer: ProtocolResponse, offset: int = None) -> int:
827
816
  return int.from_bytes(buffer.read(4), byteorder="big", signed=True)
828
817
 
829
818
 
830
- def read_bytes8(buffer: ProtocolResponse, offset: int = None, undef: int = None) -> int:
831
- """Retrieve 8 byte (unsigned int) value from buffer"""
832
- if offset is not None:
833
- buffer.seek(offset)
834
- value = int.from_bytes(buffer.read(8), byteorder="big", signed=False)
835
- return undef if value == 0xffffffffffffffff else value
836
-
837
-
838
819
  def read_decimal2(buffer: ProtocolResponse, scale: int, offset: int = None) -> float:
839
820
  """Retrieve 2 byte (signed float) value from buffer"""
840
821
  if offset is not None:
@@ -900,12 +881,15 @@ def read_freq(buffer: ProtocolResponse, offset: int = None) -> float:
900
881
  return float(value) / 100
901
882
 
902
883
 
903
- def read_temp(buffer: ProtocolResponse, offset: int = None) -> float:
884
+ def read_temp(buffer: ProtocolResponse, offset: int = None) -> float | None:
904
885
  """Retrieve temperature [C] value (2 bytes) from buffer"""
905
886
  if offset is not None:
906
887
  buffer.seek(offset)
907
888
  value = int.from_bytes(buffer.read(2), byteorder="big", signed=True)
908
- return float(value) / 10
889
+ if value == 32767:
890
+ return None
891
+ else:
892
+ return float(value) / 10
909
893
 
910
894
 
911
895
  def read_datetime(buffer: ProtocolResponse, offset: int = None) -> datetime:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: goodwe
3
- Version: 0.3.6
3
+ Version: 0.4.0
4
4
  Summary: Read data from GoodWe inverter via local network
5
5
  Home-page: https://github.com/marcelblijleven/goodwe
6
6
  Author: Martin Letenay, Marcel Blijleven
@@ -32,15 +32,21 @@ License-File: LICENSE
32
32
  Library for connecting to GoodWe inverter over local network and retrieving runtime sensor values and configuration
33
33
  parameters.
34
34
 
35
- It has been reported to work on GoodWe ET, EH, BT, BH, ES, EM, BP, DT, MS, D-NS, and XS families of inverters. It may
36
- work on other inverters as well, as long as they listen on UDP port 8899 and respond to one of supported communication
37
- protocols.
35
+ It has been reported to work with GoodWe ET, EH, BT, BH, ES, EM, BP, DT, MS, D-NS, and XS families of inverters. It
36
+ should work with other inverters as well, as long as they listen on UDP port 8899 and respond to one of supported
37
+ communication protocols.
38
+ In general, if you can connect to your inverter with the official mobile app (SolarGo/PvMaster) over Wi-Fi (not
39
+ bluetooth), this library should work.
38
40
 
39
41
  (If you can't communicate with the inverter despite your model is listed above, it is possible you have old ARM firmware
40
42
  version. You should ask manufacturer support to upgrade your ARM firmware (not just inverter firmware) to be able to
41
- communicate with the inveter via UDP.)
43
+ communicate with the inverter via UDP.)
42
44
 
43
- White-label (GoodWe manufactured) inverters may work as well, e.g. General Electric GEP (PSB, PSC) and GEH models.
45
+ White-label (GoodWe manufactured) inverters may work as well, e.g. General Electric GEP (PSB, PSC) and GEH models are
46
+ know to work properly.
47
+
48
+ Since v0.4.x the library also supports standard Modbus/TCP over port 502.
49
+ This protocol is supported by the V2.0 version of LAN+WiFi communication dongle (model WLA0000-01-00P).
44
50
 
45
51
  ## Usage
46
52
 
@@ -72,4 +78,3 @@ asyncio.run(get_runtime_data())
72
78
  - https://github.com/mletenay/home-assistant-goodwe-inverter
73
79
  - https://github.com/yasko-pv/modbus-log
74
80
  - https://github.com/tkubec/GoodWe
75
- - https://github.com/OpenEMS/openems
@@ -0,0 +1,16 @@
1
+ goodwe/__init__.py,sha256=0Zwuri1cbJ2Qe24R2rEjDMTZeVtsh21YIx3KlRaXgWg,5742
2
+ goodwe/const.py,sha256=yhWk56YV7k7-MbgfmWEMYNlqeRNLOfOpfTqEfRj6Hp8,7934
3
+ goodwe/dt.py,sha256=q8PRs0nVqN4mEhH8243NTbkkBtrGx-n8icwE-BkTN5Q,10460
4
+ goodwe/es.py,sha256=gnSla5SGXK3cJag45o9Z2Wd7rwLkjm3xmS-JN1lf5Ck,22545
5
+ goodwe/et.py,sha256=VJxCl54DILBRFQTmm-9K2yqS_QbBVMDvPFNv8dr0z7Y,39676
6
+ goodwe/exceptions.py,sha256=I6PHG0GTWgxNrDVZwJZBnyzItRq5eiM6ci23-EEsn1I,1012
7
+ goodwe/inverter.py,sha256=JIKYcOLihxCG1_m7HGMoFgVR1dyO8F0OXP5q1ClQJ-w,10336
8
+ goodwe/modbus.py,sha256=sFmkBgylwJkZd64a52fOUst6Rde5Vm3JsAm3Nh3s6e8,8151
9
+ goodwe/model.py,sha256=dWBjMFJMnhZoUdDd9fGT54DERDANz4TirK0Wy8kWMbk,2068
10
+ goodwe/protocol.py,sha256=_jPwIlKE5ou2X3_3PDTUzsgBLLD1dzAdyt5DJOsWTWA,24873
11
+ goodwe/sensor.py,sha256=fWMYyr3Vw02axfGvL7y7YUH2LmfE4A_lsIulX0Zpy5c,37054
12
+ goodwe-0.4.0.dist-info/LICENSE,sha256=aZAhk3lRdYT1YZV-IKRHISEcc_KNUmgfuNO3QhRamNM,1073
13
+ goodwe-0.4.0.dist-info/METADATA,sha256=CRS4h7iSlxExGN2ZjLungFGwuI7d85g-TlVRbnPx6vU,3376
14
+ goodwe-0.4.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
15
+ goodwe-0.4.0.dist-info/top_level.txt,sha256=kKoiqiVvAxDaDJYMZZQLgHQj9cuWT1MXLfXElTDuf8s,7
16
+ goodwe-0.4.0.dist-info/RECORD,,
@@ -1,16 +0,0 @@
1
- goodwe/__init__.py,sha256=PInrrZEpTmMOQKk494vIz8EKSaw_qLBNz-6t9eLIUcg,5642
2
- goodwe/const.py,sha256=Nw-nd4UJuqUOLfbmOrxTHEdS1AuaTDSpZzQqR6tBb8w,7912
3
- goodwe/dt.py,sha256=0nwEAaRstwyZpeDAoSIq4spETXD77ctoGWEnuyezm_E,10862
4
- goodwe/es.py,sha256=ej4vBgXI2dGarbO3rle2itMukmY85_8as6Wsab_6ms8,22672
5
- goodwe/et.py,sha256=perDcodUdVBmn6bRhHfYgdFihjDwuNE5DyaiTU0adgw,42050
6
- goodwe/exceptions.py,sha256=I6PHG0GTWgxNrDVZwJZBnyzItRq5eiM6ci23-EEsn1I,1012
7
- goodwe/inverter.py,sha256=7DgIzSHimkVAfNyIkzALeukHOHkOuYjVyUIvuT0LHdE,10342
8
- goodwe/modbus.py,sha256=ZPib-zKnOVE5zc0RNnhlf0w_26QBees1ScWGo6bAj0o,4685
9
- goodwe/model.py,sha256=OAKfw6ggClgLR9JIdNd7tQ4pnh_7o_UqVdm1KOVsm-Y,2200
10
- goodwe/protocol.py,sha256=pUkXTP2DqpKXGO7rbRfHq1x82Y1QM6OiRVx8cAtS0sM,13162
11
- goodwe/sensor.py,sha256=P3-FeiaxVmzxY0UTpa-Mhlt5ZC9rUdNjjTu3EpYz9BE,37742
12
- goodwe-0.3.6.dist-info/LICENSE,sha256=aZAhk3lRdYT1YZV-IKRHISEcc_KNUmgfuNO3QhRamNM,1073
13
- goodwe-0.3.6.dist-info/METADATA,sha256=Ahjq6cttZ-9ouqlgsx7b-XPo_kIzQVt9TNdATXjCCyg,3050
14
- goodwe-0.3.6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
15
- goodwe-0.3.6.dist-info/top_level.txt,sha256=kKoiqiVvAxDaDJYMZZQLgHQj9cuWT1MXLfXElTDuf8s,7
16
- goodwe-0.3.6.dist-info/RECORD,,
File without changes