Sigenergy cloud support#3963
Open
springfall2008 wants to merge 19 commits into
Open
Conversation
…red into feat/sigenergy_cloud
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Sigenergy (Sigenstor) cloud integration to Predbat, including REST polling for telemetry, MQTT-based command/control, and a dedicated unit test suite, plus related configuration and component registration updates.
Changes:
- Introduces
SigenergyAPIcomponent (REST + MQTT) and registers it in the component system. - Adds comprehensive Sigenergy integration tests and wires them into the custom unit test runner.
- Extends web apps.yaml UI redaction rules to include PEM-based config keys.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/predbat/web.py | Expands the UI redaction filter to also hide _pem config fields. |
| apps/predbat/unit_test.py | Registers Sigenergy test runner in the unit-test registry. |
| apps/predbat/tests/test_sigenergy.py | New unit tests for Sigenergy REST, MQTT, controls, and helper logic. |
| apps/predbat/sigenergy.py | New Sigenergy Cloud API component implementation (REST polling + MQTT commands + HA entity publishing). |
| apps/predbat/config.py | Adds SIGCLOUD inverter type definition and Sigenergy-specific config keys. |
| apps/predbat/components.py | Registers the new sigenergy component and maps apps.yaml config to component args. |
Comment on lines
+3381
to
3382
| if ("_key" in arg) or ("_password" in arg) or ("_secret" in arg) or ("_pem" in arg): | ||
| value = '<span title = "{}"> (hidden)</span>'.format(value) |
Comment on lines
+353
to
+358
| "args": { | ||
| "system_id": {"required": True, "config": "sigenergy_system_id"}, | ||
| "app_key": {"required": True, "config": "sigenergy_app_key"}, | ||
| "app_secret": {"required": True, "config": "sigenergy_app_secret"}, | ||
| "base_url": {"required": False, "config": "sigenergy_base_url", "default": "https://openapi-eu.sigencloud.com"}, | ||
| "mqtt_host": {"required": False, "config": "sigenergy_mqtt_host"}, |
| "has_charge_enable_time": True, | ||
| "has_discharge_enable_time": True, | ||
| "has_target_soc": True, | ||
| "has_reserve_soc": False, |
| "sigenergy_app_secret": {"type": "string", "empty": False}, | ||
| "sigenergy_base_url": {"type": "string", "empty": False}, | ||
| "sigenergy_mqtt_host": {"type": "string", "empty": False}, | ||
| "sigenergy_system_id": {"type": "string", "empty": False}, |
| SIGENERGY_CODE_STATION_NOT_FOUND = 1106 | ||
| SIGENERGY_CODE_AIO_INVERTER_ONLY = 1107 | ||
| SIGENERGY_CODE_STATION_INFO_NOT_FOUND = 1108 | ||
| SIGENERGY_CODE_RPC_FAIL = 1109 |
Comment on lines
+165
to
+167
| # Time options for schedule selects (HH:MM, one per minute) | ||
| _BASE_TIME = datetime.strptime("00:00", "%H:%M") | ||
| SIGENERGY_OPTIONS_TIME = [(_BASE_TIME + timedelta(seconds=m * 60)).strftime("%H:%M") for m in range(0, 24 * 60)] |
| "friendly_name": "Sigenergy {} PV Today".format(system_name), | ||
| "unit_of_measurement": "kWh", | ||
| "device_class": "energy", | ||
| "state_class": "total_increasing", |
| field_type = "number" | ||
| field_units = "%" | ||
|
|
||
| ha_name = "{}.{}_{}_{}".format(field_type, self.prefix, "sigenergy", item_name.replace("sigenergy_{}_".format(slug), slug + "_", 1)) |
Comment on lines
+737
to
+741
| # Some implementations return an empty data field on success — treat None as success | ||
| # if the HTTP call didn't raise (the _request wrapper returns None for both API errors | ||
| # and non-zero code responses, but we can't distinguish here without more context). | ||
| self.log("SigenergyAPI: set_operating_mode({}) returned None — assuming success".format(mode_int)) | ||
| return True |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.