跳到主要内容

天气预报卡片

天气预报卡片显示天气信息。这个卡片在壁挂式显示器上特别有用。

天气卡片的截图

天气卡片的截图。

要将天气预报卡片添加到你的用户界面:

  1. 在屏幕右上角,选择编辑按钮。

    • 如果这是你首次编辑仪表板,会出现编辑仪表板对话框。
      • 通过编辑仪表板,你将接管这个仪表板的控制权。
      • 这意味着当新的仪表板元素可用时,它将不再自动更新。
      • 一旦你接管控制权,你将无法让这个特定的仪表板恢复自动更新。不过,你可以创建一个新的默认仪表板。
      • 要继续,在对话框中,选择三点菜单,然后选择接管控制
  2. 添加卡片并自定义操作和功能到你的仪表板。

卡片设置

Entity

要使用的weather平台的实体。

Name

天气平台所在位置的名称。如果未设置,名称将是天气实体上设置的名称

Show Forecast

如果你想在当前天气下显示即将到来的预报,请勾选此项。

Forecast type

在"每日"、"每小时"和"每日两次"之间选择要显示的预报。

Secondary Info Attribute

在这里你可以指定要在当前温度下显示的次要属性。例如:极值、降水量、湿度。如果未设置,如果有极值(高/低)数据则默认显示极值,如果没有极值数据则显示降水量,如果没有降水量数据则显示湿度。

Theme

用于此卡片的任何已加载主题的名称。有关主题的更多信息,请参阅前端文档

提示

此卡片仅适用于定义了weather实体的平台。例如,它适用于OpenWeatherMap,但不适用于OpenWeatherMap传感器

YAML配置

当你使用YAML模式或只是更喜欢在UI中的代码编辑器中使用YAML时,以下YAML选项可用。

配置变量

type string 必填

weather-forecast

entity string 必填

weather域的实体ID。

name string (可选,默认:实体名称)

覆盖友好名称。

show_forecast boolean (可选,默认:true)

显示接下来几小时/几天的预报。

forecast_type string 必填

要显示的预报类型,dailyhourlytwice_daily之一。

默认:按照dailyhourlytwice_daily的顺序自动选择。

secondary_info_attribute string (可选)

在温度下显示哪个属性。

默认:如果有extrema数据则默认为extrema,如果没有则为precipitation,如果没有降水量数据则为humidity

theme string (可选)

使用任何已加载的主题覆盖此卡片使用的主题。有关主题的更多信息,请参阅前端文档

tap_action map (可选)

卡片点击时执行的操作。请参阅操作文档。默认情况下,它将显示"更多信息"对话框。

hold_action map (可选)

点击并按住时执行的操作。请参阅操作文档

double_tap_action map (可选)

双击时执行的操作。请参阅操作文档

示例

show_current: true
show_forecast: true
type: weather-forecast
entity: weather.openweathermap
forecast_type: daily

高级设置

可主题化图标

默认的天气图标可以通过主题进行主题化。主题变量包括:

--weather-icon-cloud-front-color
--weather-icon-cloud-back-color
--weather-icon-sun-color
--weather-icon-rain-color
--weather-icon-moon-color

主题配置示例:

--weather-icon-cloud-front-color: white
--weather-icon-cloud-back-color: blue
--weather-icon-sun-color: orange
--weather-icon-rain-color: purple

个人图标

天气图标可以通过主题用你自己的个人图片覆盖。主题变量包括:

--weather-icon-clear-night
--weather-icon-cloudy
--weather-icon-fog
--weather-icon-lightning
--weather-icon-lightning-rainy
--weather-icon-partlycloudy
--weather-icon-pouring
--weather-icon-rainy
--weather-icon-hail
--weather-icon-snowy
--weather-icon-snowy-rainy
--weather-icon-sunny
--weather-icon-windy
--weather-icon-windy-variant
--weather-icon-exceptional

// 如果你的状态不在上面,使用这种格式
--weather-icon-<state>

主题配置示例:

--weather-icon-sunny: url("/local/sunny.png")

相关主题