lovelace-multiple-entity-row icon indicating copy to clipboard operation
lovelace-multiple-entity-row copied to clipboard

Colored icons for attributes

Open stezak77 opened this issue 5 years ago • 6 comments
trafficstars

I have defined the list of the entities as attributes, each one represented by an icon.

Since they are all binary attributes, I would like each icon colored based on the value of the attribute itself.

Currently, all the icons are colored based on the main entity state.

image

  - type: 'custom:multiple-entity-row'
    name: Front Door
    entity: binary_sensor.front_door
    show_state: false
    secondary_info: last-changed
    entities:
      - attribute: alarm
        state_color: true
        icon: 'mdi:bell'
      - attribute: bypass
        state_color: true
        icon: 'mdi:shield-off'
      - attribute: lowbatt
        state_color: true
        icon: 'mdi:battery-alert'
      - attribute: fault
        state_color: true
        icon: 'mdi:alert'

Would it be possible?

Here's a mockup of what I'd like to achieve (2nd attribute is ON, all other attributes are OFF):

image

stezak77 avatar Apr 16 '20 13:04 stezak77

What do you think @benct ? Any chance to have this feature?

stezak77 avatar Oct 02 '20 15:10 stezak77

Has anyone figured out a way to work around this?

drinfernoo avatar Nov 06 '20 18:11 drinfernoo

An attribute does not have a type and a device_class, so it's not currently possible to define its state. I think new properties should be added in the configuration for the purpose. An option could be to create a template entity whose state is calculated from the attribute, and use this entity in the card.

stezak77 avatar Nov 07 '20 16:11 stezak77

Could we perhaps have an option for state_template? That would allow us to define a template that, when true, would indicate an "on" state.

drinfernoo avatar Nov 07 '20 16:11 drinfernoo

That could be an option, although templates are not supported by the card. Consider the solution with the separate template entity already works now, though defining all the needed template entities might not be very practical (it depends on how many you need)

stezak77 avatar Nov 07 '20 17:11 stezak77

@stezak77 Right.

I already have a REST sensor which queries my Hyperion server, and a template sensor that organizes my needed values into sensor attributes.

I only use six attributes in this way at the moment, which in this instance only means six new switches for my card... but I could easily see a more complex usage of this row leaving my entities cluttered very quickly.

I've done as you suggested, and it does work for my situation, as well as giving me the opportunity to make those icons interactive via a REST command. While this is a somewhat reasonable workaround, it would be very much more convenient to have an actual solution.

Thanks for the help! I've got it working the way I wanted now anyways 😁

drinfernoo avatar Nov 07 '20 18:11 drinfernoo