State_color not working for entity-filter

Had this in the 0.105 blog entry but with all the replies there, it might have gotten drowned there

This shows switches yellow when on:

entities:
  - entity: ...
  - entity: ...
  - entity: ...
show_name: true
theme: slate
type: glance
show_state: true
state_color: true

But this DOESN’T. Is ’ type: entity-filter supported for state_color ?

entities:
  - entity: ...
  - entity: ...
  - entity: ...
state_color: true
show_header_toggle: true
state_filter:
  - 'on'
theme: slate
type: entity-filter

Is it by design or something got forgotten?

I can confirm that I see the same behavior in 0.105: state_color doesn’t work with entity-filter.

I just posted it as an Issue in homeassistant-polymer github repo:

0.105: state_color does not work with entity-filter card

I guess I’m not sure why before it was instituted as a change that it wasn’t implemented in every card (at least the officially included ones) that could contain “entities:”.

Here’s the reply I received:

I’ve done the second part (with no revelations) and I thought I was already doing the first part. Has the reply helped anyone else fix the problem?


I simplified my UI’s code down to this and state_color still has no influence on the icon colors.

    cards:
      - type: entity-filter
        state_color: true
        entities:
          - binary_sensor.laundry_door_lock
          - lock.laundry_door_lock
        state_filter:
          - "on"
          - locked
          - unlocked

Where would the suggested “Options for the card … under a nested card option” go in that example?

EDIT
This works:

        entities:
          - entity: binary_sensor.laundry_door_lock
            state_color: true

However, that seems like a workaround for the issue that state_color cannot be defined to apply for all entities within a given entity-filter card.

Works for me too, thanks.

1 Like

I learned how it’s done (from iantrich). You have add a card: option and then put the state_color: option under it.

type: entity-filter
card:
  state_color: true
theme: slate
show_header_toggle: true
state_filter:
  - 'on'
entities:
  - entity: ...
  - entity: ...
  - entity: ...

That will make state_color apply to each entity in entities. If you don’t want to apply to all of them, then you need to specify it on per-entity basis (as shown in my previous post).

2 Likes

hasn’t there been word we could also use the state_color option on a per view basis? Its not in the docs on https://www.home-assistant.io/lovelace/views/ but seem to recall that from the discussion before introduction of state_color.

If not, that might be a good FR :wink: