piitaya / lovelace-mushroom

Build a beautiful Home Assistant dashboard easily
Apache License 2.0
3.69k stars 340 forks source link

FR: ability to set colour thresholds for battery levels & change icons #194

Open conorlap opened 2 years ago

conorlap commented 2 years ago

Describe the solution you'd like It would be great to have the ability to set colour thresholds for battery levels in the entity-card, so that the battery icon can change colour depending on current battery level (eg red / orange / green) - and ability to change the icon for various states too (if device is charging for example)

Additional context

Screenshot 2022-03-10 at 15 47 33

The custom:battery-state-entity card allows you to set colour thresholds and change the icon when the device is charging: Screenshot 2022-03-10 at 15 51 00

antonio1475 commented 2 years ago

This could be accomplished with a template card, if you're in a rush 😄 On the other hand, I honestly thought HA handled the icon state (capacity & charging status)?

conorlap commented 2 years ago

You're right that HA handles the icon state for capacity, but I don't believe it handles for charging.

custom:battery-state-entity card handles it like this:

  - type: custom:battery-state-entity
    tap_action: more-info
    entity: sensor.huawei_watch_battery_level
    name: Conor's Watch
    charging_state:
      state: 'on'
      icon: mdi:battery-charging-outline
      color: yellow
      entity_id: binary_sensor.huawei_watch_is_charging

where it needs the additional binary sensor 'is_charging'

piitaya commented 2 years ago

The icon is already handled by the mushroom-entity-card. Only the color is missing.

neildsb commented 2 years ago

+1 I would love to change the colour icon option for the entity-card based on state or values, I use card_mod for stock cards eg -

Smiggel commented 2 years ago

I use the template card for that personally. But it's quite some work like that. An battery entity card would be really nice. :-)

TarcisioMenezes commented 1 year ago

I agree. Because the purpose of Mushroom is letting users add its cards through the UI easily, I think a battery card would be nice. Yeah, It's possible to do it through the template card but it's a little bit of work to write the templates for icon and color changes. +1 for battery card :D

corvy commented 7 months ago

Me too +1 :D

This could be accomplished with a smart version of the gauge card for mushroom for instance.

This could be the design: image

But add options for setting the color based on SOC levels (% levels or similar). This could be very versatile just like the gauge card.