Skip to content
Discussion options

You must be logged in to vote

Two options. Both of these require sensor to have device class of battery which then manages the battery icon. If this is not possible with yoru existing sensor then you will need to use a template sensor with device class of battery.

  1. Use ha-state-icon. Difficult method.
  2. Use a nested button-card. Easy and preferred. button-card uses ha-state-icon internally.
type: custom:button-card
name: Battery
styles:
  grid:
    - grid-template-areas: "\"n extra extra1\""
    - grid-template-columns: 1fr 1fr 1fr
custom_fields:
  extra: |
    [[[
      // Wait for updateComplete
      this.updateComplete.then(() => {
        if (!this.myExtra) {
          this.myExtra = true;
          let battery = …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dcapslock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #627 on August 30, 2025 02:31.