Change group icon color based on battery percent left?

Hey all! I’m wondering if its possible to change the group battery icon to a different color based on if any one of the batteries falls bellow a certain or preset threshold and activate/change color at say 20 percent?

batteries:
  name: battery levels
  icon: mdi:battery
  entities:
    - sensor.driveway_battery
    - sensor.battery_garage_side_door
    - sensor.vnote20_battery_level
    - sensor.convert_smart_lock_battery_level

Not straightforward in the “more info” dialog that you’re showing there. card-mod might be able to, and can certainly do it for icons in regular cards.

1 Like

I don’t think the sensor domain is supported by group.

1 Like

I don’t change the icon but change the color of a bar. I use the custom:bar-card to change color of the bar graph for battery charge. I also separate out my battery status.

Example yaml:

type: custom:auto-entities
sort:
  method: state
  numeric: true
card:
  type: custom:bar-card
  severity:
    - color: '#bf4040'
      from: 0
      to: 30
    - color: '#bf9540'
      from: 30.1
      to: 70
    - color: '#40bf40'
      from: 70.1
      to: 100
  show_header_toggle: false
  title: Batteries in Good Shape
  height: 16
  positions:
    value: inside
    indicator: outside
    icon: 'off'
    name: inside
    minmax: 'off'
filter:
  include:
    - entity_id: '*battery*'
  exclude:
    - state: <70.1
    - state: unavailable
    - name: '*State*'
    - name: '*Health*'
    - state: unknown
    - entity_id: '*temperature*'
    - state: 'off'
    - state: idle
1 Like

That’s pretty brilliant. Thanks for sharing.

The other option is:

1 Like