ZOYKU火線榜

jaydeethree/Home-Assistant-weatherdotcom技術文件

jaydeethree/Home-Assistant-weatherdotcom open-source repository on GitHub

多語言回退提示:當前倉庫原作者暫未發布在地化文件,已為您無縫切換至官方英文原版(English),排版及程式碼實例完整保真。
極速安裝
git clone https://github.com/jaydeethree/Home-Assistant-weatherdotcom.git

Home-Assistant-Weather.com

Home Assistant custom integration for Weather.com. Includes a native Home Assistant Weather Entity and a variety of weather sensors.

This is a fork of the excellent wundergroundpws integration by @cytech - if you find this software useful, feel free to make a donation to them.

AI Disclosure

Starting in October 2026 I will begin using AI to help me maintain my open-source projects. I know a lot of people have strong feelings about AI so I want to be open about this decision and why I made it.

Over the last few years I've watched AI models mature significantly - while early models were mostly just slop generators, the current models are genuinely very good. I've spent decades working in tech and building up my skills, but at this point the current models are often better at my job than I am (not hyperbole - I'm serious). I have a lot of feelings about the fact that a skillset I've spent so much time on is rapidly losing its value, but this is reality now.

I've been using AI in my job for awhile and have found that while human oversight is still important, the current models can handle most of the tedious work and then I can make adjustments as necessary. I've also found it difficult to keep up with my open-source projects due to other life demands (parenting, my job, and so much more) and AI can help take some of the load off of me.

To be very clear: any AI-generated code that gets committed to my open-source projects will be thoroughly reviewed by me, a human. I'm not vibe-coding or letting AIs run wild in my repositories, I'm using AI as a tool to help me work more efficiently. If you disagree with this you are always welcome to fork my projects and build non-AI versions of them.

Also for what it's worth: 100% of this disclosure was written by a human without any AI involvement :)

Installation Prerequisites

Please review the minimum requirements below to determine whether you will be able to install and use the software.

  • This integration requires a recent version of Home Assistant
  • A Weather.com API Key is required (see below for how to get this)

Weather.com API Key

  1. Open Developer Tools in your browser (this is typically done by pressing F12) and open the "Network" tab.
  2. Open https://www.wunderground.com (Wunderground is owned by Weather.com and uses some of the Weather.com APIs)
  3. Enter /v3 in the search bar:

Developer Tools Screenshot

  1. Click on any entry in the list, go to the Headers tab, and get the API key from there:

Developer Tools Screenshot

Important notes:

  • It seems like Wunderground may provide different API keys depending on which country you are located in, and that the API keys for some countries may not be compatible with this integration. This integration has only been tested with the US API key ending in f7eaa8 - if your API key isn't working, you may need to connect to a US VPN to retrieve the US API key.
  • It also seems like Weather.com blocks traffic from certain countries. If this integration does not work for you, make sure that you can access Weather.com in your browser.
  • Wunderground PWS (Personal Weather Station) API Keys will not work for this integration, as they do not have access to the Weather.com APIs that this integration uses.

Installation

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

This integration is available in HACS, so just install it from there and then:

  1. In Home Assistant Settings, select DEVICES & SERVICES, then ADD INTEGRATION.
  2. Select the "Weather.com" integration.
  3. Enter your Weather.com API key and submit.

When choosing your location you have the option to use either a fixed latitude/longitude or to follow the location of a device, person, or zone.

Sensors Created By This Integration

The following Weather.com data is available in the weather.<LOCATION_NAME> entity:

Current conditions:

  • Condition (icon / state)
  • Temperature
  • Apparent temperature (feels like)
  • Dew point
  • Barometric pressure
  • Relative humidity
  • Wind speed
  • Wind bearing (degrees)
  • Wind gust speed
  • Visibility
  • UV index

Forecasts (Daily, Twice-Daily, and Hourly):

  • Daily: Date/time, condition, temperature (high), temperature (low), precipitation quantity, precipitation probability, wind speed, wind bearing, relative humidity, cloud coverage, and UV index
  • Twice-Daily: Date/time, daytime indicator, condition, temperature, precipitation quantity, precipitation probability, wind speed, wind bearing, relative humidity, cloud coverage, and UV index
  • Hourly: Date/time, condition, temperature, apparent temperature, dew point, precipitation quantity, precipitation probability, wind speed, wind gust speed, wind bearing, relative humidity, cloud coverage, and UV index

To access these values in automations, scripts, etc. you will need to create triggered template sensors for them. This post on the Home Assistant forums provides details about how to do that.

In addition to the Weather entity, these additional sensors will be created by this integration:

  • sensor.<LOCATION_NAME>_cloud_ceiling - distance to the lowest cloud layer, or unknown if there are no clouds
  • sensor.<LOCATION_NAME>_cloud_cover_phrase - a description of the current cloud cover, e.g. "Clear" or "Mostly Cloudy"
  • sensor.<LOCATION_NAME>_dewpoint - the current dew point
  • sensor.<LOCATION_NAME>_heat_index - the current heat index, which is what the current temperature "feels like" when combined with the current humidity
  • sensor.<LOCATION_NAME>_latitude - the latitude that is configured for this location
  • sensor.<LOCATION_NAME>_local_observation_time - the time that the Weather.com data was generated
  • sensor.<LOCATION_NAME>_longitude - the longitude that is configured for this location
  • sensor.<LOCATION_NAME>_precipitation_last_hour - the quantity of precipitation in the last hour
  • sensor.<LOCATION_NAME>_precipitation_last_6_hours - the quantity of precipitation in the last 6 hours
  • sensor.<LOCATION_NAME>_precipitation_last_24_hours - the quantity of precipitation in the last 24 hours
  • sensor.<LOCATION_NAME>_pressure - the current barometric pressure
  • sensor.<LOCATION_NAME>_pressure_tendency_trend - the current trend for barometric pressure, e.g. "Rising" or "Falling"
  • sensor.<LOCATION_NAME>_relative_humidity - the current relative humidity
  • sensor.<LOCATION_NAME>_temperature - the current temperature
  • sensor.<LOCATION_NAME>_temperature_feels_like - what the current temperature "feels like" when combined with the current heat index and wind chill
  • sensor.<LOCATION_NAME>_uv_index - the current UV index, ranging from 0 (very low) to 16 (extreme)
  • sensor.<LOCATION_NAME>_weather_description - the current weather description, e.g. "Freezing Rain" or "Scattered Showers"
  • sensor.<LOCATION_NAME>_wind_chill - the current wind chill, which is what the current temperature "feels like" when combined with the current wind
  • sensor.<LOCATION_NAME>_wind_direction_cardinal - the current cardinal wind direction, e.g. "NW" (or "CALM" if there is no wind)
  • sensor.<LOCATION_NAME>_wind_direction_degrees - the current wind direction in degrees, or unknown if there is no wind
  • sensor.<LOCATION_NAME>_wind_gust - the current wind gust speed, or unknown if there are no gusts
  • sensor.<LOCATION_NAME>_wind_speed - the current wind speed

All of the data listed above will be updated every 20 minutes.

Additional details about the APIs used by this integration are available through these links:

Localization

Localization is handled in two ways:

  1. Entity Names: Sensor and weather entity names in the Home Assistant UI are automatically translated by Home Assistant based on the language selected in your user profile (User Profile -> Language).
  2. Weather.com API Phrases: The Language setting chosen during integration setup (or via Configure / Reconfigure) determines the language code sent to the Weather.com API. This localizes textual weather data returned by the API, such as weather descriptions, daily narratives, moon phases, and wind phrases. Home Assistant will automatically suggest the best matching language code based on your system language and country settings.

Available Weather.com API language codes:

'am-ET', 'ar-AE', 'az-AZ', 'bg-BG', 'bn-BD', 'bn-IN', 'bs-BA', 'ca-ES', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU',
'en-CA', 'en-GB', 'en-IN', 'en-US', 'es-AR', 'es-ES', 'es-LA', 'es-MX', 'es-UN', 'es-US', 'et-EE', 'fa-IR', 'fi-FI',
'fr-CA', 'fr-FR', 'gu-IN', 'he-IL', 'hi-IN', 'hr-HR', 'hu-HU', 'id-ID', 'is-IS', 'it-IT', 'iw-IL', 'ja-JP', 'jv-ID',
'ka-GE', 'kk-KZ', 'km-KH', 'kn-IN', 'ko-KR', 'lo-LA', 'lt-LT', 'lv-LV', 'mk-MK', 'mn-MN', 'mr-IN', 'ms-MY', 'my-MM',
'ne-IN', 'ne-NP', 'nl-NL', 'no-NO', 'om-ET', 'pa-IN', 'pa-PK', 'pl-PL', 'pt-BR', 'pt-PT', 'ro-RO', 'ru-RU', 'si-LK',
'sk-SK', 'sl-SI', 'sq-AL', 'sr-BA', 'sr-ME', 'sr-RS', 'sv-SE', 'sw-KE', 'ta-IN', 'ta-LK', 'te-IN', 'tg-TJ', 'th-TH',
'ti-ER', 'ti-ET', 'tk-TM', 'tl-PH', 'tr-TR', 'uk-UA', 'ur-PK', 'uz-UZ', 'vi-VN', 'zh-CN', 'zh-HK', 'zh-TW'

Advanced Configuration (Forecast Details)

The integration exposes forecast data as attributes of a disabled-by-default sensor, Forecast Details. The benefits of this are:

  1. Provides access to non-conforming data available from the weather.com API that is not available through the <weather.get_forecasts> method.
  2. Reduces the need to manually configure sensors or template sensors to access this data.

The extra forecast attributes on sensor.<LOCATION_NAME>_forecast_details are automatically excluded from the Home Assistant recorder to prevent database bloat.

Attribute Options

Daily forecast options

Daily options are native API forecast values that return a 15-item array:

day, daily_temp_max, daily_temp_min, daily_precip_qpf, daily_rain_qpf, daily_snow_qpf, daily_ice_qpf, daily_narrative, sunrise, sunset, moon_phase, moon_phase_code, moon_phase_day, moonrise, moonset.

Day forecast options

Day options are synthetic forecast values that return a 15-item array. Data is derived from the corresponding day values in the daypart array. When the current day's daytime value is unavailable, the nighttime value is used:

day_icon_code, day_cloud_cover, day_relative_humidity.

Daypart forecast options

Daypart options are native API forecast values that return a 30-item array, with two items per day: one daytime value and one nighttime value:

daypart_cloud_cover, daypart_name, daypart_icon_code, daypart_precip_chance, daypart_precip_type, daypart_total_qpf, daypart_rain_qpf, daypart_snow_qpf, daypart_ice_qpf, daypart_snow_range, daypart_relative_humidity, daypart_heat_index, daypart_wind_chill, daypart_thunder_category, daypart_thunder_index, daypart_uv_description, daypart_uv_index, daypart_wind_dir, daypart_wind_dir_cardinal, daypart_wind_speed, daypart_wind_phrase, daypart_wx_phrase_long, daypart_wx_phrase_short, daypart_qualifier_phrase, daypart_narrative.

Usage

Navigate to the Weather.com integration page and select the gear icon (Configure) for the integration entry. Select the desired forecast attributes and click Submit. Selecting any attributes will automatically enable sensor.<LOCATION_NAME>_forecast_details and add the selected attributes to it.

Accessing Forecast Attributes

The forecast attributes can be accessed by Home Assistant templates and by dashboard cards that support Jinja or JavaScript templates.

Common uses include:

  • Template sensors — expose a specific forecast value as a separate sensor.
  • Automations and scripts — use forecast values as conditions or actions.
  • Markdown Card — display forecast information directly on a dashboard.
  • Button Card — dynamically display selected forecast values using JavaScript.
  • Other custom cards — any card that can access entity attributes can use the forecast data.

The array index corresponds to the forecast period. For daily attributes, [0] is the current day. For daypart attributes, [0] is the first daytime period and [1] is the first nighttime period.

JavaScript example for first value

states['sensor.<LOCATION_NAME>_forecast_details'].attributes.<YOUR_ATTRIBUTE>[0]

Jinja example for first value

{{ state_attr('sensor.<LOCATION_NAME>_forecast_details', '<YOUR_ATTRIBUTE>')[0] }}

文件鏡像歸檔自 GitHub 官方源路徑 · 造訪原專案 GitHub
最後同步快照:2026-11-08