Solis max export power value fix#3825
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses Solis Cloud max export power being interpreted with the wrong unit scale (e.g., 60W displayed/used instead of 6000W), which impacts export-related plan costings. It also bumps the Predbat version to reflect the fix.
Changes:
- Normalize the published Solis Cloud “Max Export Power” value to watts by applying a scaling heuristic for small register values.
- Update Predbat version from
v8.37.3tov8.37.4.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| apps/predbat/solis.py | Adjusts how CID 499 “max export power” is converted/published to HA entities (unit scaling). |
| apps/predbat/predbat.py | Version bump to v8.37.4. |
| # Export power seems to have a weird issue with units | ||
| if max_export_power_value < 200: | ||
| max_export_power_value *= 100 | ||
| elif max_export_power_value < 1000: | ||
| max_export_power_value *= 10 |
There was a problem hiding this comment.
The new scaling of max_export_power_value in publish_entities makes the HA number state diverge from the raw CID 499 value. number_event() currently writes max_export_power back using the HA number value directly (no inverse scaling), so a user edit/round-trip can write an incorrect register value. Consider centralizing the unit conversion (read + write) so CID 499 uses a consistent on-wire unit and the HA entity always represents watts.
| if max_export_power_value < 200: | ||
| max_export_power_value *= 100 | ||
| elif max_export_power_value < 1000: | ||
| max_export_power_value *= 10 |
There was a problem hiding this comment.
Trailing whitespace at the end of this line will fail pre-commit whitespace hooks; please remove the extra spaces after *= 10.
| # Export power seems to have a weird issue with units | ||
| if max_export_power_value < 200: | ||
| max_export_power_value *= 100 | ||
| elif max_export_power_value < 1000: | ||
| max_export_power_value *= 10 |
There was a problem hiding this comment.
This new unit-normalization logic isn’t covered by tests. Since apps/predbat/tests/test_solis.py already exercises publish_entities, add assertions for representative CID 499 inputs (e.g., 0 -> no-limit sentinel, 60/600 -> 6000W) to prevent regressions and to document the expected scaling.
…into fix/solis_export
#3802