百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

lovelace-hourly-weather

> 编程语言
开源

Home Assistant 的每小时天气卡。将即将到来的天气条件呈现为彩色横条。

398 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

Home Assistant 的每小时天气卡。将即将到来的天气条件呈现为彩色横条。

Hourly Weather Card by @decompil3d

An hourly weather card for Home Assistant. Visualize upcoming weather conditions as a colored horizontal bar.

[![GitHub Release][releases-shield]][releases] ![License][license-shield] ![Project Maintenance][maintenance-shield] [![GitHub Activity][commits-shield]][commits]

Installation

Easiest method:

✨ Install via HACS

Alternative method:

  1. Download hourly-weather.js from the [Releases][releases] page
  2. Upload to /www/hourly-weather/hourly-weather.js (via Samba, File Editor, SSH, etc.)
  3. Visit the Resources page in your Home Assistant install and add /hourly-weather/hourly-weather.js as a JavaScript Module.
  4. Refresh your browser

Usage

This card will show in the "Add card" modal. It has a GUI editor for configuring settings.

If you prefer YAML, here is a sample config:

yaml
type: custom:hourly-weather
entity: weather.my_weather_entity
num_segments: 18 # optional, defaults to 12
name: Next 18 hours # optional, defaults to "Hourly Weather"

Choosing the right entity

This card is focused on displaying hourly weather data. It will work with coarser- or finer-grained data, though. I've tested with the OpenWeatherMap integration using the onecall_hourly mode and that works very well.

As of Home Assistant 2023.9.0, most weather integrations provide data in multiple time increments. If your weather entity provides hourly data, the card will use that by default. Otherwise, the card will attempt to use the finest-grained increments available, unless you have configured otherwise.

ℹ️ NOTE: If your selected weather entity provides forecasts in increments of greater than one hour at a time, each segment of the bar will be for one segment, not one hour.

Prior to Home Assistant version 2023.9.0, if you already use OpenWeatherMap for daily data, you can add a second integration of the same component for hourly -- just adjust the latitude or longitude a tiny bit (i.e. change the last decimal by 1). Otherwise, the integration may complain of a duplicate unique ID.

Options

Name Type Requirement Description Default
type string Required custom:hourly-weather
entity string Required Home Assistant weather entity ID.
forecast_type string Optional The type of forecast data to use. One of hourly, daily, or twice-daily. If not specified, the card will attempt to use the finest-grained data available.
name string Optional Card name (set to null to hide) Hourly Weather
icons bool Optional Whether to show icons instead of text labels false
show_current bool Optional Whether to prepend the weather entity's current condition and temperature as the first segment false
auto_label_spacing bool Optional Increase label spacing automatically when the card becomes too narrow, while preserving the configured label_spacing as the minimum false
icon_map [Icon map][icon_map] Optional Custom icons to use for the weather conditions. Uses mdi icons by default.
num_segments number Optional Number of forecast segments to show (integer >= 1) 12
num_hours number Optional Deprecated: Use num_segments instead 12
offset number Optional Number of forecast segments to offset from start 0
label_spacing number Optional Number of forecast segments represented by each displayed label (integer >= 1) 2
colors [object][color] Optional Set colors for all or some conditions
hide_hours bool Optional Whether to hide hour labels under the bar false
hide_minutes bool Optional Whether to show hours without minutes under the bar (display only "17" instead of "17:00") false
hide_temperatures bool Optional Whether to hide temperatures under the bar false
round_temperatures bool Optional Whether to round temperatures to the nearest whole number false
hide_bar bool Optional Whether to hide the bar itself false
icon_fill [Icon Fill][icon_fill] Optional Whether to repeat the icon inside the bar 'single
show_wind [Wind][wind] Optional Whether to show wind speed and/or direction under the bar 'false'
show_precipitation_amounts bool Optional Whether to show the aggregated precipitation (rain) amount for each displayed label interval under the bar false
show_precipitation_probability bool Optional Whether to show the combined precipitation probability for each displayed label interval under the bar false
show_date [string][dates] Optional Whether to show date under the bar 'false'
tap_action [object][action] Optional Action to take on tap action: more-info
hold_action [object][action] Optional Action to take on hold none
double_tap_action [object][action] Optional Action to take on double tap none
language string Optional Language to use for card (overrides HA & user settings)

Note that some of the more advanced options are not available in the card editor UI and must be configured via YAML.

Precipitation and label spacing

When precipitation amounts or probabilities are enabled, their values represent the forecast segments covered by each displayed label.

For example, with label_spacing: 2, the precipitation label at the first segment summarizes segments 1-2, the next label summarizes segments 3-4, and so on. Precipitation amounts are summed. Precipitation probabilities are combined as the probability that precipitation occurs during at least one segment in that interval:

$$ P(\text{precipitation}) = 1 - \prod_{i=1}^{n} (1 - p_i) $$

where $p_i$ is the precipitation probability of each segment expressed as a value from 0 to 1. The displayed result is rounded to the nearest whole percentage.

If the final label interval contains fewer segments than label_spacing, it summarizes the remaining segment or segments.

Current weather segment

Set show_current: true to prepend the weather entity's current condition and temperature to the forecast. num_segments still controls the total number of segments displayed, including the current segment. If the entity does not expose a valid current condition and temperature, the card safely falls back to the forecast alone. When the weather entity does not expose current precipitation, the current segment uses amount and probability from the ongoing hourly forecast interval without combining them with future intervals. label_spacing restarts at the first future segment, and the already-started forecast interval is omitted from the remaining timeline so it is not duplicated.

The current segment is labeled "Now" (translated to the configured language). Hover over the label to see the weather entity's update time in a native browser tooltip, including minutes even when hide_minutes is enabled.

Templating

The following options allow Home Assistant Jinja templates as values:

  • name
  • num_segments
  • offset
  • label_spacing

You may use any valid template expression that produces a string or number. For example, you can define offset based on the

Issues· 29 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptcardcustom-cardshacktoberfesthacs

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言