fix: add missing state_class and device_class to sensor entities#311
Conversation
Battery percentage, voltage, and temperature sensors were missing state_class: measurement, preventing Home Assistant from recording long-term statistics and excluding them from the Energy Dashboard. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis PR adds ChangesB2500 Base, B2500 V1, and Venus Home Assistant Sensor Definitions
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Completes the state_class additions from #311 for the remaining devices: - Jupiter: BMS capacity (energy_storage) and charge voltage (voltage) were missing state_class: measurement. - B2500 V2: solar input voltage/current, output voltage/current and host/extra battery voltage/current sensors were missing state_class: measurement. Without state_class, Home Assistant does not record long-term statistics for these sensors and the State of Charge sensors cannot be added to the Energy Dashboard battery configuration introduced in HA 2026.6. fixes #310
Completes the state_class additions from #311 for the remaining devices: - Jupiter: BMS capacity (energy_storage) and charge voltage (voltage) were missing state_class: measurement. - B2500 V2: solar input voltage/current, output voltage/current and host/extra battery voltage/current sensors were missing state_class: measurement. Without state_class, Home Assistant does not record long-term statistics for these sensors and the State of Charge sensors cannot be added to the Energy Dashboard battery configuration introduced in HA 2026.6. fixes #310
Completes the state_class additions from #311 for the remaining devices: - Jupiter: BMS capacity (energy_storage) and charge voltage (voltage) were missing state_class: measurement. - B2500 V2: solar input voltage/current, output voltage/current and host/extra battery voltage/current sensors were missing state_class: measurement. Without state_class, Home Assistant does not record long-term statistics for these sensors and the State of Charge sensors cannot be added to the Energy Dashboard battery configuration introduced in HA 2026.6. fixes #310 Co-authored-by: Claude <noreply@anthropic.com>
Several sensor entities were missing
state_class, preventing Home Assistant from recording long-term statistics and excluding them from the Energy Dashboard.Affected sensors across
b2500Base,b2500V1, andvenusdevices:device_class: batterysensors were missingstate_class: measurement, so they did not appear as selectable options in HA's Energy Dashboard battery configuration.device_class: voltagebut nostate_class.temperature_min/temperature_maxand BMS cell temperatures haddevice_class: temperaturebut nostate_class.state_class: measurement.device_class: apparent_powerbut was missingstate_class: measurement.The Jupiter device already had these correctly set and served as the reference. All added values are
state_class: measurement(instantaneous, non-cumulative readings). No logic changes — discovery payload fields only.Tested: manually published a modified MQTT discovery payload with
state_class: measurementvia MQTT Explorer and confirmed the entity appeared in HA Developer Tools with the correct attribute and became selectable in the Energy Dashboard.AI Transparency Note: Change was prepared and implemented with Claude Code
Summary by CodeRabbit