šŸ”‹ Lovelace: Battery state card

  exclude:
    - name: "attributes.device_class"
      value: "timestamp"
filter:
  include:
    - name: entity_id
      value: "*last_seen"
  exclude:
    - name: attributes.device_class
      value: timestamp

I can’t see any entity this way. I only want to see the ones that are unavailable.

Dear all, I want use this card for see the motion sensors sort for detection, but for the motion sensor model RTCGQ02LM, I don’t see the state but the battery percentage.
Can somebody help me?

thanks.

I want to integrate Zigbee valves with the battery state ā€œonā€ for low battery. But I can’t get it to work because the card shows ā€œoffā€ for normal. It has to be inverted.

Here is the entity overview for ā€œlow-batteryā€ of AVATTO ME167:

thanks and greeting

I would like to show only motion sensors, which were triggered within the last 5 Minutes. How can I set a matching include/exclude filter?

I tried this but it doesn’t work:

exclude:
    - name: "{entity.last_changed < now()-timedelta(minutes=5)}"
      operator: "="
      value: "true"

Found a solution with auto-entities:

type: custom:auto-entities
card:
  type: custom:battery-state-card
  secondary_info: "{last_changed}"
  icon: "{state|equals(off,mdi:motion-sensor-off)|equals(on,mdi:motion-sensor)}"
  sort:
    - by: state
      desc: true
    - by: entity.last_changed
      desc: true
  colors:
    steps:
      - value: 0
        color: inherit
      - value: 1
        color: var(--state-active-color)
  unit: null
  state_map:
    - from: "off"
      to: 0
      display: Keine Bewegung
    - from: "on"
      to: 1
      display: Bewegung
  collapse: 0
filter:
  include:
    - options: {}
      domain: binary_sensor
      last_changed: < 15m ago
      attributes:
        device_class: motion
sort:
  method: last_changed
  reverse: true

Is there a way to increase the size of the font and icon?
Maybe with card-mod?
I’m using a high resolution, wall mounted display, and the font is small and hard to read.
I opened a request here, but I noticed that there hasn’t been much activity on the github, so I was wondering if there is an alternate way to do it in the mean time.
Any help is appreciated.

card_mod:
  style: |
    ha-card .entity-spacing {
      margin: -10px 0px;
    }

This does not seem to work anymore with card_mod 4.0. Any idea how to fix this?

Seems that any card-mod styles are not working :confused:

Just checked card_mod and custom:battery-state-card and all looks to be fine and should not need any changes.

If you experiencing issues it is likely that card_mod is running twice, so clearing caches could help. However, if this is the case, and you are using extra_module_url then check out the updated Performance improvements recommendations documentation. Specifically, if your Dashboard resource URL and extra_module_url is not exactly the same, your Browser will run card_mod twice and cause wierd issues like card_mod not applying.

I could only get it working when I add this on top:

type: custom:mod-card
card:

Is this to be expected or should it also work without?

I do not have extra_module_url in my config and I cleared the browser cache.

You could try using prepend: true to your card_mod config. Looking at the battery-state-card code, I am not sure how long it takes to generate the list. If it has nothing to show it does not include a card, which may mean that card_mod gets removed when the card is finally shown.

card_mod:
  prepend: true
  style: |
    ...

next to that, it requires !important
tbh, not sure why you would want to do that, as it is very ugly, and the name touches the secondary info.

other than that, it works

type: custom:battery-state-card
card_mod:
  prepend: true
  style: |
    .entity-spacing {
      margin: -10px !important;
    }

1 Like

Thanks, the prepend works. @Marius: I am doing this since I am not using secondary info in this case, and then the spacing is (for me) much too large.

Thanks for the update. I have updated v4.0.0 BREAKING CHANGES - Check here first Ā· Issue #498 Ā· thomasloven/lovelace-card-mod Ā· GitHub to list custom:battery-state-card under the prepend section.

note: in my config it required the !important to make the margin modifications get applied.

other than that I also see a warning on the card itself.

SchermĀ­afbeelding 2025-11-23 om 22.10.36

not using the card itself, I wont pursue here, but might be an issue worth raising in that repo

I use the battery-state-card in my setup and appreciate the work that went into it. Over the past months I’ve seen several interesting PRs and issues waiting in the queue, and I’m wondering whether there’s a chance for future updates.

@maxwroc, if you’re still following the project: is there any outlook on whether the card might receive further maintenance, or would community support be helpful to keep things moving?

First off, I’d like to thank you for battery state card! After migrating from Hubitat to HA about 2 months ago, I’ve looked at several battery monitoring solutions. Most had numerous options I’d never use. This is straightforward and brilliant!

Now for my question – I’m trying to add your card and configure it using the signal strength YAML. But when I paste it as you can see there is nothing displayed to the right of the YAML. When I save the card there is nothing shown but an edit button. I’m using HA 2025.12.0.

-Thanks