Collect data from Open Weather Map and store in PostrgreSQL DB
230
Collect data from Open Weather Map and store in PostrgreSQL DB
Pull weather data from NOAA and populate a PostgreSQL DB table
If you don't care about local development and just want to run it, see the example below.
hubitat)temp table created in PostgreSQL DB. Create statement for your convenience:CREATE TABLE temp (
temp double precision,
feels_like double precision,
temp_min double precision,
temp_max double precision,
pressure double precision,
humidity double precision,
timestamp timestamp without time zone DEFAULT now(),
units character varying(25),
latitude double precision,
longitude double precision
);
docker run --rm -ti \
-e PGHOST=yourpostgreshost -e PGPORT=5432 -e PGDATABASE=hubitat -e PGUSER=postgres -e PGPASSWORD=YourPassword \
-e INTERVAL=300 -e LONGITUDE=-73.9837906003035 -e APIKEY=youropenweathermapapikey entmike/openweathermap-datacollector
Environment Variables:
| Variable | Description | Default Value |
|---|---|---|
PGHOST | PostgreSQL Host | Empty |
PGPORT | PostgreSQL Port | 5432 |
PGDATABASE | PostgreSQL Database Name | Empty |
PGUSER | PostgreSQL User | Empty |
PGPASSWORD | PostgreSQL Password | Empty |
INTERVAL | OpenWeatherMap Refresh Interval (seconds) | 300 |
LATITUDE | Latitude of where you want forecast | 40.70098574912939 |
LONGITUDE | Longitude of where you want forecast | -73.9837906003035 |
APIKEY | Your OpenWeatherMap API Key | Empty |
In psql or whatever PostgreSQL client you use, connect to the database and look at the forecast table for updates.
Content type
Image
Digest
Size
66.6 MB
Last updated
almost 6 years ago
docker pull entmike/openweathermap-datacollector