Remove battery device_class from Fox SOH sensor to prevent HA low-battery false alerts - #4490
Merged
Merged
Conversation
Co-authored-by: springfall2008 <48591903+springfall2008@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Fox Battery SOH sensor device class to prevent low battery alert
Remove Aug 12, 2026
battery device_class from Fox SOH sensor to prevent HA low-battery false alerts
springfall2008
marked this pull request as ready for review
August 12, 2026 07:18
Contributor
There was a problem hiding this comment.
Pull request overview
This PR corrects the Home Assistant metadata for the Fox Battery State of Health (SOH) sensor so it is no longer misclassified as a “battery remaining charge” sensor, preventing false low-battery warnings in the HA Maintenance dashboard.
Changes:
- Removed
device_class: batteryfrom the Fox_battery_sohsensor attributes while keeping the SOH value as a normalized fraction (0.0–1.0) and preserving existing unit/state_class/icon metadata. - Updated the Fox API publishing test to assert that
device_classis not present on the SOH sensor.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/predbat/fox.py | Stops publishing device_class: battery for the Fox battery SOH sensor to avoid HA interpreting SOH as remaining charge %. |
| apps/predbat/tests/test_fox_api.py | Aligns test expectations to require device_class be absent for the SOH entity attributes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fox battery SOH is published as a health factor (
0.0–1.0), but it was tagged withdevice_class: battery, which Home Assistant Maintenance interprets as remaining charge %. This caused persistent false low-battery warnings (e.g.,1.0interpreted as1%).Sensor metadata correction
device_class: battery.stateremains normalized fraction;unit_of_measurement: "*",state_class: "measurement", and icon unchanged).Test expectation alignment
device_classis absent for the SOH entity.