Skip to content

Fix/fox half kw capacity - #4534

Closed
springfall2008 wants to merge 2 commits into
mainfrom
fix/fox-half-kw-capacity
Closed

springfall2008 wants to merge 2 commits into
mainfrom
fix/fox-half-kw-capacity

Conversation

@springfall2008

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI lite review requested due to automatic review settings August 15, 2026 14:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 improves the Fox ESS integration by correcting inverter capacity handling for half‑kW models (e.g., KH10.5 reporting a truncated integer capacity) and by rounding production “today/month” totals to avoid floating-point artifacts in published sensor states.

Changes:

  • Add FoxAPI.capacity_watts() and use it when clamping scheduler power limits and publishing inverter capacity.
  • Round Fox production totals for “_today” and “_month” sensors to 2 decimal places via dp2().
  • Extend Fox API test coverage with targeted cases for half‑kW capacity correction and production rounding.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
apps/predbat/fox.py Adds half‑kW capacity correction helper, applies it to scheduler clamping and published capacity, and rounds production totals.
apps/predbat/tests/test_fox_api.py Adds regression tests for half‑kW capacity correction, scheduler clamping behavior, and production rounding.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread apps/predbat/fox.py
Comment on lines 908 to +910
if result is not None:
self.device_detail[deviceSN] = result
self.log("Fox: Device detail {}".format(result))
springfall2008 and others added 2 commits August 15, 2026 15:29
…n totals

Fox's device/detail 'capacity' field is a truncated integer, so a 10.5kW
KH10.5 inverter reported as 10kW everywhere - both the reported
inverter_capacity/inverter_limit sensor and the fdpwr_max clamp that was
silently capping the correct 10500W scheduler value down to 10000W. Now
corrects the value from deviceType when it ends in '.5'. Also round the
_today/_month production sensors (e.g. generation_today) which were
carrying long floating-point summation artifacts from Fox's raw history
data.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…e margin

Cap at inverter_capacity directly now that capacity_watts() already
corrects half-kW deviceTypes - the earlier +999W tolerance was a blunter
hack that could let a genuinely bogus fdpwr reading through undetected.
@springfall2008
springfall2008 force-pushed the fix/fox-half-kw-capacity branch from 9d96930 to f3eee8f Compare August 15, 2026 14:30
@springfall2008

Copy link
Copy Markdown
Owner Author

Superseded by #4532 - rebasing onto main leaves this PR empty (identical tree).

@springfall2008
springfall2008 deleted the fix/fox-half-kw-capacity branch August 15, 2026 14:32
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