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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"qvolt_hyb_g3_3p = solax.inverters.qvolt_hyb_g3_3p:QVOLTHYBG33P",
"x1 = solax.inverters.x1:X1",
"x1_boost = solax.inverters.x1_boost:X1Boost",
"x1_boost_g4 = solax.inverters.x1_boost_g4:X1BoostG4",
"x1_g4_series = solax.inverters.x1_g4_series:X1G4Series",
"x1_hybrid_gen4 = solax.inverters.x1_hybrid_gen4:X1HybridGen4",
"x1_mini = solax.inverters.x1_mini:X1Mini",
"x1_mini_v34 = solax.inverters.x1_mini_v34:X1MiniV34",
Expand Down
4 changes: 2 additions & 2 deletions solax/inverters/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .qvolt_hyb_g3_3p import QVOLTHYBG33P
from .x1 import X1
from .x1_boost import X1Boost
from .x1_boost_g4 import X1BoostG4
from .x1_g4_series import X1G4Series
from .x1_hybrid_gen4 import X1HybridGen4
from .x1_mini import X1Mini
from .x1_mini_v34 import X1MiniV34
Expand All @@ -25,7 +25,7 @@
"X3HybridG4",
"X3",
"X1Boost",
"X1BoostG4",
"X1G4Series",
"X1HybridGen4",
"X3MicProG2",
"X3Ultra",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
from solax.utils import div10, div100, pack_u16, to_signed


class X1BoostG4(Inverter):
class X1G4Series(Inverter):
"""
Tested with
X1-Boost gen 4 with Pocket WiFi 3.009.03
and
X1-Mini gen 4 WIFI+LAN 1.001.20

Includes X-Forwarded-For for direct LAN API access
"""

# pylint: disable=duplicate-code
_schema = vol.Schema(
{
vol.Required("type", "type"): vol.All(int, 18),
vol.Required("type", "type"): vol.All(int, vol.Any(18, 22)),
vol.Required(
"sn",
): str,
Expand Down
14 changes: 13 additions & 1 deletion 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_MINI_G4_VALUES,
X1_MINI_VALUES,
X1_MINI_VALUES_V34,
X1_MINI_VALUES_V34_VER3,
Expand Down Expand Up @@ -39,6 +40,7 @@
X1_HYBRID_G3_RESPONSE,
X1_HYBRID_G4_RESPONSE,
X1_HYBRID_G4_V_3_018_RESPONSE,
X1_MINI_G4,
X1_MINI_RESPONSE_V34,
X1_MINI_RESPONSE_V34_VER3,
X1_SMART_RESPONSE,
Expand Down Expand Up @@ -123,6 +125,16 @@ def simple_http_fixture(httpserver):
headers=None,
data=None,
),
InverterUnderTest(
uri="/",
method="POST",
query_string="optType=ReadRealTimeData",
response=X1_MINI_G4,
inverter=inverter.X1G4Series,
values=X1_MINI_G4_VALUES,
headers=None,
data=None,
),
InverterUnderTest(
uri="/",
method="POST",
Expand Down Expand Up @@ -158,7 +170,7 @@ def simple_http_fixture(httpserver):
method="POST",
query_string="optType=ReadRealTimeData",
response=X1_BOOST_RESPONSE_G4_V3,
inverter=inverter.X1BoostG4,
inverter=inverter.X1G4Series,
values=X1_BOOST_VALUES_G4_V3,
headers=X_FORWARDED_HEADER,
data=None,
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 @@ -428,6 +428,25 @@
"Inverter Temperature": 39.0,
}


X1_MINI_G4_VALUES = {
"AC Voltage": 226.1,
"AC Output Current": 0.4,
"AC Output Power": 0.0,
"PV1 Voltage": 77.9,
"PV2 Voltage": 0.0,
"PV1 Current": 0.0,
"PV2 Current": 0.0,
"PV1 Power": 0.0,
"PV2 Power": 0.0,
"AC Frequency": 50.04,
"Total Generated Energy": 638.3,
"Today's Generated Energy": 1.1,
"Exported Power": 0.0,
"Total Export Energy": 0.0,
"Total Import Energy": 0.0,
}

X1_SMART_VALUES = {
"Network Voltage": 239.6,
"Output Current": 12.6,
Expand Down
109 changes: 109 additions & 0 deletions tests/samples/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,115 @@
"Information": [1.500, 4, "XXXXXXXXXXXXXX", 8, 2.27, 0.00, 1.43, 0.00, 0.00, 1],
}

X1_MINI_G4 = {
"sn": "XXXXXXXXXX",
"ver": "1.001.20",
"type": 22,
"Data": [
2261,
4,
5004,
0,
779,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
6383,
0,
11,
2500,
18,
17,
0,
1,
0,
11669,
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,
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": [2.500, 22, "XMXXXXXXXX", 13, 0.15, 0.00, 0.17, 0.00, 0.00, 1],
}

X1_SMART_RESPONSE = {
"sn": "XXXXXXX",
"ver": "2.033.20",
Expand Down
Loading