Home Assistant 的每小时天气卡。将即将到来的天气条件呈现为彩色横条。
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]
✨ Install via HACS
hourly-weather.js from the [Releases][releases] page/www/hourly-weather/hourly-weather.js (via Samba, File Editor, SSH, etc.)/hourly-weather/hourly-weather.js as a
JavaScript Module.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:
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"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.
| 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.
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.
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.
The following options allow Home Assistant Jinja templates as values:
namenum_segmentsoffsetlabel_spacingYou may use any valid template expression that produces a string or number. For example, you can define offset based on the
暂无开放 Issues,或尚未同步最近议题。