šŸ”‹ Lovelace: Battery state card

Thank you. I guess I just somehow missed that section.

Hello! Is there a ways to hide the decimals?

Thanks!

Not at the moment. There is a feature request though, so you can subscribe to get notification once it is added.

To solve this problem now you can create a template sensor and use round function in it to do the rounding.

one of the most usefull cards. great job. i gave you the star in github. thanks a lot

1 Like

Hi,

First of all, thanks for the great card. Iā€™ve been using it for a while now, but just started playing around with groups and such.

I would like to set charging state at the card level. In the docs, it is possible either with the battery entitiyā€™s attribute or its state. However, my devices report their charging state via a separate entity. This works at individual entitiesā€™ level, however I canā€™t figure out if and how this might work at the card level.

Is this even possible?

Sorry it isnā€™t possible ATM. You can create an ā€œenchancementā€ issue at the github for this idea. If it collects some likes I will prioritize it higher

1 Like

Thanks for the info. No big deal, opened an enhancement on github, kept it concise. Weā€™ll see if other people are interested in this fuctionality :wink:

Just wanted to say great card. I use it for batteries, obviously, but with the colors, and sorting, and collapsing a few to keep the list short. :slight_smile:

1 Like
Logger: frontend.js.latest.202108300
Source: components/system_log/__init__.py:190
First occurred: September 12, 2021, 11:05:37 PM (9 occurrences)
Last logged: 11:10:02 AM

https://10.00.0.0:8123/lovelace/main:0:0 Uncaught
https://10.00.0.0:8123/lovelace/battery-levels?edit=1:0:0 Uncaught
https://10.00.0.0:8123/lovelace/home-test-cards?edit=1:0:0 Uncaught
https://10.00.0.0:8123/frontend_latest/e6e55a55.js:79:3930 Uncaught TypeError: Cannot convert undefined or null to object
https://homeasstdnsaddress.duckdns.org:8123/lovelace/main:0:0 Uncaught

What does this mean?

Hi guys,

one question, how i can add my Thermostat from Tuya where i have only state ā€œbattery_lowā€ yes or no ?

So i fund it by myself

  • entity: binary_sensor.heizung_schlafzimmer_battery_low
    name: Heizung Schlafzimmer
    state_map:
    • from: ā€˜offā€™
      to: 100
    • from: ā€˜onā€™
      to: 25
1 Like

Hi,
first of all. I love this card. :smiling_face_with_three_hearts:
As my homematic components only provide voltage values I converted them to percentage by calculation. So far so good. Now i would love to have as secondary information the voltage value which is stored in a sensor called ā€œsensor.spannung_fensterkontakt_badā€

type: custom:battery-state-card
title: Batterien Homematic
color_thresholds:
  - value: 20
    color: '#ff0000'
entities:
  - entity: sensor.prozent_fensterkontakt_bad
    name: Badfenster
    secondary_info: sensor.spannung_fensterkontakt_bad

But this is not working as you can see in this picture.
If it is a stupid question: sorry for that. I am still quite new to home assistant and still learning :slight_smile:

So again, thank you!

home_assistant

Iā€™m very glad that you like the card but sorry, currently getting state from the other entity and displaying it as a secondary_info text is not possible.

The way how secondary info is processed is as follows:

  1. Check if it is equal ā€œchargingā€, if so it is trying to display text information about charging state.
  2. Check if given string is matching any of the top entity properties (default entity properties - look at the screenshot below), if it is matching then it is getting its value
  3. Check if given string matches any name in attributes collection and show attribute value if that is the case

Here is the entity data example:
image

Highlighted properties (their values) can be shown in secondary info field.

If you want such functionality to be added in the future please create a feature request on github.

:warning: Heads up :warning:

Just wanted to let you know that I have just released v2.0.0 :rocket: and there are few breaking changes:

  • When you want to use it as entity (e.g. in entities card) you need to use differnt type: custom:battery-state-entity instead of custom:battery-state-card.
  • Custom styles are not supported any more

Most of the card/entity code was rewritten. It should work much better now so some of the reported problems should disappear (at least I hope so). But since the changes were quite big there might be some other new bugs - in such cases please report them on github or here.

love the card.

but what happened to show_empty: false?
now i have an empty card when batteries are full (over 20%)

image

There was no setting like this although you are right that v1 didnā€™t render the card if there were no entities to show.

You can track the fix via this item: Do not render card if there are no entities to show Ā· Issue #359 Ā· maxwroc/battery-state-card Ā· GitHub

Thanks for reporting this issue!

1 Like

I like this card a lot, Iā€™ve been using it for months now.
Would it be a possibility to include a column to state the date when the battery was changed? so you can follow if the batteries a leaking too fast. Of course where the batteries can be changed, not in phone or tablets, with a matter of recharging.
Maybe the possibility is to include another card in paralel to this one, where this dates could be recorded and showed, but donā€™t know how to do it.
Thanks.

Cards, in general, donā€™t have any abilities to create any records - it wouldnā€™t make sense for them to do it as they exist only in your browser when page is loaded and card shown.

Think about the cards as an interface (UI) used to display stuff and (in some cases) execute actions via services registered in HA.

The thing what you can display via my card is the ā€œlast_updatedā€ and ā€œlast_changedā€ time but it is not the same what you are asking for:
image

In general cards can display only the data which you can find in dev tools (entity state, properties, attributes)
image

You need a custom component to do what you want. The alternative can be an automation and additional custom sensor (per battery entity) which would hold (store as state) such an additional information.

I was wondering. Is it possible to add section, or sub header in the card. I would like to have one section for on-off switches, and one section with Netatmo devices. Or just a space in between.

Please check documentation about groups. You have as well an example at the bottom.