Advertisement
Guest User

HaCasa Cover Card

a guest
Mar 23rd, 2025
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 4.28 KB | None | 0 0
  1. hc_cover_card:
  2.   variables:
  3.     cover_entity:
  4.     cover_unit: "%"
  5.     graph_color: white
  6.     show_graph: false
  7.     show_graph_line: true
  8.     show_graph_fill: false
  9.   show_state: true
  10.   styles:
  11.     grid:
  12.       - grid-template-areas: |
  13.          '. i'
  14.           'n n'
  15.           's s'
  16.           'graph graph'
  17.       - grid-template-rows: min-content min-content 1fr
  18.     card:
  19.       - padding: 10px
  20.     name:
  21.       - text-align: left
  22.       - font-family: Montserrat
  23.       - font-weight: 700
  24.       - justify-self: start
  25.       - align-self: end
  26.       - font-size: 1rem
  27.     state:
  28.       - text-align: left
  29.       - font-size: 0.8rem
  30.       - font-family: Montserrat
  31.       - font-weight: 500
  32.       - justify-self: start
  33.       - align-self: center
  34.       - opacity: 0.7
  35.     icon:
  36.       - width: 60%
  37.       - color: white  # Default color for icon
  38.     img_cell:
  39.       - background: var(--opacity-contrast-100)
  40.       - padding: 6px
  41.       - border-radius: 50%
  42.       - width: 25px
  43.       - height: 25px
  44.       - align-self: start
  45.       - margin-bottom: 10px
  46.     custom_fields:
  47.       graph:
  48.         - display: |
  49.            [[[
  50.               if (variables.show_graph) {
  51.                 return 'block';
  52.               }
  53.               else {
  54.                 return 'none';
  55.               }
  56.             ]]]
  57.         - position: absolute
  58.         - left: 0
  59.         - bottom: 0
  60.         - width: 100%
  61.         - z-index: 1
  62.   state:
  63.     - value: "open"
  64.       styles:
  65.         card:
  66.           - background: var(--color-blue)
  67.         name:
  68.           - color: white
  69.         label:
  70.           - color: white
  71.         state:
  72.           - color: white
  73.         icon:
  74.           - color: white  # White icon for blue background
  75.       state_display: |
  76.        [[[
  77.           if (entity.state === "open") {
  78.             return "Open";
  79.           }
  80.         ]]]
  81.     - value: "closed"
  82.       styles:
  83.         card:
  84.         name:
  85.           - color: white
  86.         label:
  87.           - color: white
  88.         state:
  89.           - color: white
  90.         icon:
  91.           - color: white  # White icon for red background
  92.       state_display: |
  93.        [[[
  94.           if (entity.state === "closed") {
  95.             return "Closed";
  96.           }
  97.         ]]]
  98.     - value: "unknown"
  99.       styles:
  100.         card:
  101.           - background: white  # Change the background to white when the state is "Unknown"
  102.         name:
  103.           - color: black   # Optional: change text color for better contrast
  104.         label:
  105.           - color: black   # Optional: change label color for better contrast
  106.         state:
  107.           - color: black   # Optional: change state text color for better contrast
  108.         icon:
  109.           - color: white   # White icon inside dark circle
  110.         img_cell:
  111.           - background: black  # Dark circle for unknown state
  112.       state_display: |
  113.        [[[
  114.           if (entity.state === "unknown") {
  115.             return "Tilted Open";
  116.           }
  117.         ]]]
  118.     - value: unavailable
  119.       styles:
  120.         name:
  121.           - text-decoration: line-through
  122.         icon:
  123.           - color: var(--icon-color-default)
  124.         img_cell:
  125.           - background: var(--background-icon-color-default)
  126.         card:
  127.           - opacity: 0.6
  128.           - pointer-events: none
  129.   custom_fields:
  130.     graph:
  131.       card:
  132.         type: custom:mini-graph-card
  133.         entities:
  134.           - entity: "[[[ return variables.cover_entity ]]]"
  135.             show_fill: "[[[ return variables.show_graph_fill ]]]"
  136.             show_line: "[[[ return variables.show_graph_line ]]]"
  137.         show:
  138.           name: false
  139.           icon: false
  140.           state: false
  141.         line_width: 2
  142.         line_color: "[[[ return variables.graph_color ]]]"
  143.         card_mod:
  144.           style: |
  145.            ha-card {
  146.               background: none;
  147.               box-shadow: none;
  148.               --ha-card-border-width: 0;
  149.               z-index: 1
  150.             }
  151.   slider:
  152.     entity: "[[[ return variables.cover_entity ]]]"
  153.     name: "Blinds Control"
  154.     min: 0
  155.     max: 100
  156.     step: 1
  157.     unit_of_measurement: "[[[ return variables.cover_unit ]]]"
  158.     type: "slider"
  159.     card_mod:
  160.       style: |
  161.        ha-card {
  162.           background: var(--background-color);
  163.           box-shadow: none;
  164.           padding: 10px
  165.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement