February 20, 2022

WeatherLink weather template, v2 API

I have written a post with the same subject before, also using NodeRed(NR), but this post is using the latest WeatherLink v2 API instead of the v1 API

The v2 API supports more devices and now also including the old ones.

If You want a more advanced weather site this is a very nice one coded in PHP also using the v2 API.

Intro
As said, the application is made with NodeRed and here is a link to a quick intro.

In my case NR is installed on a Raspberry Pi but it could be installed on several other hardware platforms.

Install the "node-red-dashboardnode which is used for the GUI part.

Please note that the function nodes, that creates the URL to access WL, are using an external "crypto" module which is used to create the API signature. Please check the manual so its set up correct. This setup can also be done via "node-red admin init". Check the link to the NR intro.

To access weather data from WeatherLink(WL) you have to get an API key and an API Secret. These are retrieved from the DWL site after You logged on.


Install
After the flow is downloaded you have to update the fields "apiKey" and "apiSecret", with your data. These fields are found in the function node labeled "Set API Key/Secret & create URL to Get Station".

After the deploy of the flow the inject node "Flow Init" will access the WL site and get the "station_id". This id is then stored and after some seconds the inject node "Inject" will request the weather data for the station. If you have more than one station you will have to modify the the flow !!

In the "Get input" part the http request is sent, once every minute to retrieve data.

In the "Calculation" part, different data are picked up and processed with "function" or "change" nodes.

In the 3 "Column_x" parts, the data are displayed via "text", "chart" and "gauge"nodes.

Via the "inject" node "Reset Charts" all the charts will be cleared

The GUI URL is http://yourhost:1880/ui/

If You want to port the application to the WEB You must add security.

Remarks
WL accounts
Please note that with the this, v2 API, you will just get weather data, with a free account, every 15 minutes.

Rate Limits
Doing tests it's possible that you exceed the rate limits of 300 API calls per hour, which will make that the weather data not will be updated.

No comments:

Post a Comment

Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !