-
Notifications
You must be signed in to change notification settings - Fork 63
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 solax x1-hybrid-gen5 #131
Open
GustavoIO
wants to merge
1
commit into
squishykid:master
Choose a base branch
from
GustavoIO:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
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 | ||
|
||
|
||
class X1HybridGen5(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, div100), | ||
"Battery power": (16, Units.W), | ||
"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), | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I get this on my Hybrid X1 Gen 4 with updated firmware (at least I suspect so, I just contacted support to update firmware and while they didn't reply anything to me, I suspect they have already done it)