Advertisement
fablav

Decluttering template Mushroom Battery

Feb 2nd, 2024 (edited)
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | Software | 0 0
  1. decluttering_templates:
  2. mushroom_battery:
  3. default:
  4. - entity: sensor.pixel_7_battery_level
  5. - name: Pixel 7
  6. card:
  7. type: custom:mushroom-template-card
  8. entity: '[[entity]]'
  9. icon: mdi:battery-high
  10. icon_color: |
  11. {% if states(config.entity) | int <= 30 %}
  12. red
  13. {%elif states (config.entity) | int <= 80 %}
  14. blue
  15. {% else %}
  16. green
  17. {% endif %}
  18. primary: '[[name]]'
  19. secondary: |
  20. {% set status = config.entity|replace("_level", "_state") %}
  21. {% if is_state(status, 'charging') %}
  22. in carica al {{ states(config.entity) }} %
  23. {% else %}
  24. Batteria al {{ states(config.entity) }} %
  25. {% endif %}
  26. card_mod:
  27. style:
  28. mushroom-shape-icon$: |
  29. .shape {
  30. {% set status = config.entity|replace("_level", "_state") %}
  31. {% if is_state(status, 'charging') %}
  32. --shape-animation: ping 3s infinite;
  33. {% else %}
  34. {% endif %};
  35. }
  36. @keyframes ping {
  37. {% if states(config.entity) | int <= 30 %}
  38. 0% {box-shadow: 0 0 0 0 rgba(var(--rgb-red), 0.7);}
  39. {%elif states (config.entity) | int <= 80 %}
  40. 0% {box-shadow: 0 0 0 0 rgba(var(--rgb-blue), 0.7);}
  41. {% else %}
  42. 0% {box-shadow: 0 0 0 0 rgba(var(--rgb-green), 0.7);}
  43. {% endif %}
  44. 70% {box-shadow: 0 0 0 10px transparent;}
  45. 100% {box-shadow: 0 0 0 0 transparent;}
  46. }
  47. .: |
  48. ha-state-icon {
  49. {% set status = config.entity|replace("_level", "_state") %}
  50. {% if is_state(status, 'charging') %}
  51. animation: charge 3s steps(1) infinite;
  52. {% else %}
  53. {% endif %};
  54. }
  55. @keyframes charge {
  56. 0% { clip-path: polygon(0% 0%, 0% 100%, 34% 100%, 34% 24%, 67% 24%, 67% 84%, 34% 84%, 34% 100%, 100% 100%, 100% 0%); }
  57. 20% { clip-path: polygon(0% 0%, 0% 100%, 34% 100%, 34% 24%, 67% 24%, 67% 64%, 34% 64%, 34% 100%, 100% 100%, 100% 0%); }
  58. 40% { clip-path: polygon(0% 0%, 0% 100%, 34% 100%, 34% 24%, 67% 24%, 67% 44%, 34% 44%, 34% 100%, 100% 100%, 100% 0%); }
  59. 60% { clip-path: polygon(0% 0%, 0% 100%, 34% 100%, 34% 24%, 67% 24%, 67% 24%, 34% 24%, 34% 100%, 100% 100%, 100% 0%); }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement