Advertisement
dykandDK

HA - YAML - Custom:button-card example - conditional checkboxes

Feb 24th, 2024
957
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.18 KB | None | 0 0
  1. type: horizontal-stack
  2. cards:
  3.   - type: custom:button-card
  4.     entity: input_boolean.checkbox1
  5.     name: Checkbox 1
  6.     state_color: false
  7.     state:
  8.       - operator: '=='
  9.         value: 'off'
  10.         icon: mdi:checkbox-blank-outline
  11.         color: var(--paper-item-icon-color)
  12.       - operator: '=='
  13.         value: 'on'
  14.         icon: mdi:checkbox-outline
  15.         color: var(--paper-item-icon-color)
  16.     styles:
  17.       name:
  18.         - font-size: 12px
  19.   - type: custom:button-card
  20.     entity: input_boolean.checkbox2
  21.     name: Checkbox 2
  22.     state_color: false
  23.     state:
  24.       - operator: '=='
  25.         value: 'off'
  26.         icon: mdi:checkbox-blank-outline
  27.         color: var(--paper-item-icon-color)
  28.       - operator: '=='
  29.         value: 'on'
  30.         icon: mdi:checkbox-outline
  31.         color: var(--paper-item-icon-color)
  32.     styles:
  33.       name:
  34.         - font-size: 12px
  35.       card:
  36.         - background-color: >-
  37.             [[[ if (states['input_boolean.checkbox1'].state == 'off')
  38.             {return 'grey';} ]]]
  39.     tap_action:
  40.       action: >-
  41.         [[[ if (states['input_boolean.checkbox1'].state == 'on') {return
  42.         'toggle';} else {return 'null';}]]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement