Advertisement
Guest User

HaCasa Weather Card

a guest
Feb 16th, 2025
801
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.48 KB | Source Code | 1 0
  1. hc_weather_card:
  2. variables:
  3. card_background: var(--weather-card-color)
  4. card_text_color: var(--weather-card-text-color)
  5. name_entity: ""
  6. label_entity: ""
  7. secondary_info: ""
  8. show_label: true
  9. show_icon: true
  10. icon: >-
  11. [[[
  12. if (!entity || !entity.state) return 'fas:question';
  13. const weather = entity.state.toLowerCase();
  14. const iconMap = {
  15. 'sunny': 'fapro:sun-solid',
  16. 'clear': 'fapro:sun-regular',
  17. 'partlycloudy': 'fapro:cloud-sun-solid',
  18. 'cloudy': 'fapro:cloud-solid',
  19. 'fog': 'fapro:smog-solid',
  20. 'rainy': 'fapro:cloud-rain-solid',
  21. 'pouring': 'fapro:cloud-showers-heavy-solid',
  22. 'lightning': 'fapro:cloud-bolt-solid',
  23. 'lightning-rainy': 'fapro:cloud-bolt-solid',
  24. 'windy': 'fapro:wind-solid',
  25. 'snowy': 'fapro:snowflake-solid',
  26. 'snowy-rainy': 'fapro:snowflake-solid',
  27. 'hail': 'fapro:cloud-meatball-solid',
  28. };
  29. return iconMap[weather] || 'fapro:cloud-solid';
  30. ]]]
  31. name: "[[[ return variables.name_entity && states[variables.name_entity] ? states[variables.name_entity].state + '˚C' : '' ]]]"
  32. label: "[[[ return variables.label_entity && states[variables.label_entity] ? 'Feels like ' + states[variables.label_entity].state + '˚C' : '' ]]]"
  33. styles:
  34. grid:
  35. - grid-template-areas: |
  36. "n i"
  37. "l i"
  38. "weather weather"
  39. - grid-template-columns: 1fr min-content
  40. - grid-template-rows: min-content min-content min-content
  41. card:
  42. - background: var(--weather-card-color)
  43. - padding: 25px
  44. name:
  45. - color: var(--weather-card-text-color)
  46. - justify-self: start
  47. - align-self: end
  48. - font-family: montserrat
  49. - font-weight: 700
  50. - font-size: 2rem
  51. - z-index: 1
  52. label:
  53. - color: var(--weather-card-text-color)
  54. - justify-self: start
  55. - align-self: start
  56. - z-index: 1
  57. - font-family: montserrat
  58. - font-size: 1rem
  59. icon:
  60. - width: 80px
  61. - color: var(--color-white)
  62. custom_fields:
  63. weather:
  64. card:
  65. type: custom:button-card
  66. show_label: true
  67. entity: "[[[ return entity ? entity.entity_id : '' ]]]"
  68. show_name: true
  69. show_icon: false
  70. show_state: false
  71. name: >-
  72. [[[
  73. if (!states['sensor.home_condition_day_0']) return '';
  74. return states['sensor.home_condition_day_0'].state;
  75. ]]]
  76. label: "[[[ return variables.secondary_info ]]]"
  77. styles:
  78. grid:
  79. - grid-template-areas: |
  80. "n"
  81. "l"
  82. - grid-template-rows: auto auto
  83. - grid-template-columns: 1fr
  84. card:
  85. - background: none
  86. - box-shadow: none
  87. - border-radius: none
  88. - overflow: visible
  89. name:
  90. - justify-self: start
  91. - overflow: visible
  92. - font-family: montserrat
  93. - opacity: 0.8
  94. - font-size: 1rem
  95. - color: var(--weather-card-text-color)
  96. - text-align: left
  97. - white-space: normal
  98. - word-wrap: normal
  99. - overflow-wrap: break-word
  100. label:
  101. - justify-self: start
  102. - font-size: 1rem
  103. - font-family: montserrat
  104. - opacity: 0.8
  105. - color: var(--weather-card-text-color)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement