US National Weather Service Weather Sampler
The NWS Weather plugin brings live weather data into InfluxDB 3 for demos, testing, and simulation, without API keys or custom integrations. It helps teams stand up realistic time series workflows fast with less setup.
Configuration
Plugin parameters may be specified as key-value pairs in the --trigger-arguments flag (CLI) or in the trigger_arguments field (API) when creating a trigger.
If a plugin supports multiple trigger specifications, some parameters may depend on the trigger specification that you use.
Plugin metadata
This plugin includes a JSON metadata schema in its docstring that defines supported trigger types and configuration parameters. This metadata enables the InfluxDB 3 Explorer UI to display and configure the plugin.
Required parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
stations |
string | KSEA.KORD.KJFK.KDEN.KATL.KDFW.KLAX.KMIA.KPHX.KBOS | Dot-separated list of NWS station IDs |
Optional parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
measurement |
string | weather_observations | Destination measurement for weather data |
user_agent |
string | InfluxDB3-NWS-Plugin/1.0 | Custom User-Agent header for NWS API requests |
use_data_timestamp |
boolean | true | Use timestamp from weather observation data instead of current time when writing data |
Note: Station IDs are separated by dots (.) in trigger arguments. Example: stations=KSEA.KSFO.KLAX
Examples
Example 1: Basic weather data collection
Collect weather data from multiple stations every 5 minutes:
# Create the trigger
influxdb3 create trigger \
--database weather_demo \
--path "gh:influxdata/nws_weather/nws_weather_sampler.py" \
--trigger-spec "every:5m" \
--trigger-arguments "stations=KSEA.KSFO.KORD" \
nws_basic_weather
# Enable the trigger
influxdb3 enable trigger --database weather_demo nws_basic_weather
# Query weather data (after a few minutes)
influxdb3 query \
--database weather_demo \
"SELECT station_id, temperature_c, relative_humidity_percent, time FROM weather_observations ORDER BY time DESC LIMIT 10"
Expected output
| station_id | temperature_c | relative_humidity_percent | time |
|---|---|---|---|
| KSEA | 15.6 | 72.0 | 2025-11-26T10:00:00Z |
| KSFO | 18.3 | 65.0 | 2025-11-26T10:00:00Z |
| KORD | 12.2 | 68.0 | 2025-11-26T10:00:00Z |
Example 2: Custom measurement name and user agent
# Create trigger with custom configuration
influxdb3 create trigger \
--database weather_demo \
--path "gh:influxdata/nws_weather/nws_weather_sampler.py" \
--trigger-spec "every:10m" \
--trigger-arguments "stations=KJFK.KATL.KDFW,measurement=us_weather,user_agent=MyDemo/1.0" \
nws_custom_weather
Example 3: Using current time instead of API observation timestamp
By default (use_data_timestamp=true), the plugin uses the timestamp from the weather observation data provided by the NWS API. However, since api.weather.gov may not update data regularly, this can lead to scenarios where no new records are written:
Scenario example: - Weather station updates data every 10 minutes - Plugin runs every 3 minutes - First run: New record written (timestamp from API: 4:10 PM) - Second run (3 min later): No new record (API still returns data timestamped 4:10 PM - a duplicate that will overwrite the existing record) - Third run (6 min later): No new record (API still returns data timestamped 4:10 PM - a duplicate that will overwrite the existing record) - Fourth run (9 min later): New record written (timestamp from API: 4:20 PM)
To ensure data is written on every plugin execution (useful for demos or populating tables with regular data), set use_data_timestamp=false:
# Create trigger that writes data on every execution using current time
influxdb3 create trigger \
--database weather_demo \
--path "gh:influxdata/nws_weather/nws_weather_sampler.py" \
--trigger-spec "every:3m" \
--trigger-arguments "stations=KSEA.KSFO,use_data_timestamp=false" \
nws_current_time
Note: The NWS API data is typically delayed. For example: - Request at 4:30 PM → Returns data timestamped 4:10 PM - Request at 4:37 PM → Returns data timestamped 4:25 PM
Ready to get started?
Download InfluxDB 3 and have running in minutes.