- 积分
- 677
- 金钱
- 621
- 威望
- 0
- 贡献
- 0
- HASS币
- 0
高级会员
- 积分
- 677
- 金钱
- 621
- HASS币
- 0
|
楼主 |
发表于 2023-4-27 22:11:55
|
显示全部楼层
询问GPT,答案是:要将 Home Assistant 插件彩云天气的状况从英文变为中文,您可以按照以下步骤进行设置:
在 Home Assistant 界面左侧的侧边栏中,选择“配置”选项卡。
选择“自定义UI”选项,并在其中添加以下代码:
# customize weather entity state
homeassistant:
customize:
weather.caiyun:
friendly_state: >
{% if state_attr('weather.caiyun', 'condition') == 'CLEAR_DAY' %}
晴天
{% elif state_attr('weather.caiyun', 'condition') == 'CLEAR_NIGHT' %}
晴夜
{% elif state_attr('weather.caiyun', 'condition') == 'PARTLY_CLOUDY_DAY' %}
多云
{% elif state_attr('weather.caiyun', 'condition') == 'PARTLY_CLOUDY_NIGHT' %}
多云
{% elif state_attr('weather.caiyun', 'condition') == 'CLOUDY' %}
阴天
{% elif state_attr('weather.caiyun', 'condition') == 'LIGHT_HAZE' %}
轻度雾霾
{% elif state_attr('weather.caiyun', 'condition') == 'MODERATE_HAZE' %}
中度雾霾
{% elif state_attr('weather.caiyun', 'condition') == 'HEAVY_HAZE' %}
重度雾霾
{% elif state_attr('weather.caiyun', 'condition') == 'LIGHT_RAIN' %}
小雨
{% elif state_attr('weather.caiyun', 'condition') == 'MODERATE_RAIN' %}
中雨
{% elif state_attr('weather.caiyun', 'condition') == 'HEAVY_RAIN' %}
大雨
{% elif state_attr('weather.caiyun', 'condition') == 'STORM_RAIN' %}
暴雨
{% elif state_attr('weather.caiyun', 'condition') == 'LIGHT_SNOW' %}
小雪
{% elif state_attr('weather.caiyun', 'condition') == 'MODERATE_SNOW' %}
中雪
{% elif state_attr('weather.caiyun', 'condition') == 'HEAVY_SNOW' %}
大雪
{% elif state_attr('weather.caiyun', 'condition') == 'STORM_SNOW' %}
暴雪
{% elif state_attr('weather.caiyun', 'condition') == 'DUST' %}
浮尘
{% elif state_attr('weather.caiyun', 'condition') == 'SAND' %}
沙尘
{% elif state_attr('weather.caiyun', 'condition') == 'WIND' %}
大风
{% else %}
{{state_attr('weather.caiyun', 'condition')}}
{% endif %}
感觉太麻烦了 |
|