marcokreeft87 / room-card

Show multiple entity states, attributes and icons in a single card in Home Assistant's Lovelace UI
MIT License
228 stars 38 forks source link

Styles and templating does not work for light entities #346

Closed lennon101 closed 2 months ago

lennon101 commented 2 months ago

Which version of Room Card?

1.08.04

Describe the bug

Using the styling (as outlined in the wiki) I can change the color of an enitity that is anything is but a light, but a light will not obey the same code.

Screenshots

Screenshot 2024-08-30 at 7 42 19 AM

YAML

type: custom:room-card
title: Living Room
entity: light.movie_lamp
show_state: false
entities:
  - entity: light.movie_lamp
    name: Movie Lamp
    tap_action:
      action: toggle
    show_icon: true
    show_state: true
    icon:
      template:
        styles: |
          if (entity.state == 'on') return 'color: yellow';  
  - entity: input_boolean.sleep_mode
    name: Sleep Mode
    tap_action:
      action: toggle
    show_icon: true
    show_state: true
    icon:
      template:
        styles: |
          if (entity.state == 'on') return 'color: yellow';  
marcokreeft87 commented 2 months ago

Please check the wiki because your syntax is wrong. You are missing 'color: ' in front of it.

Also, 1 bug is enough on the same subject :)

lennon101 commented 2 months ago

I figured this was a seperate bug and required a separate issue raised.

When you say that the "Color" is missing, missing where? Could you please provide a deeper explanation?

marcokreeft87 commented 2 months ago

Oh you arent missing that part, weird on mobile it didnt display. But in this "bug" you are using the template wrong.

Check out the wiki : https://github.com/marcokreeft87/room-card/wiki/Configuration#templates