Skip to content

Commit

Permalink
fix discovery for x1 smart with v3 firmware
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Wohlers-Reichel <[email protected]>
  • Loading branch information
squishykid committed Jan 18, 2025
1 parent b8bbc40 commit a3ef0b4
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 2 deletions.
4 changes: 2 additions & 2 deletions solax/inverters/x1_smart.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class X1Smart(Inverter):
vol.Required("data"): vol.Schema(
vol.All(
[vol.Coerce(float)],
vol.Length(min=200, max=200),
vol.Length(min=100, max=200),
)
),
vol.Required("information"): vol.Schema(vol.All(vol.Length(min=8, max=8))),
vol.Required("information"): vol.Schema(vol.All(vol.Length(min=8, max=10))),
},
extra=vol.REMOVE_EXTRA,
)
Expand Down
12 changes: 12 additions & 0 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
X1_MINI_VALUES,
X1_MINI_VALUES_V34,
X1_MINI_VALUES_V34_VER3,
X1_SMART_FW_V3_VALUES,
X1_SMART_VALUES,
X1_VALUES,
X3_EVC_VALUES,
Expand Down Expand Up @@ -43,6 +44,7 @@
X1_MINI_G4,
X1_MINI_RESPONSE_V34,
X1_MINI_RESPONSE_V34_VER3,
X1_SMART_FW_V3_RESPONSE,
X1_SMART_RESPONSE,
X3_EVC_RESPONSE,
X3_HYBRID_G3_2X_MPPT_RESPONSE,
Expand Down Expand Up @@ -145,6 +147,16 @@ def simple_http_fixture(httpserver):
headers=X_FORWARDED_HEADER,
data=None,
),
InverterUnderTest(
uri="/",
method="POST",
query_string="optType=ReadRealTimeData",
response=X1_SMART_FW_V3_RESPONSE,
inverter=inverter.X1Smart,
values=X1_SMART_FW_V3_VALUES,
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 @@ -447,6 +447,25 @@
"Total Import Energy": 0.0,
}

X1_SMART_FW_V3_VALUES = {
"Network Voltage": 239.6,
"Output Current": 12.6,
"AC Power": 2956,
"PV1 Voltage": 432.9,
"PV2 Voltage": 233.8,
"PV1 Current": 4.1,
"PV2 Current": 5.7,
"PV1 Power": 1777,
"PV2 Power": 1336,
"Grid Frequency": 60.21,
"Total Energy": 121.5,
"Today's Energy": 13.7,
"Inverter Temperature": 43,
"Exported Power": 10,
"Total Feed-in Energy": 0.87,
"Total Consumption": 81.84,
}

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 @@ -659,6 +659,115 @@
"Information": [2.500, 22, "XMXXXXXXXX", 13, 0.15, 0.00, 0.17, 0.00, 0.00, 1],
}

X1_SMART_FW_V3_RESPONSE = {
"sn": "XXXXXXXXXX",
"ver": "3.006.04",
"type": 8,
"Data": [
2426,
20,
103,
3470,
1100,
2,
1,
93,
20,
5004,
2,
27207,
2,
353,
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,
6537,
0,
0,
0,
0,
0,
0,
63616,
65535,
37744,
11,
32984,
16,
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": [8.000, 8, "XXXXXXXXXXXX", 8, 1.16, 1.00, 1.09, 0.00, 0.00, 1],
}

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

0 comments on commit a3ef0b4

Please sign in to comment.