Advertisement
dykandDK

HA - YAML - Custom button card example with custom fields

Dec 16th, 2022
1,926
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.37 KB | None | 0 0
  1. type: custom:button-card
  2. name: Mobile Subscription
  3. custom_fields:
  4.   gauge:
  5.     card:
  6.       type: gauge
  7.       entity: sensor.processor_use
  8.       name: Data Usage
  9.   percent: >
  10.     [[[ return `<ha-icon icon="mdi:cellphone-arrow-down" style="width: 16px;
  11.     height: 16px; color: white;"></ha-icon>&nbsp;&nbsp;Data
  12.    used:&nbsp;&nbsp;&nbsp;&nbsp; `+states['sensor.processor_use'].state + '
  13.    Gb'   ]]]
  14.  gb: >
  15.    [[[ return `<ha-icon icon="mdi:transfer-down" style="width: 16px; height:
  16.     16px; color: white;"> </ha-icon>&nbsp;&nbsp;Total data:&nbsp;&nbsp;&nbsp;`+
  17.    ' 100 Gb'   ]]]
  18.  mb: >
  19.    [[[ return `<ha-icon icon="mdi:swap-vertical-bold" style="width: 16px;
  20.     height: 16px; color: white;"> </ha-icon>&nbsp;&nbsp;Remaining: `+
  21.    '&nbsp;&nbsp;&nbsp;89 Gb'  ]]]
  22. styles:
  23.  grid:
  24.    - grid-template-areas: '"n n" "gauge percent" "gauge gb" "gauge mb"'
  25.    - grid-template-columns: 30% 1fr
  26.    - grid-template-rows: 1fr 1fr 1fr 1fr
  27.  name:
  28.    - align-self: middle
  29.    - justify-self: start
  30.    - padding-left: 10px
  31.  custom_fields:
  32.    gauge:
  33.      - padding-left: 10px
  34.    percent:
  35.      - align-self: middle
  36.      - justify-self: start
  37.      - padding-left: 30px
  38.    gb:
  39.      - align-self: middle
  40.      - justify-self: start
  41.      - padding-left: 30px
  42.    mb:
  43.      - align-self: middle
  44.      - justify-self: start
  45.      - padding-left: 30px
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement