-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Per issue #76, combine multiple register values * #76: replace resets with proposed combiner and fix tests for off-by-one error * fix off-by-one in to_signed and add test for it * Add missing requirement async-timeout and silence warning in it's use * Add timeout for connections since on most recent pocket wifi post hangs * add support for X1 Hybrid G4 * ensure inverters raise if they get an error response from endpoint * add testing for X1 Hybrid G4 * Satisfy cov for new inverter code * remove (unused) bare index from ResponseDecoderType and assoicated code * transpose ResponseDecoderType * Update type annotations for multi-register indices * pin async_timeout version * protocol to define bit packer * appease linter * remove timeout() from this PR * fix ha interface via sensor_map Co-authored-by: Robin Wohlers-Reichel <[email protected]>
- Loading branch information
1 parent
4c4bc83
commit 7feccc8
Showing
12 changed files
with
531 additions
and
172 deletions.
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
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
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,50 @@ | ||
import voluptuous as vol | ||
from solax.inverter import InverterPostData | ||
from solax.units import Units, Total | ||
from solax.utils import div10, div100, pack_u16, to_signed | ||
|
||
|
||
class X1HybridGen4(InverterPostData): | ||
# 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=200, max=200), | ||
) | ||
), | ||
vol.Required("Information"): vol.Schema(vol.All(vol.Length(min=9, max=10))), | ||
}, | ||
extra=vol.REMOVE_EXTRA, | ||
) | ||
|
||
@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), | ||
} |
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
Oops, something went wrong.
7feccc8
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.
Can you help with adding X1 hybrid Solax to Home assistant at all? thank you