-
Notifications
You must be signed in to change notification settings - Fork 4
General Download Interface (English)
With the general download interface you can download files from every provider who offers an API. There is no restriction to specific institutions. Nevertheless, special options are available for some providers to make configuration easier.
You can download files to process them further during skin creation. It depends on the provider whether you have to register with them or do other things in order to use their API before.
The setup is located in section [WeatherServices]
, sub-section [download]
. There you can set up as many download as you wish.
[WeatherServices]
# path to the directory to save the files there
path='/etc/weewx/skins/SKINNAME/SUBDIRECTORY'
...
[[download]]
# general download interface to download maps and forecasts and
# other files
[[[Download1]]]
# what to download
url = "https://www.example.com/pfad/datei"
# file name to save to
file = "filename.ext"
# what encoding the original file is in
# optional
#from_encoding = iso8859-1
# what encoding is to used to save the file
# optional
#to_encoding = html_entities
# authentication (optional)
#auth_method = basic # or digest
#username = replace_me
#password = replace_me
[[[Download2]]]
...
The following keys can be used:
-
url
: complete URL to retrieve data from (mandatory) -
file
: name of the file on disk -
from_encoding
: in case of text data, the encoding the data is provided in (optional, default iso8859-1) -
to_encoding
: in case of text data, the encoding the data are to be converted to (optional, defaulthtml_entities
) -
auth_method
: authentication method, if any, optional, valuesbasic
ordigest
-
username
: user name, if any, optional -
password
: password, if any, optional
The files are downloaded, converted (if required) and saved to the directory specified in path
. This happens right before the end of the archive interval. So the files are available when the report generation starts.
How to include the downloaded files into skins depends on their type.
Text files:
#include raw "SUBDIRECTORY/filename.ext"
Image files:
<img src="$relative_url/SUBDIRECTORY/filename.ext" ... />
There are special configuration options for several protocols and providers. You can use them for easier configuration.
- Query Open Geospatial Consortium (OGC) Servers (especially maps)
- Open-Meteo (forecasts from several providers)
- OpenWeather (actual calculated weather values and forecasts)
- precipitation radar (precipitation radar of Germany, Luxembourg, and western Austria)