Fix: charge_limit and reserve dummy sensors incorrectly use device_class=battery#4271
Open
springfall2008 with Copilot wants to merge 2 commits into
Open
Fix: charge_limit and reserve dummy sensors incorrectly use device_class=battery#4271springfall2008 with Copilot wants to merge 2 commits into
springfall2008 with Copilot wants to merge 2 commits into
Conversation
… entities The charge_limit and reserve entities created for non-GE inverters (e.g. FoxESS) were incorrectly using device_class="battery", causing Home Assistant to include them in the Maintenance dashboard and warn about "low battery" when the charge target is set to a low percentage. These are configuration target entities, not battery state sensors, so they should not have device_class="battery". Changed to: - charge_limit: device_class=None, icon="mdi:target" - reserve: device_class=None, icon="mdi:battery-lock" Also added icon parameter support to create_entity() to allow meaningful icons for these entities. Closes #4268
Copilot
AI
changed the title
[WIP] Fix charge-limit target sensor exposure with battery device class
Fix: charge_limit and reserve dummy sensors incorrectly use device_class=battery
Jul 18, 2026
springfall2008
marked this pull request as ready for review
July 18, 2026 14:01
Contributor
There was a problem hiding this comment.
Pull request overview
This PR corrects how Predbat creates dummy Home Assistant entities for non-GivEnergy inverters by ensuring configuration target sensors (reserve and charge limit) are not misclassified as battery state sensors, avoiding misleading “low battery” maintenance warnings.
Changes:
- Removed
device_class="battery"from dummyreserveandcharge_limitsensors and added more appropriate icons. - Extended
Inverter.create_entity()to accept an optionaliconparameter and persist it into created entity attributes.
| return {} | ||
|
|
||
| def create_entity(self, entity_name, value, uom=None, device_class="None"): | ||
| def create_entity(self, entity_name, value, uom=None, device_class="None", icon=None): |
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.
Dummy entities created for non-GE inverters (FoxESS, etc.) used
device_class="battery"forcharge_limitandreserve, causing HA to treat charge targets as battery SoC — surfacing spurious "low battery" warnings in the Maintenance dashboard for normal targets like 10%.Changes
inverter.py—create_entity()call-sites: Removedevice_class="battery"fromcharge_limitandreservedummy entities; add appropriate icons (mdi:target,mdi:battery-lock)inverter.py—create_entity()signature: Add optionaliconparameter so callers can set an icon without needing to manipulate attributes directlyThese entities are configuration targets, not battery state sensors — they should be generic percentage measurements with no device class.