Skip to content

Tile Icon Spark

Der Tile Icon Spark fügt ein ha-tile-icon in ein Forge-Element ein. Du kannst ein MDI-Icon, einen SVG-Pfad, ein Bild oder ein Entity-basiertes State-Icon verwenden.

Grundnutzung

TIP

Dieser Spark ist besonders hilfreich, wenn eine Karte ein Tile-ähnliches Zusatzicon braucht, ohne dass du das eigentliche Kartenelement austauschst.

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: tile-icon
      after: hui-tile-card $ ha-tile-icon
      icon: mdi:star
      color: amber
element:
  type: tile
  entity: light.living_room

Konfiguration

SchlüsselTypPflichtStandardBeschreibung
typestringja-Muss tile-icon sein.
afterstringafter oder beforeBei Blank Card uix-forge-blank-card $ div.content, sonst "".UIX-Selektor für das Referenzelement. Das Icon wird danach als Geschwisterelement eingefügt.
beforestringafter oder before-UIX-Selektor für das Referenzelement. Das Icon wird davor eingefügt.
iconstringeine Iconquelle-MDI-Icon, z. B. mdi:star. Kann auch das Entity-Icon ersetzen, wenn entity gesetzt ist.
icon_pathstringeine Iconquelle-SVG-Pfad für ha-tile-icon als iconPath, gerendert über ha-svg-icon.
image_urlstringeine Iconquelle-Bild-URL innerhalb des Tile-Icons.
entitystringeine Iconquelle-Entity-ID. Der aktuelle State wird an ein ha-state-icon im Icon-Slot übergeben.
colorCSS colornein-Farbe des Tile-Icons. Überschreibt Entity-State-Farbe.
tap_actionactionnein-Aktion bei Tap.
hold_actionactionnein-Aktion bei langem Drücken.
double_tap_actionactionnein-Aktion bei Doppeltap.

::: note Für die Iconquelle muss mindestens einer dieser Werte gesetzt sein: icon, icon_path, image_url oder entity.

:::

TIP

Mit entity bekommst du Home Assistants native State-Icon-Logik. Mit icon oder image_url steuerst du das Aussehen selbst.

Aktionen

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: tile-icon
      after: hui-tile-card $ ha-tile-info
      icon: mdi:power
      color: red
      entity: switch.fan
      tap_action:
        action: toggle
      hold_action:
        action: more-info
element:
  type: tile
  entity: sensor.room_temperature

::: note Klicks auf das eingefügte Icon werden getrennt von Aktionen des Ziel- oder Elternelements behandelt.

:::

Beispiele

MDI-Icon einfügen

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: tile-icon
      after: hui-tile-card $ ha-tile-icon
      icon: mdi:sofa
      color: indigo
element:
  type: tile
  entity: light.living_room

Entity-State-Icon nutzen

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: tile-icon
      before: hui-tile-card $ ha-tile-info
      entity: binary_sensor.window
      color: state
element:
  type: tile
  entity: climate.living_room

Eigenen SVG-Pfad verwenden

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: tile-icon
      after: hui-tile-card $ ha-tile-info
      icon_path: "M12,2A10,10 0 1,0 22,12A10,10 0 0,0 12,2Z"
      color: var(--primary-color)
element:
  type: tile
  entity: sensor.custom_value

Bild-Icon

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: tile-icon
      after: hui-tile-card $ ha-tile-icon
      image_url: /local/icons/room.png
element:
  type: tile
  entity: sensor.room_mode