fablav

Lavatrice Samuele Desuo

Oct 5th, 2024
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 7.97 KB | Software | 0 0
  1. type: custom:button-card
  2. entity: sensor.lavatrice
  3. name: Lavatrice
  4. icon: hue:room-laundry
  5. show_state: false
  6. show_label: true
  7. tap_action:
  8.   action: none
  9. double_tap_action:
  10.   action: none
  11. label: |
  12.  [[[
  13.    var initialTime = states['sensor.lavatrice_initial_time'].state;
  14.    var remainingTime = states['sensor.lavatrice_remaining_time'].state;
  15.  
  16.    // Controlla se i valori sono numeri validi
  17.    if (!isNaN(initialTime) && !isNaN(remainingTime)) {
  18.      return "<br>⏱ <span style='font-weight: bold; color: white;'>" + Math.round(initialTime) + " ⏳ <span style='font-weight: bold; color: white;'>" + Math.round(remainingTime) + "</span>";
  19.    } else {
  20.      return "<br>⏱ <span style='font-weight: bold; color: white;'>0:00:00</span> ⏳ <span style='font-weight: bold; color: white;'>0:00:00</span>";
  21.    }
  22.   ]]]
  23. custom_fields:
  24.   btn:
  25.     card:
  26.       type: custom:mushroom-chips-card
  27.       chips:
  28.         - type: template
  29.           tap_action:
  30.             action: more-info
  31.           entity: sensor.lavatrice_spin_speed
  32.           show_state: true
  33.           show_label: true
  34.           icon: |
  35.            {% if is_state(entity, 'on') %}
  36.               mdi:rotate-3d-variant
  37.             {% else %}
  38.               mdi:rotate-3d-variant
  39.             {% endif %}
  40.           icon_color: |
  41.            {% if is_state(entity, 'on') %}
  42.               black
  43.             {% else %}
  44.  
  45.             {% endif %}
  46.         - type: template
  47.           tap_action:
  48.             action: more-info
  49.           entity: sensor.lavatrice_water_temp
  50.           show_state: true
  51.           show_label: true
  52.           icon: |
  53.            {% if is_state(entity, 'on') %}
  54.               mdi:thermometer
  55.             {% else %}
  56.               mdi:thermometer
  57.             {% endif %}
  58.           icon_color: |
  59.            {% if is_state(entity, 'on') %}
  60.               black
  61.             {% else %}
  62.  
  63.             {% endif %}
  64.         - type: template
  65.           tap_action:
  66.             action: more-info
  67.           entity: sensor.lavatrice_run_state
  68.           icon: mdi:washing-machine
  69.           show_state: true
  70.           show_label: true
  71.       card_mod:
  72.         style:
  73.           mushroom-template-chip:nth-child(3)$:
  74.             mushroom-chip$: |
  75.              ha-card {
  76.                 --chip-background: {{ 'rgba(65, 105, 235, 1)' if is_state('sensor.lavatrice_run_state', '-') else 'rgba(255, 255, 0, 0.6)' }};
  77.                 animation: {{ 'ping 2s ease-out infinite' if not is_state('sensor.lavatrice_run_state', '-') else 'none' }};
  78.                 padding: 5px !important;
  79.                 border-radius: 100px !important;
  80.               }
  81.               @keyframes ping {
  82.                 0% {
  83.                   box-shadow: 0 0 5px 1px rgba(var(--rgb-amber), 1);
  84.                 }
  85.                 100% {
  86.                   box-shadow: 0 0 5px 10px rgba(var(--rgb-amber), 0);
  87.                 }
  88.               }
  89.               ha-card:active {
  90.                 transform: translateY(1.5px);
  91.                 transition: 0s;
  92.                 box-shadow: 0 0.5px 2px 0 rgba(0, 0, 0, 0.16);
  93.               }
  94.             .: |
  95.              ha-state-icon {
  96.                 animation: {{ 'illumination 2s infinite' if is_state('sensor.lavatrice', 'on') }};
  97.               }
  98.               @keyframes illumination {
  99.                 0%, 100% { clip-path: inset(0 0 0 0); }
  100.                 95% { clip-path: polygon(0% 99%, 20% 55%, 22% 37%, 39% 20%, 61% 21%, 77% 35%, 79% 57%, 99% 100%); }
  101.               }
  102.           mushroom-template-chip:nth-child(2)$:
  103.             mushroom-chip$: |
  104.              ha-card {
  105.                 --chip-background: {{ 'rgba(65, 105, 235, 1)' if is_state('sensor.lavatrice_water_temp', 'Non selezionato') else 'rgba(255, 255, 0, 0.6)' }};
  106.                 animation: {{ 'ping 2s ease-out infinite' if not is_state('sensor.lavatrice_water_temp', 'Non selezionato') else 'none' }};
  107.                 padding: 5px !important;
  108.                 border-radius: 100px !important;
  109.               }
  110.               @keyframes ping {
  111.                 0% {
  112.                   box-shadow: 0 0 5px 1px rgba(var(--rgb-amber), 1);
  113.                 }
  114.                 100% {
  115.                   box-shadow: 0 0 5px 10px rgba(var(--rgb-amber), 0);
  116.                 }
  117.               }
  118.               ha-card:active {
  119.                 transform: translateY(1.5px);
  120.                 transition: 0s;
  121.                 box-shadow: 0 0.5px 2px 0 rgba(0, 0, 0, 0.16);
  122.               }
  123.             .: |
  124.              ha-state-icon {
  125.                 animation: {{ 'illumination 2s infinite' if is_state('sensor.lavatrice', 'on') }};
  126.               }
  127.               @keyframes illumination {
  128.               0%, 100% { clip-path: inset(0 0 0 0); }
  129.                 95% { clip-path: polygon(0% 99%, 20% 55%, 22% 37%, 39% 20%, 61% 21%, 77% 35%, 79% 57%, 99% 100%); }
  130.               }
  131.           mushroom-template-chip:nth-child(1)$:
  132.             mushroom-chip$: |
  133.              ha-card {
  134.                 --chip-background: {{ 'rgba(65, 105, 235, 1)' if is_state('sensor.lavatrice_spin_speed', 'Non selezionato') else 'rgba(255, 255, 0, 0.6)' }};
  135.                 animation: {{ 'ping 2s ease-out infinite' if not is_state('sensor.lavatrice_spin_speed', 'Non selezionato') else 'none' }};
  136.                 padding: 5px !important;
  137.                 border-radius: 100px !important;
  138.               }
  139.               @keyframes ping {
  140.                 0% {
  141.                   box-shadow: 0 0 5px 1px rgba(var(--rgb-amber), 1);
  142.                 }
  143.                 100% {
  144.                   box-shadow: 0 0 5px 10px rgba(var(--rgb-amber), 0);
  145.                 }
  146.               }
  147.               ha-card:active {
  148.                 transform: translateY(1.5px);
  149.                 transition: 0s;
  150.                 box-shadow: 0 0.5px 2px 0 rgba(0, 0, 0, 0.16);
  151.               }
  152.             .: |
  153.              ha-state-icon {
  154.                 animation: {{ 'illumination 2s infinite' if is_state('sensor.lavatrice', 'on') }};
  155.               }
  156.               @keyframes illumination {
  157.                 0%, 100% { clip-path: inset(0 0 0 0); }
  158.                 95% { clip-path: polygon(0% 99%, 20% 55%, 22% 37%, 39% 20%, 61% 21%, 77% 35%, 79% 57%, 99% 100%); }
  159.               }
  160. state:
  161.   - value: 'off'
  162.     styles:
  163.       img_cell:
  164.         - background: '#1e90ff'
  165.         - opacity: 0.6
  166.   - value: unavailable
  167.     styles:
  168.       img_cell:
  169.         - background: '#ff0000'
  170.         - opacity: 0.3
  171. styles:
  172.   grid:
  173.     - grid-template-areas: '"n btn" "l btn" "i btn"'
  174.     - grid-template-columns: 1fr min-content
  175.     - grid-template-rows: min-content min-content 1fr
  176.   img_cell:
  177.     - justify-content: start
  178.     - position: absolute
  179.     - width: 140px
  180.     - height: 140px
  181.     - left: 0
  182.     - bottom: 0
  183.     - margin: 0 0 -30px -30px
  184.     - background: orange
  185.     - border-radius: 200px
  186.   icon:
  187.     - width: 70px
  188.     - color: white
  189.     - opacity: ''
  190.   card:
  191.     - padding: 22px 28px 22px 22px
  192.   custom_fields:
  193.     btn:
  194.       - justify-content: end
  195.       - align-self: start
  196.   name:
  197.     - justify-self: start
  198.     - justify-content: start
  199.     - align-self: start
  200.     - font-size: 18px
  201.     - font-weight: 500
  202.     - color: null
  203. columns: 2
  204. card_mod:
  205.   style: |
  206.    ha-card {
  207.       border: 0px solid white;
  208.       background: rgba(255, 255, 255, 0);
  209.       padding: 0;
  210.       box-shadow:
  211.         0 0 5px rgba(255, 255, 255, 0.3),
  212.         0 0 5px rgba(255, 255, 255, 0.3),
  213.         0 0 10px rgba(255, 255, 255, 0.3),
  214.         0 0 10px rgba(255, 255, 255, 0.3);
  215.       position: relative;
  216.       animation: neon-animation 8s linear infinite;
  217.       --neon-color:
  218.           orange
  219.     }
  220.     @keyframes neon-animation {
  221.       0% { box-shadow: -7px -7px 10px 1px var(--neon-color); }
  222.       20% { box-shadow: 0 -7px 10px 1px var(--neon-color); }
  223.       40% {box-shadow: 7px 0 10px 1px var(--neon-color); }
  224.       60% { box-shadow: 7px 7px 10px 1px var(--neon-color); }
  225.       80% { box-shadow: -7px 7px 10px 1px var(--neon-color); }
  226.       100% { box-shadow: -7px -7px 10px 1px var(--neon-color); }
  227.     }
Add Comment
Please, Sign In to add comment