|
发表于 2024-2-19 19:56:07
|
显示全部楼层
大佬,天气部分,我的为何是这样?
- type: custom:mushroom-template-card
entity: weather.tian_qi
primary: '{{ state_attr(entity, ''temperature'') | round(1) }} °C'
secondary: |-
{% set condition = states(entity) %} {% set name = {
'CLEAR_DAY':'晴', 'clear-night':'晴','partlycloudy':'多云', 'PARTLY_CLOUDY_NIGHT':'多云','cloudy':'阴', 'LIGHT_HAZE':'轻度雾霾','MODERATE_HAZE':'中度雾霾', 'HEAVY_HAZE':'重度雾霾',
'rainy':'雨','LIGHT_RAIN':'小雨', 'MODERATE_RAIN':'中雨','HEAVY_RAIN':'大雨', 'STORM_RAIN':'暴雨','FOG':'雾', 'LIGHT_SNOW':'小雪','MODERATE_SNOW':'中雪', 'HEAVY_SNOW':'大雪','STORM_SNOW':'暴雪',
'DUST':'浮尘','SAND':'沙尘', 'WIND':'风','sunny':'晴'
} %} {{name[condition]}}
icon: ' '
picture: |-
{% set condition = states(entity) %}
{% set icon = {
'CLEAR_DAY':'day', 'clear-night':'night','partlycloudy':'cloudy-day-3', 'PARTLY_CLOUDY_NIGHT':'cloudy-night-3','cloudy':'cloudy-day-3', 'LIGHT_HAZE':'','MODERATE_HAZE':'', 'HEAVY_HAZE':'',
'rainy':'rainy-4','LIGHT_RAIN':'rainy-4', 'MODERATE_RAIN':'rainy-5','HEAVY_RAIN':'rainy-6', 'STORM_RAIN':'rainy-7','FOG':'', 'LIGHT_SNOW':'snowy-3','MODERATE_SNOW':'snowy-4', 'HEAVY_SNOW':'snowy-5','STORM_SNOW':'snowy-6',
'DUST':'','SAND':'', 'WIND':'','sunny':'day'
} %}
/local/weather_icons/animated/{{icon[condition]}}.svg
card_mod: null
style:
mushroom-state-info$: |
/* Align text on the right */
.container {
transform: scaleX(-1);
text-align: right;
width: fit-content;
}
.: |
ha-card {
/* Move icon to the right */
transform: scaleX(-1);
/* Enlarge icon & remove circular shape */
--icon-size: 42px;
--icon-border-radius: 0;
/* Style secondary text */
--card-secondary-font-weight: normal;
/* Remove styling from card */
--ha-card-background: none;
--ha-card-box-shadow: none;
--ha-card-border-width: 0;
padding: 0px !important;
transition: all 0s;
} |
-
|