Advertisement
Guest User

HaCasa cover template

a guest
Mar 23rd, 2025
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.94 KB | Software | 0 0
  1. hc_cover_card:
  2. variables:
  3. show_mode_state: true
  4. show_label: true
  5. show_state: true
  6. state_display: |
  7. [[[
  8. return "Currently " + states[entity.entity_id].state + ' - ' + states[entity.entity_id].attributes.current_position + '%'
  9. ]]]
  10. label: |
  11. [[[
  12. var label = ""
  13. if (variables.show_mode_state == true & states[entity.entity_id].state === "open") {
  14. label = "<ha-icon icon='mdi:window-shutter-open' style='width: 100px; height: 100px'></ha-icon>"
  15. } else if (variables.show_mode_state == true & states[entity.entity_id].state === "opening") {
  16. label = "<ha-icon icon='mdi:window-shutter-open' style='cwidth: 100px; height: 100px'></ha-icon>"
  17. } else if (variables.show_mode_state == true & states[entity.entity_id].state === "closing") {
  18. label = "<ha-icon icon='mdi:window-shutter' style='width: 100px; height: 100px'></ha-icon>"
  19. } else if (variables.show_mode_state == true & states[entity.entity_id].state === "closed") {
  20. label = "<ha-icon icon='mdi:window-shutter' style='width: 100px; height: 100px'></ha-icon>"
  21. } else {
  22. label = "<ha-icon icon='mdi:window-shutter' style='width: 100px; height: 100px'></ha-icon>"
  23. }
  24. return label
  25. ]]]
  26. show_icon: false
  27. state:
  28. - value: opening
  29. styles:
  30. card:
  31. - background: var(--color-blue)
  32. name:
  33. - color: white
  34. label:
  35. - color: white
  36. state:
  37. - color: white
  38. - value: closing
  39. styles:
  40. card:
  41. - background: var(--color-red)
  42. name:
  43. - color: white
  44. label:
  45. - color: white
  46. state:
  47. - color: white
  48. styles:
  49. grid:
  50. - grid-template-areas: |
  51. 'l buttons'
  52. 'n buttons'
  53. 's buttons'
  54. - grid-template-rows: min-content min-content min-content min-content
  55. card:
  56. - padding: 20px
  57. - pointer-events: none
  58. name:
  59. - justify-self: start
  60. - align-self: end
  61. - font-family: montserrat
  62. - font-weight: 500
  63. - z-index: 2
  64. label:
  65. - font-size: 5em
  66. - justify-self: start
  67. - align-self: start
  68. - font-weight: 700
  69. - font-family: montserrat
  70. - z-index: 2
  71. state:
  72. - justify-self: start
  73. - opacity: 0.8
  74. - font-size: 12px
  75. - font-family: montserrat
  76. - z-index: 2
  77. tap_action: none
  78. custom_fields:
  79. buttons:
  80. card:
  81. type: custom:button-card
  82. styles:
  83. grid:
  84. - grid-template-areas: |
  85. 'item_1'
  86. 'item_2'
  87. 'item_3'
  88. card:
  89. - padding: 10px
  90. - border-radius: 50px
  91. - background-color: var(--contrast-10)
  92. - z-index: 2
  93. custom_fields:
  94. item_1:
  95. card:
  96. type: custom:button-card
  97. icon: mdi:chevron-up
  98. styles:
  99. icon:
  100. - width: 25px
  101. card:
  102. - padding: 10px
  103. - border-radius: 500px
  104. - box-shadow: none
  105. - pointer-events: auto
  106. - background: none
  107. tap_action:
  108. action: call-service
  109. service: cover.open_cover
  110. target:
  111. entity_id: '[[[ return entity.entity_id ]]]'
  112. item_2:
  113. card:
  114. type: custom:button-card
  115. icon: mdi:stop
  116. styles:
  117. icon:
  118. - width: 25px
  119. card:
  120. - padding: 10px
  121. - border-radius: 500px
  122. - box-shadow: none
  123. - pointer-events: auto
  124. - background: none
  125. tap_action:
  126. action: call-service
  127. service: cover.stop_cover
  128. target:
  129. entity_id: '[[[ return entity.entity_id ]]]'
  130. item_3:
  131. card:
  132. type: custom:button-card
  133. icon: mdi:chevron-down
  134. styles:
  135. icon:
  136. - width: 25px
  137. card:
  138. - padding: 10px
  139. - border-radius: 500px
  140. - box-shadow: none
  141. - pointer-events: auto
  142. - background: none
  143. tap_action:
  144. action: call-service
  145. service: cover.close_cover
  146. target:
  147. entity_id: '[[[ return entity.entity_id ]]]'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement