Skip to content

Script Card

Description

example-image

This card starts/runs a script. You can configure icon and text.

Variables

Variable Default Required Notes
ulm_card_script_title Name to show for the script.
ulm_card_script_icon Icon to show for the script.
tap_action_action Only call-service is allowed here.
tap_action_service Let the script run by turning it on.
tap_action_service_data This is the service_data needed by your script. That can be an entity_id and/or some variables.

Usage

- type: 'custom:button-card'
  template: card_script
  variables:
    ulm_card_script_title: Romantic lights
    ulm_card_script_icon: 'mdi:candle'
  tap_action:
    action: call-service
    service: script.turn_on
    service_data:
      entity_id: script.romantic_livingroom_lights
Template Code
card_script.yaml
---
### Card Script ###
card_script:
  template:
    - "icon_only"
  label: "[[[ return variables.ulm_card_script_title; ]]]"
  icon: "[[[ return variables.ulm_card_script_icon; ]]]"
  styles:
    icon:
      - color: "rgba(var(--color-blue),0.7)"
    label:
      - align-self: "center"
      - font-size: "14px"
      - filter: "opacity(100%)"
    img_cell:
      - background-color: "rgba(var(--color-blue), 0.2)"
    grid:
      - grid-template-columns: "min-content min-content"