Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions solax/inverters/x1_hybrid_gen4.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from solax.inverter import Inverter
from solax.units import DailyTotal, Total, Units
from solax.utils import div10, div100, pack_u16, to_signed
from solax.utils import div10, div100, pack_u16, to_signed, twoway_div100


class X1HybridGen4(Inverter):
Expand Down Expand Up @@ -48,12 +48,14 @@ def response_decoder(cls):
"On-grid total yield": (pack_u16(11, 12), Total(Units.KWH), div10),
"On-grid daily yield": (13, DailyTotal(Units.KWH), div10),
"Battery voltage": (14, Units.V, div100),
"Battery current": (15, Units.A, div100),
"Battery current": (15, Units.A, twoway_div100),
"Battery power": (16, Units.W, to_signed),
"Battery temperature": (17, Units.C),
"Battery SoC": (18, Units.PERCENT),
"Inverter Temperature": (26, Units.C),
"Grid power": (32, Units.W, to_signed),
"Load power": (38, Units.W, to_signed),
"Inverter Run Mode": (10, Units.NONE),
"Total feed-in energy": (pack_u16(34, 35), Total(Units.KWH), div100),
"Total consumption": (pack_u16(36, 37), Total(Units.KWH), div100),
}
Expand Down
12 changes: 12 additions & 0 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
X1_BOOST_VALUES_V3,
X1_HYBRID_G4_V_3_018_VALUES,
X1_HYBRID_G4_VALUES,
X1_HYBRID_GEN4_V_3_019_VALUES,
X1_MINI_G4_VALUES,
X1_MINI_VALUES,
X1_MINI_VALUES_V34,
Expand Down Expand Up @@ -43,6 +44,7 @@
X1_HYBRID_G3_RESPONSE,
X1_HYBRID_G4_RESPONSE,
X1_HYBRID_G4_V_3_018_RESPONSE,
X1_HYBRID_GEN4_V_3_019_RESPONSE,
X1_MINI_G4,
X1_MINI_RESPONSE_V34,
X1_MINI_RESPONSE_V34_VER3,
Expand Down Expand Up @@ -371,6 +373,16 @@ def simple_http_fixture(httpserver):
headers=None,
data="optType=ReadRealTimeData",
),
InverterUnderTest(
uri="/",
method="POST",
query_string=None,
response=X1_HYBRID_GEN4_V_3_019_RESPONSE,
inverter=inverter.X1HybridGen4,
values=X1_HYBRID_GEN4_V_3_019_VALUES,
headers=None,
data="optType=ReadRealTimeData",
),
]


Expand Down
30 changes: 30 additions & 0 deletions tests/samples/expected_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,8 @@
"Grid power": 1.0,
"Total feed-in energy": 286.7,
"Total consumption": 6.2,
"Load power": 236.0,
"Inverter Run Mode": 2.0,
}

X3_ULTRA_VALUES = {
Expand Down Expand Up @@ -805,4 +807,32 @@
"Grid power": 0.0,
"Total feed-in energy": 41.20,
"Total consumption": 13.2,
"Load power": 384.0,
"Inverter Run Mode": 2.0,
}

X1_HYBRID_GEN4_V_3_019_VALUES = {
"AC voltage R": 244.9,
"AC current": 1.7,
"AC power": 380.0,
"Grid frequency": 50.02,
"PV1 voltage": 272.5,
"PV2 voltage": 0.0,
"PV1 current": 0.4,
"PV2 current": 0.0,
"PV1 power": 134.0,
"PV2 power": 0.0,
"On-grid total yield": 10349.4,
"On-grid daily yield": 16.5,
"Battery voltage": 114.9,
"Battery current": -2.1,
"Battery power": -252.0,
"Battery temperature": 31.0,
"Battery SoC": 60.0,
"Inverter Temperature": 46.0,
"Grid power": 0.0,
"Load power": 380.0,
"Total feed-in energy": 3405.5,
"Total consumption": 11682.12,
"Inverter Run Mode": 2.0,
}
Loading
Loading