Skip to content

Solis max export power value fix#3825

Merged
springfall2008 merged 4 commits intomainfrom
fix/solis_export
Apr 24, 2026
Merged

Solis max export power value fix#3825
springfall2008 merged 4 commits intomainfrom
fix/solis_export

Conversation

@springfall2008
Copy link
Copy Markdown
Owner

Copilot AI review requested due to automatic review settings April 24, 2026 07:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.3 to v8.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.

Comment thread apps/predbat/solis.py Outdated
Comment on lines +2143 to +2147
# 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
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment thread apps/predbat/solis.py Outdated
if max_export_power_value < 200:
max_export_power_value *= 100
elif max_export_power_value < 1000:
max_export_power_value *= 10
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

Trailing whitespace at the end of this line will fail pre-commit whitespace hooks; please remove the extra spaces after *= 10.

Copilot uses AI. Check for mistakes.
Comment thread apps/predbat/solis.py Outdated
Comment on lines +2143 to +2147
# 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
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

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.

Copilot generated this review using guidance from repository custom instructions.
@springfall2008 springfall2008 merged commit 78e2e3a into main Apr 24, 2026
1 check passed
@springfall2008 springfall2008 deleted the fix/solis_export branch April 24, 2026 07:56
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