[Feature]: Battery Card
See original GitHub issueIs your feature request related to a problem?
I have a lot of battery powered smart home devices I’d like to monitor. A regular entity card is not enough because I prefer to color the battery icon based on the battery level. My current workaround involves templates using the sensor’s states: This is what it looks like:
The code looks something like this:
type: custom:mushroom-template-card
primary: Arbeitszimmer Schalter
secondary: '{{ states(entity) }} {{ state_attr(entity, "unit_of_measurement") }}'
icon: |-
{% set level = states(entity) %}
{% set rounded = (level | int / 10) | int * 10 %}
{% if level == 'unknown' %}
mdi:battery-unknown
{% else %}
{% if rounded >= 100 %}
mdi:battery
{% elif rounded > 0 %}
mdi:battery-{{ rounded }}
{% else %}
mdi:battery-alert
{% endif %}
{% endif %}
entity: sensor.arbeitszimmer_schalter_power
icon_color: |
{% set level = states(entity)|int %}
{% if level == 'unknown' %}
purple
{% else %}
{% if level >= 50 %}
green
{% elif level >= 20 and level < 50 %}
orange
{% else %}
red
{% endif %}
{% endif %}
Describe the solution you’d like
The solution would involve a dedicated battery card which requires only the battery sensor to be given in order to achieve the above result.
Describe alternatives you’ve considered
See above.
Additional context
none
Issue Analytics
- State:
- Created a year ago
- Reactions:4
- Comments:5
Top Results From Across the Web
MagSafe Battery Pack - Apple
Pay for your new Apple products over time, interest-free with Apple Card. ... The MagSafe Battery Pack features a compact, intuitive design that...
Read more >The development of the credit card sized battery
It was to meet this demand that the range of credit card batteries was born. ... Despite this compact design, both batteries feature...
Read more >Electric car batteries: everything you need to know
A layperson's guide to electric car batteries: capacity, battery types, tech explainers, costs and how long they last.
Read more >Apple iPhone 14 Leak Reveals Surprising Details Of ... - Forbes
Apple's latest iPhones go on sale this Friday. But one of the most important details, the battery capacity, has just become available.
Read more >Amazon.com: NOCO Boost Plus GB40 1000 Amp 12-Volt ...
Includes the GB40 battery booster jump starter pack, heavy-duty jumper cables, USB charging cable, 12-volt USB car charger, microfiber storage bag, a 1-year ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
would appreciate aswell
I just wanted to share my take on the battery card:
This is my home battery, is the first card in my dashboard and I need this to know if I can use my appliance whitout spending
Right now I am using an entity card and the bar card (now the entity card doesn’t show the percentage, but you could semplify this card moving the percentage from the bar to the entity card)
this is the code:
EDIT: made more simple ad mushroom like: