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-Hybrid-7.5-D inverter #117

Open
wants to merge 1 commit 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: 2 additions & 0 deletions solax/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
X3V34,
X1Boost,
X1HybridGen4,
X1Hybrid75D,
X1Mini,
X1MiniV34,
X1Smart,
Expand All @@ -30,6 +31,7 @@
QVOLTHYBG33P,
X1Boost,
X1HybridGen4,
X1Hybrid75D,
]


Expand Down
2 changes: 2 additions & 0 deletions solax/inverters/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .qvolt_hyb_g3_3p import QVOLTHYBG33P
from .x1 import X1
from .x1_boost import X1Boost
from .x1_hybrid_75_d import X1Hybrid75D
from .x1_hybrid_gen4 import X1HybridGen4
from .x1_mini import X1Mini
from .x1_mini_v34 import X1MiniV34
Expand All @@ -22,4 +23,5 @@
"X3",
"X1Boost",
"X1HybridGen4",
"X1Hybrid75D",
]
64 changes: 64 additions & 0 deletions solax/inverters/x1_hybrid_75_d.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import voluptuous as vol
from solax import utils
from solax.inverter import Inverter, InverterHttpClient, Method, ResponseParser
from solax.units import Total, Units
from solax.utils import div10, div100, pack_u16, to_signed, twoway_div100


class X1Hybrid75D(Inverter):
# pylint: disable=duplicate-code
_schema = vol.Schema(
{
vol.Required("type"): vol.All(int, 15),
vol.Required(
"sn",
): str,
vol.Required("ver"): str,
vol.Required("Data"): vol.Schema(
vol.All(
[vol.Coerce(float)],
vol.Length(min=300, max=300),
)
),
vol.Required("Information"): vol.Schema(vol.All(vol.Length(min=9, max=10))),
},
extra=vol.REMOVE_EXTRA,
)

@classmethod
def _build(cls, host, port, pwd="", params_in_query=True):
url = utils.to_url(host, port)
http_client = InverterHttpClient(url, Method.POST, pwd).with_default_data()

response_parser = ResponseParser(cls._schema, cls.response_decoder())
return cls(http_client, response_parser)

@classmethod
def build_all_variants(cls, host, port, pwd=""):
versions = [cls._build(host, port, pwd)]
return versions

@classmethod
def response_decoder(cls):
return {
"AC voltage R": (0, Units.V, div10),
"AC current": (1, Units.A, div10),
"AC power": (2, Units.W),
"Grid frequency": (3, Units.HZ, div100),
"PV1 voltage": (4, Units.V, div10),
"PV2 voltage": (5, Units.V, div10),
"PV1 current": (6, Units.A, div10),
"PV2 current": (7, Units.A, div10),
"PV1 power": (8, Units.W),
"PV2 power": (9, Units.W),
"On-grid total yield": (pack_u16(11, 12), Total(Units.KWH), div10),
"On-grid daily yield": (13, Units.KWH, div10),
"Battery voltage": (14, Units.V, 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),
"Grid power": (32, Units.W, to_signed),
"Total feed-in energy": (pack_u16(34, 35), Total(Units.KWH), div100),
"Total consumption": (pack_u16(36, 37), Total(Units.KWH), div100),
}