šŸ”‹ Lovelace: Battery state card

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

Hi maxwroc, thank you so much for this wonderfull card.

This is exaclty the way i want my batteries to be showed, iā€™m trying to include in the less than 30% state batteries section that are not visible for the past 7 days, is it possible?

Hello. Is there any way (other than using pre-defined groups, as the idea is precisely not to have to specify a fixed list of entities) of, after applying the first filter in a macro way custom:battery-state-card, reapplying a second filter for each collapse, filtering by name of the entity. I know the code below doesnā€™t work, but I added it just to illustrate what i need. I tried to do it with a template but I couldnā€™t.

        - type: custom:battery-state-card
          title: "All Battery"
          filter:
            include:
              - name: "attributes.device_class"
                value: "battery"
          collapse:
            - name: 'Door Sensors (Qt: {count})' 
              filter:
                include:
                  - name: entity_id
                    value: '*_door_*'          
            - name: 'Temperature sensors (Qt: {count})' 
              filter:
                include:
                  - name: entity_id
                    value: '*_temp_*'          
            - name: 'Presence sensors (Qt: {count})' 
              filter:
                include:
                  - name: entity_id
                    value: '*_presence_*'          

Is it possible to change the background of this card? Canā€™t seem to figure it out.

You can change the line-height and I would assume you will need to reduce the line-height of the secondary info line. I havenā€™t figured it out myself but I would also like to do this so will report back if I figure it out

That would be great! Thanks!