🔋 Lovelace: Battery state card

Mine works only without the quotes in state as you put above.
sort:
by: state
( with S in sort being at position on one line, and the next line, B in by being under the R in sort. :slight_smile:

Hi maxwroc,

I have tried your map to display the consumption of sockets.
Unfortunately, the color coding of the symbols does not work for values over 100. I think this is due to the fact that batteries can have a maximum of 100%.
Is there a way to display values over 100 in different colors?
And a second question, with a consumption of 1,500W (1.5kW), for example, the color is used for 1.5W. Is it possible to change this somehow, so that (.) is used as a thousands separator and (,) as a decimal separator?

I would appreciate a tip!

There is an issue on github created to track this ask: Enable custom colors for all numeric values (also outside of 0-100 range) · Issue #656 · maxwroc/battery-state-card · GitHub

Once it is closed you may expect it to be working for other ranges too

Hi maxwroc, that sounds good!

If i correct understand, the version 3.3. will support values over 100.

Thanks for quick answering!

Best regards

I recently have installed battery plus HACS integration. I now have a very weird view as can be seen on my screenshot:

When clicking on the knop4 entity:

image

Any thoughts?

Hello @mhoogenbosch took me a hot second to understand what your issue is. A few more words would have been helpful.

Are you talking about the Battery Notes integration? This is an issue I saw before. Complete delete and reinstall the integration.

1 Like

Yes, the Integration I was referring to is Battery Notes, for some reason I thought it was called Battery Plus. Honestly, I don’t know why.

With removing it completely you mean removing ALL device entries and deleting from HACS too?

Correct. Good luck

The problem indeed is gone, but after removing Battery Notes including all devices the issue still remained. Only after deleting the battery state card and reinstalling that, it started working again.

Now I have installed battery notes again, and hopefully it’ll start discovering the batteries again, because manually adding every battery device is a pretty big task.

Thanks again!

Thanks, I’ve implemented this onto my first dash screen now as “Low batteries” although I set it to <15%!

One question however, is do you know if I can use this with a conditional card? i.e. I don’t want to see the card at all unless any of the batteries are less than 15%?

I wonder if I can reuse this bit of code within the conditional card? Sorry, I’m a bit new to all this! Thanks!

filter:
include:
- integration: battery_notes
attributes:
device_class: battery
state: < 16
exclude:
- integration: mobile_app
- name: Kostal-*

I’m confused. My solution already does filter by low and unavailable battery devices.

Here is the complete config again:

type: custom:vertical-stack-in-card
title: Batteries
cards:
  - type: custom:auto-entities
    card:
      type: custom:battery-state-card
      secondary_info: '{attributes.battery_type_and_quantity}'
      bulk_rename:
        - from: ' Battery+'
        - from: ' Batterie+'
      card_mod:
        style: 'ha-card {border: none !important}'
    filter:
      include:
        - integration: battery_notes
          domain: sensor
          attributes:
            device_class: battery
          state: < 50
      exclude:
        - integration: mobile_app
        - name: Kostal-*
    sort:
      method: state
      numeric: true
  - type: custom:auto-entities
    card:
      type: custom:battery-state-card
      secondary_info: >-
        {attributes.battery_type_and_quantity} (Last known level:
        {attributes.battery_last_reported_level}%)
      bulk_rename:
        - from: ' Battery+'
        - from: ' Batterie+'
      card_mod:
        style: 'ha-card {border: none !important}'
    filter:
      include:
        - integration: battery_notes
          domain: sensor
          attributes:
            device_class: battery
          state: unknown
        - integration: battery_notes
          domain: sensor
          attributes:
            device_class: battery
          state: unavailable
      exclude:
        - integration: mobile_app
        - name: Kostal-*
    sort:
      method: state
      numeric: true
  - type: custom:auto-entities
    card:
      type: custom:battery-state-card
      secondary_info: '{attributes.battery_type_and_quantity}'
      bulk_rename:
        - from: ' Battery+'
        - from: ' Batterie+'
      card_mod:
        style: 'ha-card {border: none !important}'
    filter:
      include:
        - integration: battery_notes
          domain: sensor
          attributes:
            device_class: battery
          state: '>= 50'
      exclude:
        - integration: mobile_app
        - name: Kostal-*
    sort:
      method: state
      numeric: true

@thearchitectuk you can simply delete the third part if you are not interested in it

2 Likes

Thank you @ThomDietrich ! In fact I’ve sorted it now. The only difference is that in your example above, it doesn’t completely hide the card for some reason. I have achieved it this way though, based on yours.

type: custom:auto-entities
card:
  type: custom:battery-state-card
  title: Low Batteries
filter:
  include:
    - integration: battery_notes
      domain: sensor
      attributes:
        device_class: battery
      state: <=15
      options:
        name: '{attributes.friendly_name|replace(Battery+,)}'
        secondary_info: '{attributes.battery_type_and_quantity}'
  exclude:
    - integration: mobile_app
sort:
  method: state
  numeric: true
card_mod:
  class: inline-card

image

4 Likes

Took me too long to figure this out so thought I’d reply here if needed:

  exclude:
    - name: attributes.type
      value: browser_mod
2 Likes

For some reason the custom colors is not working for me. Here is my code

          - type: 'custom:battery-state-card'
            secondary_info: last_updated
            tap_action: more-info
            colors:
              steps:
                - value: 10 # applied to all values below/equal
                  color: "#ff0000" # red
                - value: 20 # applied to all values below/equal
                  color: "#ffff00" # yellow
                - value: 100 # applied to all values below/equal
                  color: "#00ff00" # green
              gradient: true
            entities:
              - entity: sensor.soil_tuya_1_battery
                name: Veggies
              - entity: sensor.soil_tuya_2_battery
                name: NW Bed
              - entity: sensor.soil_tuya_3_battery
                name: NE Bed

A few weeks ago I saw a screenshot which added the battery type (eg. AA, AAA, CR2032). Unfortunately I cannot find it anymore. It was located beneath the percentage of the battery level. Would love to add this. I already installed “battery notes”-integration for having the battery types, but don’t know how to add this. Does anyone have an idea?

Andrew shows it in the documentation: Community - Battery Notes for Home Assistant

2 Likes

Thanks, but would really like to see body the battery as the last connected time. And I thought is see a card with both in them. No worries, I can’t find the screen anymore so maybe I have been imaging it.

Hello, is there a way to eliminate the spaces between the entities?
Capture3
I am limited on space on my tablet and have multiple entitles I need to see.

I figured out how to use Card Mod on an Entities Card, but cannot on the Battery State Card.

Thanks in advance for any help!

I included the Battery State card in my dashboard that gives me a nice overview.
What is unclear to me, in what frequency will this card check the battery status for all the battery operated devices? Is this daily?
Is it user defined and where to do this?

Can’t find the answer in the documentation so hope someone using this card can answer this.

The card doesn’t do any checks. It updates when the underlying entities update — like other cards.

2 Likes