Advertisement
hiddevanbrussel

Home Assistant | Dishwashercard

Feb 27th, 2025 (edited)
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.58 KB | None | 0 0
  1. type: custom:button-card
  2. icon: cil:dishwasher-silverware
  3. name: Vaatwasser
  4. entity: input_number.vaatwastabletten
  5. show_state: false
  6. tap_action:
  7. action: fire-dom-event
  8. browser_mod:
  9. service: browser_mod.popup
  10. data:
  11. title: Vaatwastabletten
  12. content:
  13. type: custom:mushroom-number-card
  14. entity: input_number.vaatwastabletten
  15. display_mode: buttons
  16. fill_container: false
  17. layout: horizontal
  18. icon_color: deep-purple
  19. hold_action:
  20. action: none
  21. tap_action:
  22. action: none
  23. double_tap_action:
  24. action: none
  25. custom_fields:
  26. background: |
  27. <div class="bg"></div>
  28. bar: |
  29. [[[
  30. var state = parseFloat(states['sensor.vaatwasser_program_progress'].state);
  31. if (isNaN(state)) { state = 0; } // Ensure it defaults to 0 if the state isn't a valid number
  32. return `<div style="background: var(--slider-color); border-radius: 6px; width: 100%; height: 16px;">
  33. <div style="background: var(--color-green); border-radius: 6px; height: 16px; width: ${state}%;"></div>
  34. </div>`;
  35. ]]]
  36. tabletten: |
  37. [[[
  38. return '<ha-icon icon="lucide:tablets" style="width: 16px; height: 16px; margin-right: 5px;"></ha-icon>' +
  39. Math.floor(states['input_number.vaatwastabletten'].state);
  40. ]]]
  41. percentage: |
  42. [[[
  43. const powerState = states['switch.vaatwasser_power'].state;
  44. const progress = states['sensor.vaatwasser_program_progress'].state;
  45.  
  46. // Controleer of de vaatwasser uit staat
  47. if (powerState === 'off') {
  48. return " ";
  49. }
  50.  
  51. // Controleer of de voortgang een geldig getal is
  52. if (isNaN(progress) || progress === 'unavailable' || progress === 'unknown' || progress === '') {
  53. return "Gereed"; // Default naar "Gereed" als de vaatwasser idle is
  54. }
  55.  
  56. // Toon het voortgangspercentage
  57. return `${progress}%`.trim();
  58. ]]]
  59. label: |
  60. [[[
  61. const program = states['select.vaatwasser_active_program'].state;
  62. const finishTime = states['sensor.vaatwasser_remaining_program_time'].state;
  63.  
  64. const programLabels = {
  65. "dishcare_dishwasher_program_eco_50": "Eco",
  66. "dishcare_dishwasher_program_auto_2": "Auto",
  67. "dishcare_dishwasher_program_intensiv_70": "Heavy",
  68. "dishcare_dishwasher_program_quick_65": "Express 65°",
  69. "dishcare_dishwasher_program_night_wash": "Silent",
  70. "dishcare_dishwasher_program_machine_care": "Machine Care",
  71. "dishcare_dishwasher_program_pre_rinse": "Pre-rinse"
  72. };
  73.  
  74. // Controleer of een programma actief is
  75. let programStatus = programLabels[program] || (program && program !== 'unavailable' && program !== 'unknown' ? program : "Niet actief");
  76.  
  77. // Controleer of er een eindtijd beschikbaar is
  78. let timeStatus = "";
  79. if (finishTime && finishTime !== 'unavailable' && finishTime !== 'unknown') {
  80. const time = new Date(finishTime);
  81. const hours = time.getHours();
  82. const minutes = time.getMinutes();
  83. timeStatus = 'Klaar om ' + (hours < 10 ? '0' : '') + hours + ':' + (minutes < 10 ? '0' : '') + minutes;
  84. }
  85.  
  86. // Combineer de waarden
  87. return timeStatus ? programStatus + ' • ' + timeStatus : programStatus;
  88. ]]]
  89. show_label: true
  90. styles:
  91. custom_fields:
  92. tabletten:
  93. - display: flex
  94. - bottom: 20px
  95. - font-size: 12px
  96. - color: "#FFF"
  97. - position: absolute
  98. - background-color: "#16404D"
  99. - border-radius: 50px
  100. - padding: 5px 8px
  101. background:
  102. - position: absolute
  103. - top: 0
  104. - right: 100px
  105. - width: 100%
  106. - height: 100%
  107. - background-image: >-
  108. url("https://www.techadvisor.com/wp-content/uploads/2022/06/siemens_built-in-dishwashers_homeconnect.jpg?quality=50&strip=all&w=1024")
  109. - background-size: cover
  110. - background-position: "-10% center"
  111. - filter: brightness(100%)
  112. - mask-image: linear-gradient(to right, rgba(0,0,0,0.8), rgba(0,0,0,0))
  113. - "-webkit-mask-image": linear-gradient(to right, rgba(0,0,0,0.8), rgba(0,0,0,0))
  114. - z-index: -1
  115. bar:
  116. - justify-self: end
  117. - width: 100%
  118. - border-radius: 0px
  119. - background: var(--slider-color)
  120. - height: 10px
  121. - position: absolute
  122. - left: 0px
  123. - bottom: 0px
  124. percentage:
  125. - bottom: 25px
  126. - position: absolute
  127. - right: 20px
  128. - font-weight: 300
  129. name:
  130. - justify-self: end
  131. - font-size: 18px
  132. - font-weight: 500
  133. - padding: "-5px 0px"
  134. - margin-top: "-5px"
  135. state:
  136. - min-height: 50px
  137. - justify-self: end
  138. - font-size: 12px
  139. - opacity: "0.7"
  140. - margin-right: 0px
  141. - margin-top: "-10px"
  142. card:
  143. - padding: 20px 20px 10px 20px
  144. - height: 130px
  145. - background: var(--ha-cards-background)
  146. - backdrop-filter: blur(10px)
  147. - box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1)
  148. grid:
  149. - grid-template-columns: 1fr min-content
  150. - grid-template-rows: min-content min-content 1fr
  151. img_cell:
  152. - justify-content: start
  153. - position: absolute
  154. - height: 100px
  155. - width: 100px
  156. - left: 0px
  157. - bottom: 0px
  158. - margin: 0 0 -10px -15px
  159. - border-radius: 500px
  160. icon:
  161. - width: 40px
  162. - margin-left: 30px
  163. - color: white
  164. - opacity: "0.5"
  165. - display: none
  166. label:
  167. - justify-self: end
  168. - font-size: 13px
  169. - font-weight: 400
  170. - opacity: "0.7"
  171. - padding: 2px 0px
  172. - top: 35px
  173. - position: absolute
  174.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement