NWS


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

Configuration

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.

To add NWS to your installation using the closest station, add the following to your configuration.yaml file:

# Example configuration.yaml entry
weather:
  - platform: nws
    api_key: YOUR_API_KEY

To specify a station, for example, KADW (Andrews Air Force Base), use the following:

# Example configuration.yaml entry
weather:
  - platform: nws
    api_key: YOUR_API_KEY
    station: KADW

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.

The default forecast is day and night, mode: daynight, while mode: hourly gives the forecast hourly. The forecast is obtained from the latitude and longitude value, not the station.

Configuration Variables

api_key

(string)(Required)

Your API key. Any string, but an email address is suggested to be included.

latitude

(float)(Optional)

Manually specify latitude. By default, the value will be taken from the Home Assistant configuration.

Default value:

Provided by Home Assistant configuration.

longitude

(float)(Optional)

Manually specify longitude. By default, the value will be taken from the Home Assistant configuration.

Default value:

Provided by Home Assistant configuration.

name

(string)(Optional)

Name to use in the frontend.

Default value:

Station name.

mode

(string)(Optional)

The forecast type. Can be daynight or hourly.

Default value:

daynight

station

(string)(Optional)

METAR station code.

Default value:

Closest station to latitude and longitude as returned by NWS API.

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