banner-card icon indicating copy to clipboard operation
banner-card copied to clipboard

Icons for switch and light is not working

Open estevez-dev opened this issue 3 years ago • 3 comments

Banner card version: 0.13.0 Home Assistant version: 2021.4.3

Card configuration:

type: 'custom:banner-card'
heading:
  - Kitchen
background: '#81559B'
entities:
  - entity: light.kitchen
    name: Light
    value: 'mdi:ceiling-light'
  - entity: switch.kitchen_tv
    value: 'mdi:television'
    name: TV

Result: screenshot-homeassistant_8123-2021 04 12-13_50_49

estevez-dev avatar Apr 12 '21 10:04 estevez-dev

Solution is simple. Overwrite with domain: sensor

See sample:

- entity: switch.switch
  name: Is it on?
  domain: sensor
  value: mdi:star
  color: black
  map_state:
    "on":
      color: yellow

conradhagemans avatar Apr 12 '21 13:04 conradhagemans

An issue with this solution is that when using domain: sensor to force the icons, the switch no longer responds to a single click to toggle the light, and instead opens the details panel for the entity.

Is there a way around this? I would normally expect a press to toggle an entity, and a hold to open the details panel.

EDIT: I got it sorted. I didn't realise you could call services discretely from Lovelace cards themselves! I always thought they needed to be defined in config - but there you go, I learned something great today.

  - entity: light.lounge
    domain: sensor
    action:
      service: light.toggle
      entity_id: light.lounge
    name: Room Light
    value: mdi:ceiling-light
    color: white
    map_state:
      'on':
        color: yellow

Interestingly, though, when using the action property, the icons lose their hover mouse-cursor. Not a huge deal since we're mostly using HA on the phone, but worth pointing out.

MaxVRAM avatar Sep 20 '21 08:09 MaxVRAM

Thank you guys for the workaround, I got my icons working again since downgrading from extended-banner-card, after it broke in 2021.11. Is there any chance we could get the icons working without having to change the domain to sensor and add an action that calls a service in this card? Thanks!

airampg avatar Dec 13 '21 17:12 airampg