Fix invalid state_class for session energy sensors - #3
Open
xtux77 wants to merge 1 commit into
Open
Conversation
green_energy_session and grid_energy_session used state_class=MEASUREMENT with device_class=ENERGY, which Home Assistant rejects (logs a warning at startup), since an ENERGY device_class expects TOTAL or TOTAL_INCREASING. Switch both to TOTAL_INCREASING, matching the sibling session_energy sensor. total_increasing correctly models the per-session reset (HA detects the reset), so the per-session semantics are preserved. Fixes botts7#2 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
green_energy_sessionandgrid_energy_sessionare defined withstate_class = MEASUREMENTwhile usingdevice_class = ENERGY. Home Assistantrejects this combination and logs a warning at startup, because an ENERGY
device_classexpectsTOTALorTOTAL_INCREASING, notMEASUREMENT.This PR switches both sensors to
TOTAL_INCREASING, matching the siblingsession_energysensor (which already carries a comment explaining exactlythis).
total_increasingstill models the per-session reset correctly — HAdetects the reset — so the per-session semantics are preserved. The now-stale
comment above the two sensors is updated accordingly.
Testing
python3 -m py_compile custom_components/wallbox_gateway/sensor.pypasses.Fixes #2
🤖 Generated with Claude Code