Skip to content

Comments

Remove hardcoded battery icon for Battery State of Charge#306

Open
Q-Claw wants to merge 2 commits intoTypQxQ:mainfrom
Q-Claw:fix/dynamic-battery-icon
Open

Remove hardcoded battery icon for Battery State of Charge#306
Q-Claw wants to merge 2 commits intoTypQxQ:mainfrom
Q-Claw:fix/dynamic-battery-icon

Conversation

@Q-Claw
Copy link

@Q-Claw Q-Claw commented Feb 12, 2026

This removes the hardcoded icon from the plant_ess_soc sensor description.

Home Assistant already provides a default dynamic battery icon for sensors with device_class=battery and SOC in %, but setting icon=mdi:battery forces a static icon.

Fixes #305.

Allow Home Assistant to apply dynamic battery icon based on state of charge.
@greptile-apps
Copy link

greptile-apps bot commented Feb 12, 2026

Greptile Overview

Greptile Summary

Removed the hardcoded icon="mdi:battery" from the plant_ess_soc sensor definition to enable Home Assistant's default dynamic battery icon behavior, which automatically displays battery icons that reflect the current state of charge percentage.

Note: There are two other battery SOC sensors in the codebase (inverter_ess_battery_soc at line 1298 and dc_charger_vehicle_soc at line 1768) that still have hardcoded battery icons, which could benefit from the same treatment for consistency.

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk
  • The change is straightforward and low-risk: it simply removes a hardcoded icon attribute and adds a clarifying comment. The sensor retains all its functional attributes (device_class, native_unit_of_measurement, state_class) which are what actually enable the dynamic icon behavior in Home Assistant. The only minor consideration is consistency with other similar battery SOC sensors in the file that weren't updated.
  • No files require special attention. Consider applying the same change to other battery SOC sensors for consistency.

Important Files Changed

Filename Overview
custom_components/sigen/static_sensor.py Removed hardcoded battery icon from plant_ess_soc to enable dynamic Home Assistant battery icons, but leaves similar inconsistency in other battery SOC sensors

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Feb 12, 2026

Additional Comments (2)

custom_components/sigen/static_sensor.py
Consider removing the hardcoded icon="mdi:battery" here as well for consistency. The inverter_ess_battery_soc sensor has the same device_class=SensorDeviceClass.BATTERY and native_unit_of_measurement=PERCENTAGE configuration as plant_ess_soc, so it would benefit from the same dynamic battery icon behavior.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!


custom_components/sigen/static_sensor.py
Consider removing the hardcoded icon="mdi:battery" from dc_charger_vehicle_soc as well. Like the other SOC sensors with device_class=SensorDeviceClass.BATTERY, it would automatically get a dynamic battery icon that reflects the charge level.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Keep SOC sensors consistent and allow Home Assistant dynamic battery icons.
@Q-Claw
Copy link
Author

Q-Claw commented Feb 12, 2026

Implemented feedback: removed hardcoded battery icon from the other SOC sensors ( and ) as well, so Home Assistant can apply the default dynamic battery icon consistently.

@Q-Claw
Copy link
Author

Q-Claw commented Feb 12, 2026

Implemented feedback: removed the hardcoded battery icon from the other SOC sensors (inverter_ess_battery_soc and dc_charger_vehicle_soc) as well, so Home Assistant can apply the default dynamic battery icon consistently.

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.

[improvement] Remove hardcoded battery icon from Battery State of Charge to enable dynamic icon

1 participant