-
Notifications
You must be signed in to change notification settings - Fork 1
Module thc_OpenWeatherMap
The thc_OpenWeatherMap module implements THC devices that get data from the OpenWeatherMap site. A registration is required to use the OpenWeatherMap service. The API key obtained during the registration process needs to be declared with the thc::OpenWeatherMap::Configure command.
To get weather data you need first to know a location recognized by OpenWeatherMap. The location can either be defined via the city name, the city ID or by the geographic coordinates. Validate the location on the OpenWeatherMap website: <http://www.openweathermap.org/find?q=x>
The following current weather parameters are available :
- sunrise - Sunrise time, decimal, UTC
- sunset - Sunset time, decimal, UTC
- temp - Temperature, Celsius
- humidity - Humidity, %
- pressure - Atmospheric pressure (on the sea level)
- speed - Wind speed, km/h
- dir - Wind direction, degrees (meteorological)
The definition of an OpenWeatherMap devices requires the declaration of the 'get' command, using the following syntax:
{thc_OpenWeatherMap {<Location> <WeatherParameter>}}
thc::OpenWeatherMap::Configure \
-api_key 1234567890abcd
thc::DefineDevice Bern,temp \
-name Bern -group Environment -format "%sC" -range {-30 50} -update 10m \
-get {thc_OpenWeatherMap {"Bern,ch" "temp"}}
Configures the OpenWeatherMap access.
Parameters | Description |
---|---|
[-api_key <API_Key>] | OpenWeatherMap API Key. |
-
thc::OpenWeatherMap::Configure \
-api_key 1234567890abcd
THC, Tight Home Control - See THC index register - THC repository on github.com/Drolla/thc