Template Weather Provider

The template integrations creates weather provider that combines integrations and an existing weather provider into a fused weather provider.

There are several powerful ways to use this integration集成将 Home Assistant 与您的设备、服务等连接和集成。 [Learn more], including localizing your weather provider information with local information from temperature, humidity, pressure sensors that you own.

Another use case could be using temperature and humidity from one weather platform, with forecasts from a different one.

Output will be converted according to the user’s unit system or entity实体表示 Home Assistant 中的传感器、执行器或功能。实体用于监控物理属性或控制其他实体。实体通常是设备或服务的一部分。 [Learn more] override, see documentation.

Configuration

To enable a Template Weather provider in your installation, add the following to your configuration.yamlconfiguration.yaml 文件是 Home Assistant 的主要配置文件。它列出了要加载的集成及其特定配置。在某些情况下,需要直接在 configuration.yaml 文件中手动编辑配置。大多数集成可以在 UI 中配置。 [Learn more] file:

(Note, be sure to update my_region in the condition and forecast templates to an appropriate value for your setup).

# Example configuration.yaml entry
weather:
  - platform: template
    name: "My Weather Station"
    condition_template: "{{ states('weather.my_region') }}"
    temperature_template: "{{ states('sensor.temperature') | float }}"
    temperature_unit: "°C"
    humidity_template: "{{ states('sensor.humidity') | float }}"
    forecast_daily_template: "{{ state_attr('weather.my_region', 'forecast_data') }}"

Configuration Variables

name template Required

Name to use in the frontend.

unique_id string (Optional)

An ID that uniquely identifies this weather entity. Set this to a unique value to allow customization through the UI.

condition_template template Required

The current weather condition.

temperature_template template Required

The current temperature.

dew_point_template template (Optional)

The current dew point.

apparent_temperature_template template (Optional)

The current apparent (feels-like) temperature.

temperature_unit string (Optional)

Unit for temperature_template output. Valid options are °C, °F, and K.

humidity_template template Required

The current humidity.

attribution_template string (Optional)

The attribution to be shown in the frontend.

pressure_template template (Optional)

The current air pressure.

pressure_unit string (Optional)

Unit for pressure_template output. Valid options are Pa, hPa, kPa, bar, cbar, mbar, mmHg, inHg, psi.

wind_speed_template template (Optional)

The current wind speed.

wind_gust_speed_template template (Optional)

The current wind gust speed.

wind_speed_unit string (Optional)

Unit for wind_speed_template output. Valid options are m/s, km/h, mph, mm/d, in/d, and in/h.

wind_bearing_template template (Optional)

The current wind bearing.

ozone_template template (Optional)

The current ozone level.

cloud_coverage_template template (Optional)

The current cloud coverage.

visibility_template template (Optional)

The current visibility.

visibility_unit string (Optional)

Unit for visibility_template output. Valid options are km, mi, ft, m, cm, mm, in, yd.

forecast_daily_template template (Optional)

Daily forecast data.

forecast_hourly_template template (Optional)

Hourly forecast data.

forecast_twice_daily_template template (Optional)

Twice daily forecast data.

precipitation_unit string (Optional)

Unit for precipitation output. Valid options are km, mi, ft, m, cm, mm, in, yd.

Template variables

State-based template entities have the special template variable this available in their templates. The this variable aids self-referencing of an entity实体表示 Home Assistant 中的传感器、执行器或功能。实体用于监控物理属性或控制其他实体。实体通常是设备或服务的一部分。 [Learn more]’s state and attribute in templates.