Skip to content

V1 sph and min methods #129

Merged
johanzander merged 8 commits into
indykoning:masterfrom
GraemeDBlue:master
Jan 23, 2026
Merged

V1 sph and min methods #129
johanzander merged 8 commits into
indykoning:masterfrom
GraemeDBlue:master

Conversation

@GraemeDBlue
Copy link
Copy Markdown
Contributor

@GraemeDBlue GraemeDBlue commented Jan 22, 2026

Summary

Checklist

  • I've made sure the PR does small incremental changes. (new code additions are dificult to review when e.g. the entire repository got improved codestyle in the same PR.)
  • I've added/updated the relevant docs for code changes i've made.

Comment thread growattServer/open_api_v1.py
Implements complete V1 API support for SPH (type 5) hybrid inverters,
parallel to existing MIN device support.

Changes:
- Add DeviceType enum to distinguish device types
- Implement 10 SPH methods in OpenApiV1:
  * sph_detail() - Get device details
  * sph_energy() - Get current energy data
  * sph_energy_history() - Get historical data (7-day max)
  * sph_settings() - Get all inverter settings
  * sph_read_parameter() - Read specific parameters
  * sph_write_parameter() - Write parameters
  * sph_write_ac_charge_time() - Configure AC charge periods (1-3)
  * sph_write_ac_discharge_time() - Configure AC discharge periods (1-3)
  * sph_read_ac_charge_times() - Read all charge periods
  * sph_read_ac_discharge_times() - Read all discharge periods
- Add documentation to docs/openapiv1.md
- Include working example script (examples/sph_example.py)

Technical details:
- SPH devices use 'mix' endpoints internally (device/mix/*)
- AC charge/discharge periods support 3 time windows each
- Methods follow same patterns as existing MIN implementation
- All endpoints match official Growatt V1 API documentation
- sph_read_ac_charge_times now returns dict with charge_power, charge_stop_soc, mains_enabled, and periods
- sph_read_ac_discharge_times now returns dict with discharge_power, discharge_stop_soc, and periods
- Made device_sn optional when settings_data is provided (avoids redundant API calls)
- Updated example to demonstrate new return structure
- Updated documentation with new signatures and return types
Copy link
Copy Markdown
Collaborator

@johanzander johanzander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good.

@johanzander johanzander merged commit dbab616 into indykoning:master Jan 23, 2026
@johanzander
Copy link
Copy Markdown
Collaborator

Thanks for the work and patience @GraemeDBlue !
@indykoning - I've merged this PR please have a look to see if you want any changes for documentation, etc. before your next release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants