fredrik_persson_

MiniHass Light Card GUI

Oct 30th, 2023
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 4.48 KB | None | 0 0
  1. views:
  2.   - title: test
  3.     path: test
  4.     badges: []
  5.     cards:
  6.       - type: "custom:button-card"
  7.         entity: input_boolean.dummy_scene1
  8.         template:
  9.          - custom_card_light
  10.         variables:
  11.           light_name: Decor
  12.           light_label: Inside
  13.           show_toggle: false
  14. button_card_templates:
  15.   custom_card_light:
  16.     variables:
  17.       light_name: null
  18.       light_label: null
  19.     entity: '[[[ return entity.entity_id ]]]'
  20.     name: '[[[ return variables.light_name ]]]'
  21.     label: '[[[ return variables.light_label ]]]'
  22.     show_name: true
  23.     show_icon: false
  24.     show_label: true
  25.     show_state: false
  26.     styles:
  27.       grid:
  28.         - grid-template-areas: |
  29.            [[[
  30.               if (entity.state == "on"){
  31.                 return '". icon_on" "n n" "l i"';
  32.               } else {
  33.                 return '". icon_off" "n n" "l i"';
  34.               }
  35.             ]]]
  36.         - grid-template-rows: 1fr 1fr 1fr
  37.         - grid-template-columns: 1fr 1fr
  38.         - row-gap: 8px
  39.       card:
  40.         - height: 100%
  41.         - border-radius: var(--border-radius)
  42.         - box-shadow: var(--box-shadow)
  43.         - padding: 1rem
  44.       img_cell:
  45.         - justify-content: end
  46.         - overflow: hidden
  47.         - padding: 0 0 0 0
  48.       icon:
  49.         - justify-self: end
  50.         - align-self: center
  51.         - color: var(--color-white)
  52.         - width: var(--button-small)
  53.         - padding: 0 0 0 0
  54.         - overflow: hidden
  55.       name:
  56.         - text-align: left
  57.         - font-size: var(--fs-500)
  58.         - font-family: Montserrat
  59.         - font-weight: 600
  60.         - justify-self: start
  61.         - align-self: end
  62.         - color: var(--contrast-100)
  63.         - overflow: visible
  64.       label:
  65.         - text-align: left
  66.         - font-size: var(--fs-400)
  67.         - font-family: Montserrat
  68.         - font-weight: 500
  69.         - justify-self: start
  70.         - align-self: center
  71.         - color: var(--contrast-100)
  72.         - overflow: visible
  73.       custom_fields:
  74.         icon_on:
  75.           - display: |
  76.              [[[
  77.                 if (entity.state == "on"){
  78.                   return 'block';
  79.                 } else {
  80.                   return 'none';
  81.                 }
  82.               ]]]
  83.           - width: 12px
  84.           - justify-self: end
  85.           - margin-right: 8px
  86.           - color: var(--contrast-33)
  87.         icon_off:
  88.           - display: |
  89.              [[[
  90.                 if (entity.state == "off"){
  91.                   return 'block';
  92.                 } else {
  93.                   return 'none';
  94.                 }
  95.               ]]]
  96.           - width: 12px
  97.           - justify-self: end
  98.           - margin-right: 8px
  99.           - color: var(--contrast-33)
  100.     state:
  101.       - value: 'off'
  102.         icon: mdi:toggle-switch-off-outline
  103.         styles:
  104.           icon:
  105.             - color: var(--contrast-33)
  106.       - value: 'on'
  107.         icon: mdi:toggle-switch-outline
  108.         styles:
  109.           card:
  110.             - background: var(--color-yellow)
  111.           name:
  112.             - color: var(--contrast-0)
  113.           label:
  114.             - color: var(--contrast-0)
  115.           icon:
  116.             - color: var(--contrast-0)
  117.           custom_fields:
  118.             icon_on:
  119.               - color: var(--contrast-0)
  120.             icon_off:
  121.               - color: var(--contrast-0)
  122.     custom_fields:
  123.       icon_on: |
  124.        [[[
  125.           if (entity.state == "on"){
  126.             return '<ha-icon icon="fas:lightbulb"></ha-icon>';
  127.           } else {
  128.             return '<ha-icon icon="far:lightbulb"></ha-icon>';
  129.           }
  130.         ]]]
  131.       icon_off: |
  132.        [[[
  133.           if (entity.state == "on"){
  134.             return '<ha-icon icon="fas:lightbulb"></ha-icon>';
  135.           } else {
  136.             return '<ha-icon icon="far:lightbulb"></ha-icon>';
  137.           }
  138.         ]]]
  139.     extra_styles: |
  140.      :hover #icon_on.ellipsis{
  141.         transform: scale(1.35) !important;
  142.         transition: transform .3s ease-in-out;
  143.       }
  144.  
  145.       :not(:hover) #icon_on.ellipsis{
  146.         transform: scale(1) !important;
  147.         transition: transform .6s ease-in-out;
  148.       }
  149.  
  150.       :hover #icon_off.ellipsis{
  151.         transform: scale(1.35) !important;
  152.         color: var(--color-yellow) !important;
  153.         transition: transform .3s ease-in-out, color .3s ease-in-out;
  154.       }
  155.  
  156.       :not(:hover) #icon_off.ellipsis{
  157.         transform: scale(1) !important;
  158.         transition: transform .6s ease-in-out, color .3s ease-in-out;
  159.       }
Advertisement
Add Comment
Please, Sign In to add comment