Advertisement
fablav

vacuum_card_stanze

Apr 26th, 2024
636
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 29.04 KB | Software | 0 0
  1. type: custom:local-conditional-card
  2. default: show
  3. card:
  4.   type: custom:mod-card
  5.   card_mod:
  6.     style: |
  7.      ha-card {
  8.         height: 630px;
  9.         border: solid 5px var(--sidebar);
  10.         box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.36);
  11.   card:
  12.     type: vertical-stack
  13.     cards:
  14.       - type: custom:button-card
  15.         entity: vacuum.vacky
  16.         show_name: false
  17.         show_entity_picture: true
  18.         entity_picture: /local/ic/vacuum.svg
  19.         custom_fields:
  20.           button:
  21.             card:
  22.               type: custom:mushroom-chips-card
  23.               chips:
  24.                 - type: template
  25.                   tap_action:
  26.                     action: fire-dom-event
  27.                     local_conditional_card:
  28.                       action: set
  29.                       ids:
  30.                         - vacuum: hide
  31.                         - vacuum_map: show
  32.                   icon: mdi:map-marker
  33.                   icon_color: white
  34.                   primary: Marker
  35.               card_mod:
  36.                 style:
  37.                   mushroom-template-chip:nth-child(1)$:
  38.                     mushroom-chip$: |
  39.                      ha-card {
  40.                         padding: 5px !important;
  41.                         border-radius: 100px !important;
  42.                         --chip-background: rgba(223,130,108, 1) !important;
  43.                       }
  44.                       ha-card:active {
  45.                         transform: translateY(1.5px);
  46.                         transition: 0s;
  47.                         box-shadow: 0 0.5px 2px 0 rgba(0, 0, 0, 0.16);
  48.                       }
  49.                     .: |
  50.                      ha-state-icon {
  51.                         animation: boing 3s ease infinite;
  52.                         transform-origin: 50% 90%;
  53.                        
  54.                       }
  55.                       @keyframes boing {
  56.                         0% { transform: scale3d(1, 1, 1); }
  57.                         7% { transform: translateY(-4px) scale3d(0.75, 1.25, 1); }
  58.                         10% { transform: scale3d(1.25, 0.75, 1); }
  59.                         12% { transform: translateY(-2px) scale3d(0.85, 1.15, 1); }
  60.                         16% { transform: scale3d(1.05, 0.95, 1); }
  61.                         19% { transform: scale3d(0.95, 1.05, 1); }
  62.                         25% { transform: scale3d(1, 1, 1); }
  63.                       }
  64.         styles:
  65.           custom_fields:
  66.             button:
  67.               - position: absolute
  68.               - top: 20px
  69.               - right: 30px
  70.               - background: none
  71.             styles:
  72.               icon:
  73.                 - height: 10px
  74.           card:
  75.             - border-radius: 20px
  76.             - height: 240px
  77.             - margin-top: '-1px'
  78.             - margin-right: 1px
  79.           icon:
  80.             - height: 140px
  81.             - width: 140px
  82.             - margin-top: '-50px'
  83.             - filter: brightness(0.9)
  84.         state:
  85.           - operator: default
  86.             styles:
  87.               icon:
  88.                 - animation: cleaning 5s linear infinite
  89.               card:
  90.                 - background: var(--sidebar)
  91.           - value: returning
  92.             styles:
  93.               icon:
  94.                 - animation: returning 2s linear infinite
  95.               card:
  96.                 - background: var(--sidebar)
  97.           - value: paused
  98.             styles:
  99.               icon:
  100.                 - opacity: 100%
  101.               card:
  102.                 - background: var(--contrast2)
  103.           - value: docked
  104.             styles:
  105.               icon:
  106.                 - opacity: 50%
  107.               card:
  108.                 - background: transparent
  109.         extra_styles: |
  110.          @keyframes cleaning {
  111.             0% {
  112.               transform: rotate(0) translate(0);
  113.             }
  114.             5% {
  115.               transform: rotate(0) translate(0, -10px);
  116.             }
  117.             10% {
  118.               transform: rotate(0) translate(0, 5px);
  119.             }
  120.             15% {
  121.               transform: rotate(0) translate(0);
  122.             }
  123.             /* Turn left */
  124.             20% {
  125.               transform: rotate(30deg) translate(0);
  126.             }
  127.             25% {
  128.               transform: rotate(30deg) translate(0, -10px);
  129.             }
  130.             30% {
  131.               transform: rotate(30deg) translate(0, 5px);
  132.             }
  133.             35% {
  134.               transform: rotate(30deg) translate(0);
  135.             }
  136.             40% {
  137.               transform: rotate(0) translate(0);
  138.             }
  139.             /* Turn right */
  140.             45% {
  141.               transform: rotate(-30deg) translate(0);
  142.             }
  143.             50% {
  144.               transform: rotate(-30deg) translate(0, -10px);
  145.             }
  146.             55% {
  147.               transform: rotate(-30deg) translate(0, 5px);
  148.             }
  149.             60% {
  150.               transform: rotate(-30deg) translate(0);
  151.             }
  152.             70% {
  153.               transform: rotate(0deg) translate(0);
  154.             }
  155.             /* Staying still */
  156.             100% {
  157.               transform: rotate(0deg);
  158.             }
  159.           }  
  160.           @keyframes returning {
  161.             0% {
  162.               transform: rotate(0);
  163.             }
  164.             25% {
  165.               transform: rotate(10deg);
  166.             }
  167.             50% {
  168.               transform: rotate(0);
  169.             }
  170.             75% {
  171.               transform: rotate(-10deg);
  172.             }
  173.             100% {
  174.               transform: rotate(0);
  175.             }
  176.           }
  177.       - type: custom:mod-card
  178.         card:
  179.           type: custom:swipe-card
  180.           start_card: 1
  181.           reset_after: 15
  182.           parameters:
  183.             pagination:
  184.               type: bullets
  185.               clickable: true
  186.             effect: cube
  187.             grabCursor: true
  188.             cubeEffect:
  189.               shadow: false
  190.             loop: false
  191.           cards:
  192.             - square: false
  193.               columns: 1
  194.               type: grid
  195.               card_mod:
  196.                 class: nav_1
  197.               cards:
  198.                 - type: vertical-stack
  199.                   cards:
  200.                     - square: false
  201.                       type: horizontal-stack
  202.                       cards:
  203.                         - type: custom:button-card
  204.                           color_type: blank-card
  205.                         - type: custom:button-card
  206.                           entity: vacuum.vacky
  207.                           show_name: false
  208.                           tap_action:
  209.                             action: call-service
  210.                             service: vacuum.set_fan_speed
  211.                             target:
  212.                               entity_id: vacuum.vacky
  213.                             data:
  214.                               fan_speed: Silent
  215.                           styles:
  216.                             icon:
  217.                               - width: 15px
  218.                             card:
  219.                               - height: 40px
  220.                               - width: 40px
  221.                           state:
  222.                             - operator: template
  223.                               value: >
  224.                                [[[
  225.  
  226.                                 return
  227.                                 (states['vacuum.vacky'].attributes.fan_speed ===
  228.                                 'Silent' ) && states['vacuum.vacky'].state ===
  229.                                 'cleaning'
  230.  
  231.                                 ]]]
  232.                               icon: mdi:fan
  233.                               color: black
  234.                               styles:
  235.                                 icon:
  236.                                   - animation:
  237.                                      - rotating 2s linear infinite
  238.                                 card:
  239.                                   - background-color: '#FFC700'
  240.                             - operator: template
  241.                               value: >
  242.                                [[[
  243.  
  244.                                 return
  245.                                 (states['vacuum.vacky'].attributes.fan_speed ===
  246.                                 'Silent' ) && states['vacuum.vacky'].state ===
  247.                                 'docked'
  248.  
  249.                                 ]]]
  250.                               icon: mdi:fan
  251.                               color: var(--contrast3)
  252.                               styles:
  253.                                 name:
  254.                                   - color: var(--contrast3)
  255.                                 card:
  256.                                   - background-color: '#FFC700'
  257.                             - operator: default
  258.                               icon: mdi:fan
  259.                               styles:
  260.                                 name:
  261.                                   - color: var(--contrast9)
  262.                                 card:
  263.                                   - background-color: '#A5D09B'
  264.                         - type: custom:button-card
  265.                           entity: vacuum.vacky
  266.                           show_name: false
  267.                           tap_action:
  268.                             action: call-service
  269.                             service: vacuum.set_fan_speed
  270.                             target:
  271.                               entity_id: vacuum.vacky
  272.                             data:
  273.                               fan_speed: Standard
  274.                           styles:
  275.                             icon:
  276.                               - width: 20px
  277.                             card:
  278.                               - height: 40px
  279.                               - width: 40px
  280.                           state:
  281.                             - operator: template
  282.                               value: >
  283.                                [[[
  284.  
  285.                                 return
  286.                                 (states['vacuum.vacky'].attributes.fan_speed ===
  287.                                 'Standard' ) && states['vacuum.vacky'].state ===
  288.                                 'cleaning'
  289.  
  290.                                 ]]]
  291.                               icon: mdi:fan
  292.                               color: black
  293.                               styles:
  294.                                 name:
  295.                                   - color: black
  296.                                 icon:
  297.                                   - animation:
  298.                                      - rotating 1.5s linear infinite
  299.                                 card:
  300.                                   - background-color: '#FFC700'
  301.                             - operator: default
  302.                               icon: mdi:fan
  303.                               styles:
  304.                                 name:
  305.                                   - color: var(--contrast9)
  306.                                 card:
  307.                                   - background-color: '#A5D09B'
  308.                             - operator: template
  309.                               value: >
  310.                                [[[
  311.  
  312.                                 return
  313.                                 (states['vacuum.vacky'].attributes.fan_speed ===
  314.                                 'Standard' ) && states['vacuum.vacky'].state ===
  315.                                 'docked'
  316.  
  317.                                 ]]]
  318.                               icon: mdi:fan
  319.                               color: var(--contrast3)
  320.                               styles:
  321.                                 name:
  322.                                   - color: var(--contrast3)
  323.                                 card:
  324.                                   - background-color: '#FFC700'
  325.                         - type: custom:button-card
  326.                           entity: vacuum.vacky
  327.                           show_name: false
  328.                           tap_action:
  329.                             action: call-service
  330.                             service: vacuum.set_fan_speed
  331.                             target:
  332.                               entity_id: vacuum.vacky
  333.                             data:
  334.                               fan_speed: Medium
  335.                           styles:
  336.                             icon:
  337.                               - width: 25px
  338.                             card:
  339.                               - height: 40px
  340.                               - width: 40px
  341.                           state:
  342.                             - operator: template
  343.                               value: >
  344.                                [[[
  345.  
  346.                                 return
  347.                                 (states['vacuum.vacky'].attributes.fan_speed ===
  348.                                 'Medium' ) && states['vacuum.vacky'].state ===
  349.                                 'cleaning'
  350.  
  351.                                 ]]]
  352.                               icon: mdi:fan
  353.                               color: black
  354.                               styles:
  355.                                 name:
  356.                                   - color: black
  357.                                 icon:
  358.                                   - animation:
  359.                                      - rotating 1.0s linear infinite
  360.                                 card:
  361.                                   - background-color: '#FFC700'
  362.                             - operator: template
  363.                               value: >
  364.                                [[[
  365.  
  366.                                 return
  367.                                 (states['vacuum.vacky'].attributes.fan_speed ===
  368.                                 'Medium' ) && states['vacuum.vacky'].state ===
  369.                                 'docked'
  370.  
  371.                                 ]]]
  372.                               icon: mdi:fan
  373.                               color: var(--contrast3)
  374.                               styles:
  375.                                 name:
  376.                                   - color: var(--contrast3)
  377.                                 card:
  378.                                   - background-color: '#FFC700'
  379.                             - operator: default
  380.                               icon: mdi:fan
  381.                               styles:
  382.                                 name:
  383.                                   - color: var(--contrast9)
  384.                                 card:
  385.                                   - background-color: '#A5D09B'
  386.                         - type: custom:button-card
  387.                           entity: vacuum.vacky
  388.                           show_name: false
  389.                           tap_action:
  390.                             action: call-service
  391.                             service: vacuum.set_fan_speed
  392.                             target:
  393.                               entity_id: vacuum.vacky
  394.                             data:
  395.                               fan_speed: Turbo
  396.                           styles:
  397.                             icon:
  398.                               - width: 30px
  399.                             card:
  400.                               - height: 40px
  401.                               - width: 40px
  402.                           state:
  403.                             - operator: template
  404.                               value: >
  405.                                [[[
  406.  
  407.                                 return
  408.                                 (states['vacuum.vacky'].attributes.fan_speed ===
  409.                                 'Turbo' ) && states['vacuum.vacky'].state ===
  410.                                 'cleaning'
  411.  
  412.                                 ]]]
  413.                               icon: mdi:fan
  414.                               color: black
  415.                               styles:
  416.                                 name:
  417.                                   - color: black
  418.                                 icon:
  419.                                   - animation:
  420.                                      - rotating 0.5s linear infinite
  421.                                 card:
  422.                                   - background-color: '#FFC700'
  423.                             - operator: template
  424.                               value: >
  425.                                [[[
  426.  
  427.                                 return
  428.                                 (states['vacuum.vacky'].attributes.fan_speed ===
  429.                                 'Turbo' ) && states['vacuum.vacky'].state ===
  430.                                 'docked'
  431.  
  432.                                 ]]]
  433.                               icon: mdi:fan
  434.                               color: var(--contrast3)
  435.                               styles:
  436.                                 name:
  437.                                   - color: var(--contrast3)
  438.                                 card:
  439.                                   - background-color: '#FFC700'
  440.                             - operator: default
  441.                               icon: mdi:fan
  442.                             - operator: default
  443.                               icon: mdi:fan
  444.                               styles:
  445.                                 name:
  446.                                   - color: var(--contrast9)
  447.                                 card:
  448.                                   - background-color: '#A5D09B'
  449.                         - type: custom:button-card
  450.                           color_type: blank-card
  451.                     - square: false
  452.                       type: grid
  453.                       cards:
  454.                         - type: custom:button-card
  455.                           template: vacuum_button
  456.                           variables:
  457.                             name: Cucina
  458.                             label: |
  459.                              [[[
  460.                                 if (states[entity.entity_id].state === 'on' )
  461.                                 return "selezionato"
  462.                                 else return (states['sensor.vacky_ultimo_avvio'].attributes.cucina)
  463.                               ]]]
  464.                           entity: input_boolean.pulisci_cucina
  465.                         - type: custom:button-card
  466.                           template: vacuum_button
  467.                           variables:
  468.                             name: Soggiorno
  469.                             label: |
  470.                              [[[
  471.                                 if (states[entity.entity_id].state === 'on' )
  472.                                 return "selezionato"
  473.                                 else return (states['sensor.vacky_ultimo_avvio'].attributes.soggiorno)
  474.                               ]]]
  475.                           entity: input_boolean.pulisci_soggiorno
  476.                         - type: custom:button-card
  477.                           template: vacuum_button
  478.                           variables:
  479.                             name: Ingresso
  480.                             label: |
  481.                              [[[
  482.                                 if (states[entity.entity_id].state === 'on' )
  483.                                 return "selezionato"
  484.                                 else return (states['sensor.vacky_ultimo_avvio'].attributes.ingresso)
  485.                               ]]]
  486.                           entity: input_boolean.pulisci_ingresso
  487.                         - type: custom:button-card
  488.                           template: vacuum_button
  489.                           variables:
  490.                             name: Corridoio
  491.                             label: |
  492.                              [[[
  493.                                 if (states[entity.entity_id].state === 'on' )
  494.                                 return "selezionato"
  495.                                 else return (states['sensor.vacky_ultimo_avvio'].attributes.corridoio)
  496.                               ]]]
  497.                           entity: input_boolean.pulisci_corridoio
  498.                         - type: custom:button-card
  499.                           template: vacuum_button
  500.                           variables:
  501.                             name: Camera
  502.                             label: |
  503.                              [[[
  504.                                 if (states[entity.entity_id].state === 'on' )
  505.                                 return "selezionato"
  506.                                 else return (states['sensor.vacky_ultimo_avvio'].attributes.camera)
  507.                               ]]]
  508.                           entity: input_boolean.pulisci_camera
  509.                         - type: custom:button-card
  510.                           template: vacuum_button
  511.                           variables:
  512.                             name: Cameretta
  513.                             label: |
  514.                              [[[
  515.                                 if (states[entity.entity_id].state === 'on' )
  516.                                 return "selezionato"
  517.                                 else return (states['sensor.vacky_ultimo_avvio'].attributes.cameretta)
  518.                               ]]]
  519.                           entity: input_boolean.pulisci_cameretta
  520.                         - type: custom:button-card
  521.                           template: vacuum_button
  522.                           variables:
  523.                             name: Studio
  524.                             label: |
  525.                              [[[
  526.                                 if (states[entity.entity_id].state === 'on' )
  527.                                 return "selezionato"
  528.                                 else return (states['sensor.vacky_ultimo_avvio'].attributes.studio)
  529.                               ]]]
  530.                           entity: input_boolean.pulisci_studio
  531.                         - type: custom:button-card
  532.                           template: vacuum_button
  533.                           variables:
  534.                             name: Camere
  535.                             label: |
  536.                              [[[
  537.                                 if (states[entity.entity_id].state === 'on' )
  538.                                 return "selezionato"
  539.                                 else return (states['sensor.vacky_ultimo_avvio'].attributes.camere)
  540.                               ]]]
  541.                           entity: input_boolean.pulisci_camere
  542.                       columns: 2
  543.                     - square: false
  544.                       type: grid
  545.                       cards:
  546.                         - type: custom:button-card
  547.                           template: vacuum_button
  548.                           variables:
  549.                             name: Avvia aspirapolvere
  550.                             background_off: '#A5D09B'
  551.                             background_on: '#FFC700'
  552.                             label: |
  553.                              [[[
  554.                                 if (states['script.avvia_aspirapolvere'].state === 'on' )
  555.                                 return helpers.relativeTime(states['script.avvia_aspirapolvere'].attributes.last_triggered)
  556.                               ]]]
  557.                           entity: input_boolean.pulisci_tutto
  558.                           tap_action:
  559.                             action: call-service
  560.                             service: script.avvia_aspirapolvere
  561.                             target: {}
  562.                       columns: 1
  563.             - square: false
  564.               columns: 1
  565.               type: grid
  566.               card_mod:
  567.                 class: nav_2
  568.               cards:
  569.                 - square: false
  570.                   type: grid
  571.                   cards:
  572.                     - type: custom:button-card
  573.                       entity: vacuum.vacky
  574.                       label: Stato
  575.                       name: |
  576.                        [[[
  577.                           return helpers.localize(entity)
  578.                         ]]]
  579.                       template: sensor_vacuum
  580.                     - type: custom:button-card
  581.                       entity: vacuum.vacky
  582.                       icon: mdi:battery-charging-100
  583.                       label: Batteria
  584.                       name: |
  585.                        [[[
  586.                           return entity.attributes.battery_level + '<span style="font-size: 0.8em"> %</span>'
  587.                         ]]]
  588.                       template: sensor_vacuum
  589.                     - type: custom:button-card
  590.                       entity: vacuum.vacky
  591.                       label: Area pulita
  592.                       icon: mdi:texture-box
  593.                       name: |
  594.                        [[[
  595.                           return Math.round(entity.attributes.cleaned_area) + '<span style="font-size: 0.8em"> m²<span>'
  596.                         ]]]
  597.                       template: sensor_vacuum
  598.                     - type: custom:button-card
  599.                       entity: vacuum.vacky
  600.                       label: Tempo di pulizia
  601.                       icon: mdi:timer-sand
  602.                       name: |
  603.                        [[[
  604.                           return Math.round(entity.attributes.cleaning_time) + '<span style="font-size: 0.8em"> min<span>'
  605.                         ]]]
  606.                       template: sensor_vacuum
  607.                     - type: custom:button-card
  608.                       entity: sensor.filtro
  609.                       label: Filtro
  610.                       name: |
  611.                        [[[
  612.                           return entity.state + '<span style="font-size: 0.8em"> %</span>'
  613.                         ]]]
  614.                       template: sensor_vacuum
  615.                       state:
  616.                         - operator: template
  617.                           value: |
  618.                            [[[
  619.                               return entity.state < '20'
  620.                             ]]]
  621.                           styles:
  622.                             card:
  623.                               - background: var(--red)
  624.                     - type: custom:button-card
  625.                       entity: sensor.spazzola_principale
  626.                       label: Spazzola principale
  627.                       name: |
  628.                        [[[
  629.                           return entity.state + '<span style="font-size: 0.8em"> %</span>'
  630.                         ]]]
  631.                       template: sensor_vacuum
  632.                       state:
  633.                         - operator: template
  634.                           value: |
  635.                            [[[
  636.                               return entity.state < '20'
  637.                             ]]]
  638.                           styles:
  639.                             card:
  640.                               - background: var(--red)
  641.                     - type: custom:button-card
  642.                       entity: sensor.spazzola_laterale
  643.                       label: Spazzola laterale
  644.                       name: |
  645.                        [[[
  646.                           return entity.state + '<span style="font-size: 0.8em"> %</span>'
  647.                         ]]]
  648.                       template: sensor_vacuum
  649.                       state:
  650.                         - operator: template
  651.                           value: |
  652.                            [[[
  653.                               return entity.state < '20'
  654.                             ]]]
  655.                           styles:
  656.                             card:
  657.                               - background: var(--red)
  658.                     - type: custom:button-card
  659.                       entity: sensor.panno_di_pulizia
  660.                       label: Panno di pulizia
  661.                       name: |
  662.                        [[[
  663.                           return entity.state + '<span style="font-size: 0.8em"> %</span>'
  664.                         ]]]
  665.                       template: sensor_vacuum
  666.                       state:
  667.                         - operator: template
  668.                           value: |
  669.                            [[[
  670.                               return entity.state < '20'
  671.                             ]]]
  672.                           styles:
  673.                             card:
  674.                               - background: var(--red)
  675.                   columns: 2
  676.         style:
  677.           swipe-card$: |
  678.            .swiper-container {
  679.               margin: 0px 0 0 0 !important;
  680.               padding: 65px 30px 10px 30px !important;
  681.             }
  682.             .swiper-pagination-bullets {
  683.             position: absolute;
  684.             top: 15px;
  685.             bottom: inherit !important;
  686.             width: 60%;
  687.             font-size: 12px;
  688.             color: white;
  689.             }
  690.             .swiper-pagination-bullets>span {
  691.             margin: 0px !important;
  692.             min-width: 80px;
  693.             min-height: 25px;
  694.             padding-top: 5px;
  695.             border-radius: 0;
  696.             background: var(--sidebar);
  697.             }
  698.             .swiper-pagination-bullets>span:last-child {
  699.             border-radius: 0px 10px 10px 0px;
  700.             }
  701.             .swiper-pagination-bullets>span:first-child {
  702.             border-radius: 10px 0 0 10px;
  703.             }
  704.             .swiper-pagination-bullets>span:nth-child(1):before {
  705.               content: "STANZE";
  706.             }
  707.             .swiper-pagination-bullets>span:nth-child(2):before {
  708.               content: "RICAMBI";
  709.             }
  710.             .swiper-pagination-bullets>span:nth-child(3):before {
  711.               content: "ACCESSI";
  712.             }
  713.           .: |
  714.            ha-card {
  715.               height: 335px;
  716.               padding: 15px 0;
  717.               margin-top: -55px;
  718.               background: var(--contrast1);
  719.             }
  720. id: vacuum
  721.  
Tags: ha vacuum
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement