National Weather Service (NWS)

The nws platform uses the National Weather Service web API as a source for meteorological data for your location.

Configuration

To add the National Weather Service (NWS) integration to your Home Assistant instance, use this My button:

Manual configuration steps

If the above My button doesn’t work, you can also perform the following steps manually:

  • Browse to your Home Assistant instance.

  • Go to Settings > Devices & Services.

  • In the bottom right corner, select the Add Integration button.

  • From the list, select National Weather Service (NWS).

  • Follow the instructions on screen to complete the setup.

According to the API documentation, a string is required for the API key, and an email address is suggested to be included within the string.

Providing a METAR station code is optional, and if not supplied, the closest station to the latitude and longitude will be chosen. A list of nearby stations is printed to the log with level DEBUG if no station is supplied. Stations can also be found on the NOAA website. Codes with only three characters, for example, ADW should be prefixed with the letter K, KADW.

One weather entity is created for each entry in the configuration. Hourly and day/night forecasts are provided through the weather.get_forecasts action. The time supplied for each forecast is the start time for the forecast. Sensors are also created as disabled entities after configuration and can be enabled by the user.

Action nws.get_forecasts_extra

nws.get_forecasts_extra provides extra data in a form similar to weather.get_forecasts. See weather.get_forecasts documentation.

Data attribute Optional Description Example
type no The type of forecast, must be either twice_daily or hourly. twice_daily
action: nws.get_forecasts_extra
target:
  entity_id:
    - weather.khou
data:
  type: twice_daily
response_variable: weather_forecast

The response data field is a mapping of called target entities, each containing the forecast field. forecast is a list of forecasted conditions at a given point in time that are not returned from weather.get_forecasts. The datetime and is_daytime attributes are still provided for context.

Response data Description Example
datetime The time of the forecasted conditions. 2023-02-17T14:00:00+00:00
is_daytime Only set for twice_daily forecasts. True
detailed_description Only set for twice_daily forecasts. 50% Chance of rain, otherwise partly cloudy with a high of 75F.
short_description Short weather condition Partly Sunny then Slight Chance Showers And Thunderstorms

Details

Details about the API are available in the NWS API documentation. The pynws library is used to retrieve data.