Sign inSign up

entmike/openweathermap-datacollector

By entmike

•Updated almost 6 years ago

Collect data from Open Weather Map and store in PostrgreSQL DB

Image
0

230

entmike/openweathermap-datacollector repository overview

⁠openweathermap-datacollector

Collect data from Open Weather Map and store in PostrgreSQL DB

GitHub issues Docker Pulls Automated Build

Pull weather data from NOAA and populate a PostgreSQL DB table

⁠Try it Now with Docker

If you don't care about local development and just want to run it, see the example below.

⁠Pre-requisites:

  1. Docker Installed
  2. PostgreSQL Installed somewhere (physical host, VM, Docker, whatever) with a new DB created (i.e. hubitat)
  3. OpenWeatherMap API Key⁠
  4. 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
);

⁠Example:

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:

VariableDescriptionDefault Value
PGHOSTPostgreSQL HostEmpty
PGPORTPostgreSQL Port5432
PGDATABASEPostgreSQL Database NameEmpty
PGUSERPostgreSQL UserEmpty
PGPASSWORDPostgreSQL PasswordEmpty
INTERVALOpenWeatherMap Refresh Interval (seconds)300
LATITUDELatitude of where you want forecast40.70098574912939
LONGITUDELongitude of where you want forecast-73.9837906003035
APIKEYYour OpenWeatherMap API KeyEmpty

In psql or whatever PostgreSQL client you use, connect to the database and look at the forecast table for updates.

Tag summary

Content type

Image

Digest

Size

66.6 MB

Last updated

almost 6 years ago

docker pull entmike/openweathermap-datacollector