Conversation
Growatt SPH inverters use a different scheduling model from MIN: separate
charge and discharge period lists (max 3 each) with global power/SOC
settings, rather than 9 TOU segments with per-segment modes.
Changes:
- New SphScheduleManager in sph_schedule.py implementing the SPH model
- GrowattScheduleManager moved to min_schedule.py; growatt_schedule.py
kept as backward-compat re-export
- Both managers implement write_schedule_to_hardware() and
read_and_initialize_from_hardware() so BatterySystemManager can use
either interchangeably via duck typing
- 4 new SPH service methods on HomeAssistantAPIController:
write_ac_charge_times, read_ac_charge_times,
write_ac_discharge_times, read_ac_discharge_times
- config.yaml: new inverter_type field ("MIN" or "SPH") under growatt
- 25 behavioral unit tests for SphScheduleManager
SPH intent mapping:
GRID_CHARGING → charge period (mains_enabled=True)
SOLAR_STORAGE → idle (SPH charges from solar by default)
LOAD_SUPPORT → discharge period
EXPORT_ARBITRAGE → discharge period
IDLE → nothing (inverter default)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
GraemeDBlue - care to try this one out? |
- growatt_schedule.py: keep re-export stub (implementation is in min_schedule.py) - battery_system_manager.py: keep tou_intervals (both MIN and SPH managers use it; active_tou_intervals from main does not exist in this branch's architecture) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The merge of main (v7.9.3) into this branch introduced current_period and previous_tou_intervals parameters to create_schedule, but min_schedule.py and sph_schedule.py were missing those parameters causing a TypeError on every schedule creation attempt. Also fix _apply_schedule to use active_tou_intervals consistent with the updated schedule manager interface from main. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SPH battery control health check was incorrectly checking for MIN-style HA entity sensors that don't exist on SPH installations. Replace with a live read_ac_charge_times() call to verify Growatt service connectivity. Add sync_soc_limits() to both schedule managers so SOC limits are synced at startup regardless of inverter type. SPH reads current periods from hardware first, then writes back only if charge/discharge stop SOC differs from config. MIN uses existing entity-based set/verify calls. Swap startup order so hardware init runs before SOC sync — required for SPH since the write needs cached periods, and more logical in general. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@johanzander I am seeing this in my logs if it helps |
|
@johanzander great only 1 remaining sensor, which we don't seem to have in the growatt integration
|
|
is there no import from grid sensors available? Seems weird that there is an export to grid but not import to grid. Or is it misconfigured? |
|
@johanzander looks like we can add this but for mix/sph
|
|
@johanzander I know why I never noticed this as my system relies on a CT clamp for this, which is very out of sync so i use my smart meter itself to provide me with this data, in this instance it uses the Octopus meter data |
|
Do you have any idea if we should add the key only to SPH, or if it exist also for MIX, with the same API key etoUserTotal? |
if you add it to growatt_server/sensor/sph.py first I can verify that, and then I will check the legacy and see if it exists there , can't get it working for some reason atm using the latest PyPi version of the library |
|
sensor available now in the upstream version: https://github.com/johanzander/growatt_server_upstream/releases/tag/v2.5.0 |
@johanzander yup trying it out now, updated as soon as I saw you did a new release |
|
The only thing now is I'm having issues with influx, cannot for the life of me get it to work, I dont see any data being stored in influx, not even a schema Got the bess to work , but it took a while to generate it schedule and then it decided to dump my entire battery to export right when I needed it I still have not actual data showing anyway as getting this error |
|
Would be good to get this working, as it takes some time to build the data for the optimization which you experienced, and not ideal during debug/development where one need to restart, install new version, etc.
will have a look at it.
|
SphScheduleManager was missing three methods called by the API: - get_all_tou_segments() - get_strategic_intent_summary() - get_detailed_period_groups() These caused runtime errors on every Inverter page load for SPH users. Also adds INTENT_TO_MODE class constant (was missing, needed by the above). Power Monitoring health check now skips sensors with no entity ID configured instead of reporting 404 errors. If no current sensors are set up at all, returns a clean OK/not-configured result. Users without phase current sensors no longer see false-alarm health warnings. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Power monitoring is now disabled by default. When disabled, the health check returns a WARNING (not an error) and the cron job does not run. When enabled, all phase current sensors are required — fully deterministic. The 'message' field is now also shown in the health check UI for disabled/ warning states. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
New version available, fixed 3 (configurable, set it to false) and 4 . |
Resolves conflicts between power_monitoring_enabled (this branch) and consumption_strategy (main) — both fields kept in HomeSettings and _apply_settings. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@johanzander thanks, I'll try this tomorrow, Im away today. |
|
@johanzander not sure what has changed now as getting this error now I can see data now in my influx database, but still getting a 500 error in bess when trying to access the db |
|
can you export and share the debug logs instead? It in the upper right corner on the system health page. |
- Add energy provider configuration (Octopus entity IDs, Nordpool config) to debug report settings section, making it visible when users share logs - Detect placeholder InfluxDB credentials and surface a clear WARNING in health check instead of failing with a connection error Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Hi, You are still running an old BESS version. The SPH support is on a branch, but the HA AddOn method does not support branches, it fetches from main. I see two approaches. Either you install it from locally instead. Or I merge the SPH support to main, as experimental support. The local installation has a few more steps: To install the feature branch locally: Maybe not the smoothest experience. Let me know what you prefer, happy to merge to main if that is easier. |
Hi, That's what I have been doing, it forced me to upgrade but then I did the instructions above to copy the sph branch over it, I can fully remove and try again to make sure |
|
@johanzander so the Inverter and Insights pages are now populating , but the the Dashboard and Savings still give me 500's
|
|
|
@GraemeDBlue what I've done now is:
So to make the finalization of this feature faster I propose that you:
Then I can replay your setup and hopefully make it work (or at least get the basics working) without having an SPH inverter! |
@johanzander great sounds like a good idea, I do think there might still need to be additional work on the Octopus bit for my particular product Flux as the schedule it predicted would have made me charge from grid during expensive slots , that I avoid, but let's get the mechanics working and then come back to the scheduler |
|
merged. |











Summary
Growatt SPH inverters use a fundamentally different scheduling model from MIN inverters — separate charge and discharge period lists (max 3 each) with global power/SOC settings per call, rather than 9 TOU segments with per-segment modes. This PR adds
SphScheduleManagerso BESS Manager can drive both inverter families from the same optimization engine.SPH vs MIN Scheduling Model
inverter_type: "MIN"inverter_type: "SPH"update_time_segmentwrite_ac_charge_times/write_ac_discharge_timesSPH Intent Mapping
GRID_CHARGINGmains_enabled=TrueSOLAR_STORAGELOAD_SUPPORTEXPORT_ARBITRAGEIDLEChanges
New Files
core/bess/sph_schedule.py—SphScheduleManagerimplementing the SPH scheduling model with the same duck-typed interface asGrowattScheduleManagercore/bess/min_schedule.py—GrowattScheduleManagermoved here fromgrowatt_schedule.py; original file kept as a backward-compat re-export so existing imports are unaffectedcore/bess/tests/unit/test_sph_schedule.py— 25 behavioural unit testsModified Files
core/bess/ha_api_controller.py— 4 new SPH service methods:write_ac_charge_times,read_ac_charge_times,write_ac_discharge_times,read_ac_discharge_timescore/bess/battery_system_manager.py— Factory selects MIN vs SPH manager based oninverter_type;_apply_schedulesimplified to delegate hardware writes towrite_schedule_to_hardware()config.yaml— Newgrowatt.inverter_typefield ("MIN"or"SPH", defaults to"MIN")Configuration
To enable SPH mode, add
inverter_type: "SPH"under thegrowattsection inconfig.yaml:No other configuration changes are needed —
device_idworks for both inverter types.Tests
test_weather.py(unrelated DST issue, not introduced by this PR)Notes for Reviewers
The upstream
growatt_serverHA integration defines the SPH services and these are expected to land in HA Core. Two things may need adjusting once the final HA API is confirmed:period_1_start,period_1_end,period_1_enabled(up toperiod_3_*). Verify these match the final service schema.charge_poweranddischarge_powerare currently sent as100(percentage). Verify whether the service expects a percentage or absolute kW value.