Advertisement
Guest User

HA washer card

a guest
Feb 12th, 2025
1,223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 17.83 KB | Source Code | 0 0
  1. type: custom:vertical-stack-in-card
  2. cards:
  3.   - type: custom:mushroom-template-card
  4.     primary: |-
  5.       {% if is_state('binary_sensor.washer_wash_completed', 'on') and is_state('input_boolean.laundry_room_washer_finished', 'on') %} Washer Finished
  6.       {% elif is_state_attr('sensor.washer', 'error_state', 'on') %} Washer Error
  7.       {% elif is_state('sensor.washer', 'off') and is_state('binary_sensor.washer_tub_clean', 'on') %} Washer Tub Clean Needed
  8.       {% elif is_state('sensor.washer', 'off') and is_state('binary_sensor.laundry_needed', 'on') %} Washer Overdue
  9.       {% elif is_state_attr('sensor.washer', 'remote_start', 'on') and is_state('sensor.washer', 'on') and is_state_attr('sensor.washer', 'run_state', 'Standby') %} Washer
  10.       {% elif is_state_attr('sensor.washer', 'run_state', 'Paused') %} Washer Paused
  11.       {% elif is_state('sensor.washer', 'unavailable')  %} Washer Unavailable
  12.       {% else %} Washer
  13.       {% endif %}
  14.     multiline_secondary: true
  15.     secondary: |-
  16.       {% if is_state('binary_sensor.washer_wash_completed', 'on') and is_state('input_boolean.laundry_room_washer_finished', 'on') %}
  17.         Finished {{ 'just now' if (now().timestamp() - as_timestamp(states.binary_sensor.washer_wash_completed.last_changed)) < 30 else relative_time(states.binary_sensor.washer_wash_completed.last_changed) | replace('second', 'sec') | replace('seconds', 'secs') | replace('minute', 'min') | replace('minutes', 'mins') | replace('hour', 'hr') | replace('hours', 'hrs') + ' ago' }}
  18.  
  19.       {% elif is_state('binary_sensor.washer_error_state', 'on') %}
  20.         {{ state_attr('sensor.washer', 'error_message') }}
  21.  
  22.       {% elif is_state('binary_sensor.washer_tub_clean', 'on') %}
  23.         {{ state_attr('sensor.washer', 'tubclean_count') }} cycles since last clean
  24.  
  25.       {% elif is_state_attr('sensor.washer', 'remote_start', 'on') and is_state('sensor.washer', 'on') and is_state_attr('sensor.washer', 'run_state', 'Standby') %}
  26.         Remote start enabled · Tap to start
  27.  
  28.       {% elif is_state('sensor.washer', 'on') and is_state_attr('sensor.washer', 'run_state', 'Standby') %}
  29.         Standby
  30.  
  31.       {% elif is_state('sensor.washer', 'on') %}
  32.         {{ state_attr('sensor.washer', 'run_state') }} on {{ state_attr('sensor.washer', 'current_course') }} · {{ states('sensor.washer_time_remaining')  | replace(' hours','h') | replace(' hour','h') | replace ( ' minutes','m') | replace ( ' minute','m') }} left · {{ state_attr('sensor.washer', 'end_time') | as_timestamp(now()) | timestamp_custom('%-I:%M %p') }}
  33.  
  34.       {% elif is_state('sensor.washer', 'unavailable')  %}
  35.         Failed to connect to washer
  36.  
  37.       {% else %}
  38.         Off · Used {{ relative_time(states.input_datetime.washer_last_used.state | as_datetime) | replace('second','sec') | replace('seconds','secs') | replace('minute','min') | replace('minutes','mins') | replace('hour','hr') | replace('hours','hrs') }} ago
  39.       {% endif %}
  40.     entity: sensor.washer
  41.     layout: horizontal
  42.  
  43.     tap_action: &washer-popup
  44.       action: fire-dom-event
  45.       browser_mod:
  46.         service: browser_mod.popup
  47.         data:
  48.           dismissable: true
  49.           content:
  50.             type: vertical-stack
  51.             cards:
  52.               - type: custom:mushroom-title-card
  53.                 title: Washer
  54.  
  55.               - type: heading
  56.                 heading: Controls
  57.                 heading_style: subtitle
  58.                 icon: mdi:gesture-tap-button
  59.    
  60.               - square: false
  61.                 columns: 2
  62.                 type: grid
  63.                 cards:
  64.                  # CONTROL SENSORS
  65.                   - type: tile
  66.                     entity: button.washer_remote_start
  67.                     name: Remote Start
  68.                     icon: mdi:play
  69.                     color: green
  70.                     hide_state: true
  71.                     tap_action:
  72.                       action: perform-action
  73.                       perform_action: button.press
  74.                       target:
  75.                         entity_id: button.washer_remote_start
  76.                     visibility:
  77.                       - condition: state
  78.                         entity: button.washer_remote_start
  79.                         state_not: 'unavailable'
  80.  
  81.                   - type: tile
  82.                     entity: button.washer_pause
  83.                     name: Pause
  84.                     icon: mdi:pause
  85.                     color: amber
  86.                     hide_state: true
  87.                     tap_action:
  88.                       action: perform-action
  89.                       perform_action: button.press
  90.                       target:
  91.                         entity_id: button.washer_pause
  92.                     visibility:
  93.                       - condition: state
  94.                         entity: button.washer_pause
  95.                         state_not: 'unavailable'
  96.  
  97.                   - type: tile
  98.                     entity: select.washer_course_selection
  99.                     name: Course
  100.                     color: amber
  101.                     hide_state: true
  102.                     visibility:
  103.                       - condition: state
  104.                         entity: select.washer_course_selection
  105.                         state_not: unavailable
  106.                     layout_options:
  107.                       grid_columns: full
  108.                     features:
  109.                       - type: select-options
  110.                     tap_action:
  111.                       action: none
  112.                     icon_tap_action:
  113.                       action: none
  114.  
  115.                   - type: tile
  116.                     entity: input_boolean.laundry_room_washer_finished
  117.                     name: Unload Washer
  118.                     color: amber
  119.                     visibility:
  120.                       - condition: state
  121.                         entity: input_boolean.laundry_room_washer_finished
  122.                         state_not: 'off'
  123.  
  124.                   # STATS / DETAILS SENSORS....
  125.                   - type: tile
  126.                     entity: sensor.washer_current_course
  127.                     name: Current Course
  128.                     color: cyan
  129.                     visibility:
  130.                       - condition: state
  131.                         entity: sensor.washer_current_course
  132.                         state_not: '-'
  133.  
  134.                   # future - Change this to be in its own grid, so you can read the error message long... like copy from tablet last notification
  135.                   - type: tile
  136.                     entity: binary_sensor.washer_error_state
  137.                     name: Error State
  138.                     visibility:
  139.                       - condition: state
  140.                         entity: binary_sensor.washer_error_state
  141.                         state_not: 'off'
  142.                   - type: tile
  143.                     entity: sensor.washer_error_message
  144.                     name: Error Message
  145.                     visibility:
  146.                       - condition: state
  147.                         entity: sensor.washer_error_message
  148.                         state_not: '-'
  149.  
  150.                   - type: tile
  151.                     entity: sensor.washer_run_state
  152.                     name: Run State
  153.                     color: cyan
  154.                     visibility:
  155.                       - condition: state
  156.                         entity: sensor.washer_run_state
  157.                         state_not: '-'
  158.  
  159.                   - type: tile
  160.                     entity: sensor.washer_spin_speed
  161.                     name: Spin Speed
  162.                     color: cyan
  163.  
  164.                   - type: tile
  165.                     entity: sensor.washer_water_temp
  166.                     name: Water Temp
  167.                     color: cyan
  168.  
  169.               - type: tile
  170.                 entity: input_datetime.washer_last_used
  171.                 name: Last Used
  172.                 color: purple
  173.                 tap_action:
  174.                   action: none
  175.                 hold_action:
  176.                   action: more-info
  177.  
  178.               - type: heading
  179.                 heading: Maintenance
  180.                 icon: mdi:account-wrench
  181.                 heading_style: subtitle
  182.  
  183.               - type: tile
  184.                 entity: input_datetime.washer_last_maintenance
  185.                 name: Last Maintenance
  186.                 color: purple
  187.                 tap_action:
  188.                   action: none
  189.                 hold_action:
  190.                   action: more-info
  191.  
  192.               - square: false
  193.                 columns: 2
  194.                 type: grid
  195.                 cards:
  196.                   - type: custom:mushroom-template-card
  197.                     primary: Plumber
  198.                     secondary: (XXX) XXX-XXXX
  199.                     icon: mdi:phone
  200.                     icon_color: "#0FFF50"
  201.                     tap_action:
  202.                       action: url
  203.                       url_path: tel://XXX-XXX-XXXX
  204.  
  205.                   - type: custom:mushroom-template-card
  206.                     primary: LG Support
  207.                     secondary: 1-800-243-0000
  208.                     icon: mdi:phone
  209.                     icon_color: "#0FFF50"
  210.                     tap_action:
  211.                       action: url
  212.                       url_path: tel://1-800-243-0000
  213.  
  214.                   - type: custom:mushroom-template-card
  215.                     primary: Support Center
  216.                     secondary: LG.com
  217.                     icon: mdi:note-multiple
  218.                     icon_color: pink
  219.                     tap_action:
  220.                       action: url
  221.                       url_path: https://www.lg.com/us/support/product/lg-WM4000HWA.ABWEUUS
  222.                     hold_action:
  223.                       action: url
  224.                       url_path: https://www.lg.com/us/support/product/lg-WM4000HWA.ABWEUUS
  225.                     double_tap_action:
  226.                       action: url
  227.                       url_path: https://www.lg.com/us/support/product/lg-WM4000HWA.ABWEUUS
  228.  
  229.                   - type: custom:mushroom-template-card
  230.                     primary: "Serial"
  231.                     secondary: "XXXXXX"
  232.                     icon: mdi:barcode
  233.                     icon_color: "#85C1E9"
  234.                     tap_action:
  235.                       action: none
  236.                     hold_action:
  237.                       action: none
  238.  
  239.                   - type: custom:mushroom-template-card
  240.                     primary: "Model"
  241.                     secondary: "WM4000HWA"
  242.                     icon: mdi:information-variant-circle-outline
  243.                     icon_color: "#85C1E9"
  244.                     tap_action:
  245.                       action: none
  246.                     hold_action:
  247.                       action: none
  248.  
  249.                   - type: custom:mushroom-template-card
  250.                     primary: "Purchased"
  251.                     secondary: "April 11, 2022"
  252.                     icon: mdi:calendar-blank
  253.                     icon_color: "#85C1E9"
  254.                     tap_action:
  255.                       action: none
  256.                     hold_action:
  257.                       action: none
  258.  
  259.  
  260.           card_mod:
  261.             style: |
  262.              ha-dialog {
  263.                 --dialog-backdrop-filter: blur(0.8em);
  264.                 background: rgba(255, 255, 255, 0.9);
  265.                 --mdc-dialog-min-width: 90vw !important;
  266.                 --mdc-dialog-min-height: fit-content !important;
  267.                 --mdc-dialog-max-width: var(--mdc-dialog-min-width) !important;
  268.                 --mdc-dialog-max-height:  var(--mdc-dialog-min-height) !important;
  269.                 --ha-dialog-border-radius: var(--ha-card-border-radius) !important;
  270.                 --vertical-align-dialog: center !important;
  271.                 --header-height: 5vh !important;
  272.                 --footer-height: var(--header-height) !important;
  273.                 --padding-y: 8px !important;
  274.                 -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
  275.               }
  276.               .content {
  277.                 height: fit-content !important;
  278.                 max-height: 90vh !important
  279.                 pointer-events: unset !important;
  280.                 padding: 0 !important;
  281.               }
  282.               .container {
  283.                 padding: 5 !important;
  284.               }
  285.  
  286.     icon: |-
  287.       {% if is_state('binary_sensor.washer_wash_completed', 'on') and is_state('input_boolean.laundry_room_washer_finished', 'on') %} mdi:check-circle
  288.       {% elif is_state_attr('sensor.washer', 'error_state', 'on') %} mdi:washer-alert
  289.       {% elif is_state('sensor.washer', 'off') and is_state('binary_sensor.laundry_needed', 'on') %} mdi:washing-machine-alert
  290.       {% elif is_state('sensor.washer', 'off') and is_state('binary_sensor.washer_tub_clean', 'on') %} mdi:washing-machine-alert
  291.       {% elif is_state('sensor.washer', 'unavailable')  %} mdi:washing-machine-alert
  292.       {% elif is_state('sensor.washer', 'off') %} mdi:washing-machine-off
  293.       {% else %} mdi:washing-machine
  294.       {% endif %}
  295.     icon_color: |-
  296.       {% if is_state('binary_sensor.washer_wash_completed', 'on') and is_state('input_boolean.laundry_room_washer_finished', 'on') %} green
  297.       {% elif is_state('binary_sensor.washer_error_state', 'on') %} red
  298.       {% elif is_state('sensor.washer', 'unavailable')  %} disabled
  299.       {% elif is_state('sensor.washer', 'off') and is_state('binary_sensor.laundry_needed', 'on') %} grey
  300.       {% elif is_state('sensor.washer', 'off') and is_state('binary_sensor.washer_tub_clean', 'on') %} grey
  301.       {% elif is_state('sensor.washer', 'off') %} grey
  302.       {% elif is_state_attr('sensor.washer', 'remote_start', 'on') and is_state('sensor.washer', 'on') and is_state_attr('sensor.washer', 'run_state', 'Standby') %} grey
  303.       {% else %} cyan
  304.       {% endif %}
  305.     badge_icon: |-
  306.       {% if is_state('binary_sensor.washer_error_state', 'on') or is_state('binary_sensor.laundry_needed', 'on') or is_state('binary_sensor.washer_tub_clean', 'on') %} mdi:exclamation-thick
  307.       {% elif is_state_attr('sensor.washer', 'run_state', 'Paused') %} mdi:pause
  308.       {% elif is_state('sensor.washer', 'unavailable')  %} mdi:exclamation-thick
  309.       {% elif is_state_attr('sensor.washer', 'remote_start', 'on') and is_state('sensor.washer', 'on') and is_state_attr('sensor.washer', 'run_state', 'Standby') %} mdi:play-speed
  310.       {% else %} none
  311.       {% endif %}
  312.     badge_color: |-
  313.       {% if is_state('binary_sensor.washer_error_state', 'on') or is_state('binary_sensor.laundry_needed', 'on') or is_state('binary_sensor.washer_tub_clean', 'on') %} orange
  314.       {% elif is_state_attr('sensor.washer', 'run_state', 'Paused') %} orange
  315.       {% elif is_state('sensor.washer', 'unavailable')  %} orange
  316.       {% elif is_state_attr('sensor.washer', 'remote_start', 'on') and is_state('sensor.washer', 'on') and is_state_attr('sensor.washer', 'run_state', 'Standby') %} cyan
  317.       {% else %} none
  318.       {% endif %}
  319.  
  320.     # Below media query makes cards larger on tablet so I can use this one card for both dashboards, work in progress, tweak more...
  321.     card_mod:
  322.       style: |
  323.         @media screen and (min-width: 768px) and (max-width: 1300px) {
  324.           ha-card {
  325.             --icon-size: 150px;
  326.             --card-primary-font-size: 40px;
  327.             --card-primary-font-weight: bold;
  328.             --card-primary-line-height: 40px;
  329.             --card-secondary-font-size: 20px;
  330.             --card-secondary-line-height: 50px;
  331.             margin-top: 8px;
  332.             margin-bottom: 1.5rem;
  333.           }
  334.         }
  335.         ha-state-icon {
  336.           {% if is_state('sensor.washer', 'on') and is_state_attr('sensor.washer', 'run_completed', 'off') and state_attr('sensor.washer', 'run_state') not in ['Standby', 'Paused'] %}
  337.           animation: shake 400ms ease-in-out infinite, drum 2s ease infinite;
  338.           transform-origin: 50% 110%;
  339.           {% elif is_state('binary_sensor.washer_error_state', 'on') %}
  340.           animation: shake 400ms ease-in-out infinite, drum 2s ease infinite;
  341.           transform-origin: 50% 110%;
  342.           {% else  %}
  343.           {% endif %}
  344.             }
  345.           @keyframes shake {
  346.             0%, 100% { transform: translate(0, 0) rotate(0); }
  347.             20%  { transform: translate(0.4px, -0.4px) rotate(-4deg); }
  348.             40%  { transform: translate(-0.4px, 0.4px) rotate(4deg); }
  349.             60%  { transform: translate(0.4px, 0.4px) rotate(-4deg); }
  350.             80%  { transform: translate(-0.4px, -0.4px) rotate(4deg); }
  351.           }
  352.           @keyframes drum {
  353.             50%  { clip-path: polygon(0 0, 0 100%, 35% 100%, 34% 68%, 60% 41%, 71% 56%, 65% 74%, 47% 79%, 32% 69%, 35% 100%, 100% 100%, 100% 0); }
  354.           }
  355.  
  356.  
  357.   # 🔶 FUTURE: Tablet styling needs to change bar_height from 5px to 20px
  358.   # FUTURE: I might want to remove the text_width to 0px so it doesn't show timer duration, as it's already shown on washer card above.. duplicate info?
  359.   - type: custom:timer-bar-card
  360.     entities:
  361.      - sensor.washer
  362.     sync_issues: ignore
  363.     compressed: true
  364.     bar_width: 60%
  365.     bar_height: 5px
  366.     bar_radius: 5px
  367.     text_width: 0px #60px
  368.     layout: full_row
  369.     bar_foreground: '#00bcd4'
  370.     bar_background: '#163c40'
  371.     icon: mdi:washing-machine
  372.     tap_action: *washer-popup
  373.     visibility:
  374.       - entity: sensor.washer
  375.         state: 'on'
  376.       - entity: sensor.washer_run_state
  377.         state_not: 'Standby'
  378.       - entity: sensor.washer_run_state
  379.         state_not: 'Paused'
  380.       - entity: binary_sensor.washer_wash_completed
  381.         state_not: 'on'
  382.     # To fix mobile display, change to -32px for margin-bottom?
  383.     card_mod:
  384.       style: |
  385.        ha-card {
  386.           border: none;
  387.           background: none;
  388.           background-color: transparent;
  389.           margin-top: -32px;
  390.           margin-left: 0px;
  391.           margin-right: 0px;
  392.           margin-bottom: -16px; /* Default for non-tablet */
  393.         }
  394.         @media screen and (min-width: 768px) and (max-width: 1300px) {
  395.           ha-card {
  396.             margin-bottom: unset; /* Removes margin-bottom for tablets */
  397.           }
  398.         }
  399.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement