custom-cards / button-card

❇️ Lovelace button-card for home assistant
MIT License
1.93k stars 233 forks source link

state: wont override core icon #726

Closed Mariusthvdb closed 1 year ago

Mariusthvdb commented 1 year ago

Checklist

Describe the bug A clear and concise description of what the bug is.

since the new state icon calculation is taken from core HA in version 4 (dev), the following config wont set the icon anymore, even though it is places last in the config

Version of the card Version: 400dev5 To Reproduce This is the configuration I used:

type: custom:button-card
show_name: true
entity: input_boolean.override_cover_dorm

state:
  - value: 'on'
    id: on-picture
    icon: mdi:window-shutter-alert
  - value: 'off'
    id: off-picture
    icon: cil:shutter-0

Screenshots If applicable, add screenshots to help explain your problem.

Scherm­afbeelding 2023-07-24 om 10 06 59

Expected behavior A clear and concise description of what you expected to happen. have the state: config override the icon

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

I can override the icon with:

icon: >
  [[[ return (entity.state === 'on') ? 'mdi:window-shutter-alert' : 'cil:shutter-0'; ]]]
# state:
#   - value: 'on'
#     id: on-picture
#     icon: mdi:window-shutter-alert
# #            entity_picture: /local/modes/spike_on.png
#   - value: 'off'
#     id: off-picture
#     icon: cil:shutter-0
Scherm­afbeelding 2023-07-24 om 10 16 14 Scherm­afbeelding 2023-07-24 om 10 16 47

which is perfectly fine of course. It's just a bit unexpected the state: wont work anymore

RomRider commented 1 year ago

It works well on my side, so there's maybe something in the button-card templates you're using that breaks it?

              - type: 'custom:button-card'
                color_type: card
                entity: switch.skylight
                state:
                  - value: 'on'
                    icon: mdi:alert
                  - value: 'off'
                    icon: mdi:flash

imageimage

Mariusthvdb commented 1 year ago

yes, seeing the same on some other cards, so maybe it was a fluke or the one card. closing and Ill see what caused it. thx