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

fix: improve schema validation so it succeeds for qvolt_hyb_g3_3p inverter #163

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion solax/inverters/qvolt_hyb_g3_3p.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, http_client: InverterHttpClient, *args, **kwargs):
vol.Required("data"): vol.Schema(
vol.All(
[vol.Coerce(float)],
vol.Length(min=200, max=200),
vol.Length(min=200, max=400),
)
),
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 @@ -6,6 +6,7 @@
import solax.inverters as inverter
from tests.samples.expected_values import (
QVOLTHYBG33P_VALUES,
QVOLTHYBG33P_VALUES_V3_15,
X1_BOOST_VALUES,
X1_BOOST_VALUES_OVERFLOWN,
X1_HYBRID_G4_VALUES,
Expand All @@ -25,6 +26,7 @@
XHYBRID_VALUES,
)
from tests.samples.responses import (
QVOLTHYBG33P_RESPONSE_V3_15,
QVOLTHYBG33P_RESPONSE_V34,
X1_BOOST_AIR_MINI_RESPONSE,
X1_BOOST_RESPONSE,
Expand Down Expand Up @@ -265,6 +267,16 @@ def simple_http_fixture(httpserver):
headers=None,
data=None,
),
InverterUnderTest(
uri="/",
method="POST",
query_string="",
response=QVOLTHYBG33P_RESPONSE_V3_15,
inverter=inverter.QVOLTHYBG33P,
values=QVOLTHYBG33P_VALUES_V3_15,
headers=None,
data=None,
),
InverterUnderTest(
uri="/",
method="POST",
Expand Down
43 changes: 43 additions & 0 deletions tests/samples/expected_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,49 @@
"Battery Operation mode": "Self Use Mode",
}

QVOLTHYBG33P_VALUES_V3_15 = {
"Network Voltage Phase 1": 221.4,
"Network Voltage Phase 2": 223.8,
"Network Voltage Phase 3": 225.1,
"Output Current Phase 1": 1.1,
"Output Current Phase 2": 1.0,
"Output Current Phase 3": 1.2,
"Power Now Phase 1": 162.0,
"Power Now Phase 2": 136.0,
"Power Now Phase 3": 146.0,
"AC Power": 444.0,
"PV1 Voltage": 566.2,
"PV2 Voltage": 568.2,
"PV1 Current": 1.8,
"PV2 Current": 1.7,
"PV1 Power": 1050.0,
"PV2 Power": 977.0,
"Grid Frequency Phase 1": 50.02,
"Grid Frequency Phase 2": 50.01,
"Grid Frequency Phase 3": 50.02,
"Inverter Operation mode": "Normal",
"Exported Power": -7.0,
"Battery Voltage": 323.4,
"Battery Current": 5.0,
"Battery Power": 1616.0,
"Power Now": 451.0,
"Total Energy": 219.0,
"Total Battery Discharge Energy": 73.8,
"Total Battery Charge Energy": 90.4,
"Today's Battery Discharge Energy": 0.0,
"Today's Battery Charge Energy": 8.1,
"Total PV Energy": 231.6,
"Today's Energy": 11.8,
"Total Feed-in Energy": 107.94,
"Total Consumption": 145.44,
"Today's Feed-in Energy": 1.66,
"Today's Consumption": 4.66,
"Battery Remaining Capacity": 95.0,
"Battery Temperature": 35.0,
"Battery Remaining Energy": 8.8,
"Battery Operation mode": "Self Use Mode",
}

X1_HYBRID_G4_VALUES = {
"AC voltage R": 247.0,
"AC current": 1.1,
Expand Down
Loading
Loading