Add SPH inverter support to Growatt Server integration#165314
Draft
johanzander wants to merge 8 commits intohome-assistant:devfrom
Draft
Add SPH inverter support to Growatt Server integration#165314johanzander wants to merge 8 commits intohome-assistant:devfrom
johanzander wants to merge 8 commits intohome-assistant:devfrom
Conversation
Adds support for Growatt SPH (Storage Power Hybrid) inverters via the Open API V1 (token authentication). SPH devices are identified as device type 5 in the V1 API. Includes: - 34 sensor entities (battery SOC/voltage, PV power/voltage, energy totals, grid frequency, temperatures, import/export, last update) - Reuses existing mix_* translation keys where semantically equivalent - 4 new services: write_ac_charge_times, write_ac_discharge_times, read_ac_charge_times, read_ac_discharge_times for scheduling battery charge/discharge time periods on SPH devices Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Growatt SPH (Storage Power Hybrid) inverter support to the Growatt Server integration when using the Open API V1 (token authentication), including new SPH sensors and battery scheduling services.
Changes:
- Recognize V1 device type
5assphand initialize coordinators/sensors for SPH devices. - Add SPH sensor entity definitions and corresponding translation strings.
- Add 4 new SPH services for reading/writing AC charge/discharge time periods, with service UI selectors and icons.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/components/growatt_server/test_init.py | Updates unsupported-device-type test now that V1 type 5 is supported. |
| homeassistant/components/growatt_server/init.py | Maps Open API V1 device types to include SPH and allows SPH devices in setup. |
| homeassistant/components/growatt_server/coordinator.py | Fetches SPH data via V1 APIs and adds SPH read/write scheduling helpers. |
| homeassistant/components/growatt_server/services.py | Adds coordinator lookup generalized by device type and registers new SPH services. |
| homeassistant/components/growatt_server/services.yaml | Defines UI selectors/fields for the new SPH services. |
| homeassistant/components/growatt_server/strings.json | Adds SPH sensor translation keys and service strings. |
| homeassistant/components/growatt_server/icons.json | Adds icons for the new SPH services. |
| homeassistant/components/growatt_server/sensor/init.py | Wires SPH sensor descriptions into platform setup. |
| homeassistant/components/growatt_server/sensor/sph.py | Introduces SPH sensor entity descriptions (34 sensors). |
- Add SPH AC charge/discharge time services (write/read) - Fix SPH coordinator: add timestamp parsing error handling - Fix SPH coordinator: preserve upstream service architecture - Add comprehensive tests for SPH sensors and services - Update strings.json with SPH service descriptions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Validate that period start/end are always provided together in SPH write services, raising ServiceValidationError instead of KeyError - Update period time field descriptions to reflect HH:MM:SS support Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove the 'both or neither' constraint on period start/end fields. Each field now independently falls back to its cached value when omitted, consistent with the services.yaml declaration of all period fields as optional. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Apply the read-merge-write pattern consistently: charge_power, charge_stop_soc, mains_enabled, discharge_power, and discharge_stop_soc now fall back to cached device values when not supplied, matching the behaviour of the period fields. Range validation is retained for any value that reaches the write call, whether user-supplied or from cache. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
8 tasks
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.
Proposed change
Adds support for Growatt SPH (Storage Power Hybrid) inverters via the Open API V1 (token authentication). SPH devices are identified as device type 5 in the V1 API.
Includes:
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: