Advertisement
Guest User

Untitled

a guest
Mar 31st, 2025
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.36 KB | None | 0 0
  1. type: custom:bubble-card
  2. entity: sensor.014090542819006427_bsh_common_status_operationstate
  3. name: Dishwasher
  4. show_label: true
  5. tap_action:
  6. action: none
  7. hold_action:
  8. action: none
  9. double_tap_action:
  10. action: none
  11. icon: mdi:dishwasher
  12. state:
  13. - value: Ready
  14. label: Idle
  15. styles:
  16. custom_fields:
  17. bar:
  18. - display: none
  19. stat1:
  20. - display: none
  21. stat2:
  22. - visibility: hidden
  23. stat3:
  24. - visibility: hidden
  25. - value: "Off"
  26. label: "Off"
  27. styles:
  28. custom_fields:
  29. bar:
  30. - display: none
  31. stat1:
  32. - display: none
  33. stat2:
  34. - visibility: hidden
  35. stat3:
  36. - visibility: hidden
  37. styles:
  38. card:
  39. - padding: 20px
  40. - height: 180px
  41. - font-family:'Montserrat', sans-serif
  42. - font-size: 16px
  43. grid:
  44. - grid-template-areas: "\"i program\" \"n stat2\" \"bar bar\" \"stat1 stat3\""
  45. - grid-template-columns: 1fr 1fr
  46. - grid-template-rows: 70px min-content 40px min-content
  47. name:
  48. - justify-self: start
  49. - font-size: 16px
  50. - font-weight: 500
  51. label:
  52. - justify-self: start
  53. - font-size: 16px
  54. - font-weight: 500
  55. icon:
  56. - width: 36px
  57. img_cell:
  58. - justify-self: start
  59. - align-self: start
  60. - width: 36px
  61. - height: 36px
  62. custom_fields:
  63. program:
  64. - justify-self: end
  65. - align-self: end
  66. - padding-bottom: 6px
  67. - font-size: 16px
  68. - font-weight: 500
  69. - visibility: >
  70. [[[ return
  71. states['switch.014090542819006427_bsh_common_setting_powerstate'].state
  72. !== 'off' ? 'visible' : 'hidden'; ]]]
  73. stat1:
  74. - justify-self: start
  75. - font-size: 12px
  76. - opacity: 0.7
  77. stat2:
  78. - justify-self: end
  79. - font-size: 16px
  80. - font-weight: 500
  81. - visibility: >
  82. [[[ return
  83. states['switch.014090542819006427_bsh_common_setting_powerstate'].state
  84. !== 'off' ? 'visible' : 'hidden'; ]]]
  85. stat3:
  86. - justify-self: end
  87. - font-size: 12px
  88. - opacity: 0.7
  89. - visibility: |
  90. [[[
  91. var powerState = states['switch.014090542819006427_bsh_common_setting_powerstate'].state;
  92. if (powerState === 'off') {
  93. return 'visible'; // Keep stat3 visible when power is off
  94. }
  95. var progress = states['sensor.014090542819006427_bsh_common_option_programprogress'].state;
  96. if (progress === 'unavailable' || progress === 'unknown' || progress === '') {
  97. return 'visible'; // Show stat3 as "Ready" when power is on and progress is empty
  98. }
  99. return 'visible'; // Show progress percentage otherwise
  100. ]]]
  101. bar:
  102. - justify-self: start
  103. - width: 100%
  104. - border-radius: 6px
  105. - background: var(--slider-color)
  106. - height: 16px
  107. custom_fields:
  108. bar: |
  109. [[[
  110. var state = parseFloat(states['sensor.014090542819006427_bsh_common_option_programprogress'].state);
  111. if (isNaN(state)) { state = 0; } // Ensure it defaults to 0 if the state isn't a valid number
  112. return `<div style="background: var(--slider-color); border-radius: 6px; width: 100%; height: 16px;">
  113. <div style="background: var(--color-blue); border-radius: 6px; height: 16px; width: ${state}%;"></div>
  114. </div>`;
  115. ]]]
  116. program: |
  117. [[[
  118. var powerState = states['switch.d014090542819006427_bsh_common_setting_powerstate'].state;
  119. var program = states['select.014090542819006427_active_program'].state;
  120. var programLabels = {
  121. "dishcare_dishwasher_program_eco_50": "Eco",
  122. "dishcare_dishwasher_program_auto_2": "Auto",
  123. "dishcare_dishwasher_program_intensiv_70": "Heavy",
  124. "dishcare_dishwasher_program_quick_65": "Express 65°",
  125. "dishcare_dishwasher_program_night_wash": "Silent",
  126. "dishcare_dishwasher_program_machine_care": "Machine Care",
  127. "dishcare_dishwasher_program_pre_rinse": "Pre-rinse"
  128. };
  129.  
  130. // If the dishwasher is on but no program is running, show "Idle"
  131. if (powerState !== 'off' && (!program || program === 'unavailable' || program === 'unknown')) {
  132. return "Idle";
  133. }
  134.  
  135. return programLabels[program] || program;
  136. ]]]
  137. stat1: |
  138. [[[
  139. // Icons for rinse aid and salt status
  140. var rinseAidState = states['sensor.014090542819006427_rinse_aid_nearly_empty'].state;
  141. var saltState = states['sensor.014090542819006427_salt_nearly_empty'].state;
  142.  
  143. // Set the icon color based on state
  144. var rinseAidColor = rinseAidState === 'present' ? 'red' : 'gray';
  145. var saltColor = saltState === 'present' ? 'red' : 'gray';
  146.  
  147. return `
  148. <span style="color: ${rinseAidColor}; margin-right: 4px;">
  149. <ha-icon icon="fapro:sparkles" style="width: 16px; height: 16px;"></ha-icon>
  150. </span>
  151. <span style="color: ${saltColor};">
  152. <ha-icon icon="fapro:salt-shaker" style="width: 16px; height: 16px;"></ha-icon>
  153. </span>
  154. `;
  155. ]]]
  156. stat2: |
  157. [[[
  158. var finishTime = states['sensor.014090542819006427_bsh_common_option_remainingprogramtime'].state;
  159.  
  160. // If no program is running or finish time is unavailable, return an empty string
  161. if (!finishTime || finishTime === 'unavailable' || finishTime === 'unknown') {
  162. return "";
  163. }
  164.  
  165. var time = new Date(finishTime);
  166. var hours = time.getHours();
  167. var minutes = time.getMinutes();
  168. return 'Finished at ' + (hours < 10 ? '0' : '') + hours + ':' + (minutes < 10 ? '0' : '') + minutes;
  169. ]]]
  170. stat3: |
  171. [[[
  172. var powerState = states['switch.014090542819006427_bsh_common_setting_powerstate'].state;
  173. if (powerState === 'off') {
  174. return "Off"; // Display "Off" when the power is off
  175. }
  176.  
  177. var progress = states['sensor.014090542819006427_bsh_common_option_programprogress'] ? states['sensor.dishwasher_program_progress'].state : 'unknown';
  178.  
  179. // If the progress is unavailable or empty, show "Ready"
  180. if (progress === 'unavailable' || progress === 'unknown' || progress === '') {
  181. return "Ready"; // Default to "Ready" when the dishwasher is in idle state
  182. }
  183.  
  184. // Otherwise, return the progress percentage
  185. return progress + '%';
  186. ]]]
  187.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement