Advertisement
dykandDK

HA - YAML - Custom:button-card with person and battery states

Dec 20th, 2024
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.82 KB | None | 0 0
  1. type: custom:button-card
  2. icon: mdi:human-male
  3. name: My Name
  4. entity: person.name
  5. state_display: "[[[ return states['sensor.phone_battery_level'].state+'%'; ]]]"
  6. show_state: true
  7. styles:
  8.   grid:
  9.     - grid-template-areas: "'i n s'"
  10.     - grid-template-columns: 70px 2fr 1fr
  11.   name:
  12.     - justify-self: start
  13.   state:
  14.     - justify-self: end
  15.     - margin-right: 12px
  16.     - font-size: 0.8em
  17.   icon:
  18.     - justify-self: start
  19.     - background-color: |
  20.        [[[
  21.           if (entity.state == 'home')
  22.             return "#d3f1b3";
  23.            return "#f1bab3";
  24.         ]]]    
  25.     - color: |
  26.        [[[
  27.           if (entity.state == 'home')
  28.             return "teal";
  29.            return "#E34A37";
  30.         ]]]
  31.     - border-radius: 50%
  32.     - width: 30px
  33.     - height: 30px
  34.     - padding: 5px
  35.     - margin-left: 12px
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement