Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for X1 mini G4 #183

Merged
merged 15 commits into from
Jan 6, 2025
5 changes: 4 additions & 1 deletion solax/inverters/x1_boost.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ class X1Boost(Inverter):
vol.Required("data"): vol.Schema(
vol.All(
[vol.Coerce(float)],
vol.Length(min=200, max=200),
vol.Any(
vol.Length(min=100, max=100),
vol.Length(min=200, max=200),
),
)
),
vol.Required("information"): vol.Schema(
Expand Down
12 changes: 12 additions & 0 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from tests.samples.expected_values import (
QVOLTHYBG33P_VALUES,
X1_BOOST_VALUES,
X1_BOOST_VALUES_V3,
X1_BOOST_VALUES_OVERFLOWN,
X1_HYBRID_G4_VALUES,
X1_MINI_VALUES,
Expand All @@ -28,6 +29,7 @@
QVOLTHYBG33P_RESPONSE_V34,
X1_BOOST_AIR_MINI_RESPONSE,
X1_BOOST_RESPONSE,
X1_BOOST_RESPONSE_V3,
X1_BOOST_RESPONSE_OVERFLOWN,
X1_HYBRID_G3_2X_MPPT_RESPONSE,
X1_HYBRID_G3_RESPONSE,
Expand Down Expand Up @@ -135,6 +137,16 @@ def simple_http_fixture(httpserver):
headers=X_FORWARDED_HEADER,
data=None,
),
InverterUnderTest(
uri="/",
method="POST",
query_string="optType=ReadRealTimeData",
response=X1_BOOST_RESPONSE_V3,
inverter=inverter.X1Boost,
values=X1_BOOST_VALUES_V3,
headers=X_FORWARDED_HEADER,
data=None,
),
InverterUnderTest(
uri="/",
method="POST",
Expand Down
19 changes: 19 additions & 0 deletions tests/samples/expected_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,25 @@
"Total Import Energy": 81.84,
}

X1_BOOST_VALUES_V3 = {
"AC Voltage": 228.1,
"AC Output Current": 3.1,
"AC Output Power": 703.0,
"PV1 Voltage": 120.7,
"PV2 Voltage": 125.4,
"PV1 Current": 2.9,
"PV2 Current": 2.9,
"PV1 Power": 356.0,
"PV2 Power": 365.0,
"AC Frequency": 50.02,
"Total Generated Energy": 2029.3,
"Today's Generated Energy": 5.0,
"Inverter Temperature": 30.0,
"Exported Power": 0.0,
"Total Export Energy": 0.0,
"Total Import Energy": 0.0,
}

X1_BOOST_VALUES_OVERFLOWN = {
"AC Voltage": 237.4,
"AC Output Current": 6.7,
Expand Down
109 changes: 109 additions & 0 deletions tests/samples/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,115 @@
"Information": [3.680, 4, "XXXXXXX", 1, 2.06, 0, 1.27, 0, 0, 1],
}

X1_BOOST_RESPONSE_V3 = {
"sn": "XXXXXXX",
"ver": "3.006.04",
"type": 4,
"Data": [
2281,
31,
703,
1207,
1254,
29,
29,
356,
365,
5002,
2,
20293,
0,
50,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
30,
0,
2152,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
36,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
],
"Information": [3, 4, "XXXXXXX", 8, 2.27, 0, 1.43, 0, 0, 1],
}

X3_MIC_RESPONSE = {
"type": "X3-MIC",
"SN": "XXXXXXX",
Expand Down