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

Entity Objects with just an icon are not rendered #338

Closed felixmxr closed 2 months ago

felixmxr commented 5 months ago

Which version of Room Card? v1.08.04

Describe the bug Entity Objects created with just an "icon" and no "entity" or "attribute" are not rendered

To Reproduce Steps to reproduce the behavior: create an entity object under "entitites" as follows

Expected behavior According to the documentation (https://github.com/marcokreeft87/room-card/wiki/Configuration#entity-objects), I would expect this object to be rendered

Additional context if any valid "entity" is added to the object it works

YAML

type: custom:room-card
entity: switch.tv
name: test
icon: mdi:remote-tv
show_icon: true
entities:
  - entity: switch.am4_switch_0
  - icon: mdi:pause
    show_icon: true
    name: pause
    tap_action:
          action: call-service
          service: webostv.button
          service_data:
            entity_id: media_player.lg_webos_tv_oled55c97la
            button: PLAY
felixmxr commented 5 months ago

i think the problem comes from line 239 of entity.ts https://github.com/marcokreeft87/room-card/blob/77a80f587667d2fe304eeab87b6bdfedeb6a747f/src/entity.ts#L239

it seems no html will be output if entity.stateobj is undefined. which i think will always be the case when defining an object with just an icon and no entity or attribute

marcokreeft87 commented 2 months ago

I now get what you mean. But you are right, you need an entity thats the whole point of the card