Condition for low battery

I have a bunch of Xiaomi Aqara temperatur sensors connected via deconz to Hassio.
Is it possible to change the icon color of battery_entity when it goes low.
The icons are in ’ Horizontal Stack Card’
Appreciate to know how to proceed …

There’s a custom card for that.

Lovelace Battery Entity Card

EDIT: don’t use this card. It has not been maintained. Use the state-card linked below.

Personally I created a bunch of template sensors to change the icon. I don’t use colors, but you could modify your own accordingly (likely using entity_picture_template vs. icon_template):

battery_ms_thinkpad:
      friendly_name: ThinkPad Battery
      unit_of_measurement: '%'
      value_template: >-
          {{ states('sensor.thinkpad_battery') }}
      icon_template: >-
          {% if is_state('binary_sensor.thinkpad_battery_trend', 'on') %}
            {% set battery_charge = 'charging-' %}
          {% endif %}
          {% set battery_level = states('sensor.thinkpad_battery')|int %}
          {% set battery_round = (battery_level|int / 10)|int * 10 %}
          {% if battery_level == 'unknown' %}
            mdi:battery-unknown
          {% else %}
            {% if battery_round >= 100 %}
              {% if battery_charge == 'charging-' %}
                mdi:battery-charging-100
              {% else %}
                mdi:battery
              {% endif %}
            {% elif battery_round > 9 %}
              mdi:battery-{{battery_charge}}{{ battery_round }}
            {% else %}
              mdi:battery-{{battery_charge}}outline
            {% endif %}
          {% endif %}

For me, different devices have different ways to show if a device is charging, my phones (tracked via Google Maps) are a bit different and don’t use the ‘trend’, but show w/in the device_tracker entity itself:

          {% if is_state_attr('device_tracker.google_maps_xxx', 'battery_charging', true)  %}
            {% set battery_charge = 'charging-' %}
          {% endif %}

Thanks guys … I will test it and give you feedback … have a nice day

Hi, if you have HACS installed, I sugest you to try “Battery State Card” plugin… :slight_smile:

It has already been suggested.

or use the gauge card?

2020-04-29 15_40_21-Admin - Home Assistant and 1 more page - Personal - Microsoft​ Edge

The gauge cards are to big …

Sorry I did not noticed it :stuck_out_tongue_winking_eye: My bad… :slight_smile:

OK … I installed HACS and all went OK but it says …
When installed, this will be located in ‘/config/custom_components/hacs’, you still need to add it to your ‘configuration.yaml’ file.

How do I add it to ‘configuration.yaml’?

There should be a button up the top of the plugin’s page to add it for you. Sorry that’s the resource for plugins.

Follow the instructions here:

There is nothing in the instruction about this … got this when clicking on HACS in left panel

Do I just add

hacs:

without options in configuration.yaml?

No?

What’s this then?

However I’m pretty sure that is not required now that HACS is an integration.

Sorry … I missed it totally.
Thanks for reminding me to study documentation more carefully.

How come I don’t see the HACS store in Add-On store …
I am trying to get the ‘Battery State Card’ but can’t find it …

It’s not in the addon store.

Look for it in the left hand menu bar:

Untitled

Thanks again … I am learning more and more …

Actually what was recommended was the battery-entity plugin.

The battery-state-card plugin is different.

1 Like

Got a link for it?

I can’t find it.

It’s also in HACS.

I literally just installed it minutes ago.

1 Like