# Sustainable Weather API

**URL:** <https://discourse.nodered.org/t/sustainable-weather-api/24095>\
**Category:** General\
**Created:** [2 April 2020 12:29 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095 "2020-04-02T12:29:28Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [24 June 2020 15:13 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/21 "2020-06-24T15:13:24Z")

</div>

Yes, I agree - it was a bit of a faff (compared with OpenWeatherMap - which is very easy to set-up).

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [24 June 2020 15:22 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/22 "2020-06-24T15:22:57Z")

</div>

Another issue is that the "forecast" is based on their last model run and not on the current time. So you need to search through the result array to find the most appropriate entries.

Also, no current data, only model forecast.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [24 June 2020 15:33 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/23 "2020-06-24T15:33:12Z")

</div>

> [@TotallyInformation](#):
>
> Also, no current data, only model forecast

I used the met office api a few years ago, but abandoned it because of the absence of current data. So nothing has changed... 💩

---

<div class="post-metadata">

**Author:** ![molesworth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/molesworth/32/11748_2.png) [@molesworth](https://discourse.nodered.org/u/molesworth)\
**Post date:** [24 June 2020 21:10 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/24 "2020-06-24T21:10:10Z")

</div>

I suppose it depends on your use-case. I was interested in forecast information, so it met my needs for that. For current data, I could look out of the window 😜

Weather info and forecasts are now back on the list of goodies to add to my system.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [24 June 2020 23:54 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/25 "2020-06-24T23:54:45Z")

</div>

> [@molesworth](#):
>
> I could look out of the window

Though that wont tell you the humidity, wind speed and exact direction, ...

---

<div class="post-metadata">

**Author:** ![molesworth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/molesworth/32/11748_2.png) [@molesworth](https://discourse.nodered.org/u/molesworth)\
**Post date:** [25 June 2020 07:44 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/26 "2020-06-25T07:44:47Z")

</div>

> [@TotallyInformation](#):
>
> Though that wont tell you the humidity, wind speed and exact direction, ...

Very true, but again it comes down to use-cases. I wanted forecasts for the day for being out on a boat, and it takes about an hour to get to the harbour, get prepped and out on the water, so the immediate local conditions aren't as important.

If there was an API for the shipping and inshore forecasts that would be really useful, but so far the Met Office haven't provided one.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [25 June 2020 08:20 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/27 "2020-06-25T08:20:31Z")

</div>

Surely you just subscribe to [https://www.bbc.co.uk/programmes/b006qfvv/episodes/player](https://www.bbc.co.uk/programmes/b006qfvv/episodes/player) and listen to it in the car ? Much nicer that all this tech imho 🙂

---

<div class="post-metadata">

**Author:** ![moorer](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@moorer](https://discourse.nodered.org/u/moorer)\
**Post date:** [25 June 2020 09:42 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/28 "2020-06-25T09:42:13Z")

</div>

Hi Craig,  
Interesting flow, could you tell me a bit more about how to specify the requested location please

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [25 June 2020 13:35 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/29 "2020-06-25T13:35:01Z")

</div>

The MetOffice API includes visibility and wind data which would be useful for the harbour conditions.

Some additional options (not tried):

- [https://www.worldweatheronline.com/developer/api/marine-weather-api.aspx](https://www.worldweatheronline.com/developer/api/marine-weather-api.aspx)
- [https://docs.stormglass.io/#/](https://docs.stormglass.io/#/) (includes tides at least) - says that it includes MetOffice data: Global currents, water temperature, sea level and salinity - "High resolution data for currents and waves in North West Shelf"
- [https://www.admiralty.co.uk/digital-services/data-solutions/uk-tidal-api](https://www.admiralty.co.uk/digital-services/data-solutions/uk-tidal-api)
- MetOffice have some other, fairly well hidden & unsupported API's - [https://www.metoffice.gov.uk/services/data/datapoint](https://www.metoffice.gov.uk/services/data/datapoint)
- Norway's met office - [https://api.met.no/weatherapi/oceanforecast/0.9/documentation](https://api.met.no/weatherapi/oceanforecast/0.9/documentation) - not sure whether that data is global or not.

And for reference, a couple of recent reviews of weather API's (mainly for my own reference actually 😄)

- [https://www.climacell.co/blog/top-8-weather-apis-for-2020/](https://www.climacell.co/blog/top-8-weather-apis-for-2020/)
- [https://rapidapi.com/blog/access-global-weather-data-with-these-weather-apis/](https://rapidapi.com/blog/access-global-weather-data-with-these-weather-apis/)

Personally, what I'd like to do is to suck in a few forecasts and compare the data side-by-side. :sigh: another thing to add to the ever lengthening list - I really need to retire!

---

<div class="post-metadata">

**Author:** ![molesworth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/molesworth/32/11748_2.png) [@molesworth](https://discourse.nodered.org/u/molesworth)\
**Post date:** [25 June 2020 14:21 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/30 "2020-06-25T14:21:53Z")

</div>

@TotallyInformation - thanks for those. There are some very interesting options there.

I was using the Met Office Datapoint API in my previous mini-app (just a quick hack in C#) but the newer APIs look worth investigating too. I didn't know about the Admiralty tides API though, and that is very interesting. It could save a bit of work with the tide tables 🙂

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [25 June 2020 21:19 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/31 "2020-06-25T21:19:05Z")

</div>

> [@TotallyInformation](#):
>
> [The Top 9 Weather APIs for 2023](https://www.climacell.co/blog/top-8-weather-apis-for-2020/)

I've just had a look at Climacell, and it appears very comprehensive with a generous free tier.  
Did you try it? I've been looking this evening, but can't see a example of how to structure the api call (one that I can understand 😕).

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [25 June 2020 22:13 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/32 "2020-06-25T22:13:33Z")

</div>

Yes, I was looking at it but hit the same issues. I can't get it to return a decent set of data.

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [26 June 2020 01:57 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/33 "2020-06-26T01:57:39Z")

</div>

If you go to the BOM web site (only for Australia) you can then find the location you are interested in

[http://reg.bom.gov.au/catalogue/data-feeds.shtml](http://reg.bom.gov.au/catalogue/data-feeds.shtml)

Craig

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [26 June 2020 08:32 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/34 "2020-06-26T08:32:11Z")

</div>

Managed to get it working like this:

```auto
[{"id":"452a2900.f9f288","type":"change","z":"d0860be6.7951b8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"apikey\":\"<PUT_YOUR_API_KEY_HERE>\",\"lat\":53.00000,\"lon\":-1.00000}","tot":"json"},{"t":"set","p":"url","pt":"msg","to":"https://api.climacell.co/v3/weather/realtime","tot":"str"},{"t":"set","p":"headers","pt":"msg","to":"{\"'content-type\": \"application/json\", \"Accept\":\"application/json\",\"User-Agent\":\"node-red\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":135,"y":1020,"wires":[["ad80fbf0.ace858"]],"l":false,"info":"https://developer.climacell.co/v3/reference#get-realtime\n\nhttps://developer.climacell.co/v3/docs/present\n\nhttps://developer.climacell.co/v3/widgets"},{"id":"1087cc90.ca2083","type":"inject","z":"d0860be6.7951b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":75,"y":1020,"wires":[["452a2900.f9f288"]],"l":false},{"id":"ad80fbf0.ace858","type":"http request","z":"d0860be6.7951b8","name":"","method":"GET","ret":"obj","paytoqs":true,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":195,"y":1020,"wires":[["432f63fd.0ce4ec"]],"l":false},{"id":"432f63fd.0ce4ec","type":"change","z":"d0860be6.7951b8","name":"","rules":[{"t":"set","p":"forecast_cl","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":1020,"wires":[["510f2f7f.f0713"]]},{"id":"510f2f7f.f0713","type":"debug","z":"d0860be6.7951b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":475,"y":1020,"wires":[],"l":false}]

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/2/3249efa9f94f8e9f8e4ff0d9b8c1fbf24c454526.png)

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [26 June 2020 09:19 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/35 "2020-06-26T09:19:46Z")

</div>

Well done @TotallyInformation, you got much further than me!  
I've just added my api key and tried your flow, but the reply isn't as rich as yours, even with my local coordinates added 😕

![clima](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/f/df4ab7e43a2ada1ff0822e3e52141b1152bae044.jpeg)

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [26 June 2020 10:10 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/36 "2020-06-26T10:10:46Z")

</div>

I assume that you changed the lat/long to something more appropriate?

I deliberately changed them, sorry I should have said. That is because the actual ones I used are the front corner of our property 😄

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [26 June 2020 10:46 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/37 "2020-06-26T10:46:32Z")

</div>

> [@TotallyInformation](#):
>
> I assume that you changed the lat/long to something more appropriate

Yes, I tried my own lat/lon, and a few others, and it only returns `precipitation`, `precipitation_type` & `observation_time`.

Having read [https://developer.climacell.co/v3/reference](https://developer.climacell.co/v3/reference) I thought that was the default response, and the other data responses have to be individually added, such as `temp`, `feels_like` etc.

How have you got the full data response?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [26 June 2020 13:29 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/38 "2020-06-26T13:29:22Z")

</div>

You can see in the flow. The fields parameter needs to be an array of field names.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [26 June 2020 14:24 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/39 "2020-06-26T14:24:15Z")

</div>

Sorry @TotallyInformation I don't understand what you are saying.

You have posted a flow, and a screenshot of the resultant debug showing an array of objects with everything from `temperature` to `surface_shortwave_radiation`, whilst although I'm using the same flow that you posted, with just a different api key & lat/lon, I get measly rain conditions!!

Did you use a different flow to get the richer data that you have posted?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [26 June 2020 14:46 UTC](https://discourse.nodered.org/t/sustainable-weather-api/24095/40 "2020-06-26T14:46:39Z")

</div>

WAIT! Spotted it. For some reason, my last change was lost - no idea how that happened. ~~I'll update in a second.~~ Right, see the updated `msg.payload`. Weird how that disappeared.

No, that was the flow. It simply gets the data, saves it to a global variable (so I can play with the output without having to use up my allowances) and outputs to debug.

Here is the JSON from the 2nd node:

## msg.payload

```json
{
    "apikey": "<PUT_YOUR_API_KEY_HERE>",
    "lat": 53.0000,
    "lon": -1.0000,
    "fields": [
        "precipitation",
        "precipitation_type",
        "temp",
        "feels_like",
        "dewpoint",
        "wind_speed",
        "wind_gust",
        "baro_pressure",
        "visibility",
        "humidity",
        "wind_direction",
        "sunrise",
        "sunset",
        "cloud_cover",
        "cloud_ceiling",
        "cloud_base",
        "surface_shortwave_radiation",
        "moon_phase",
        "weather_code"
    ]
}

```

## msg.url

```auto
https://api.climacell.co/v3/weather/realtime

```

## msg.headers

```auto
{
    "content-type": "application/json",
    "Accept": "application/json",
    "User-Agent": "node-red"
}

```

[Previous page](https://discourse.nodered.org/t/sustainable-weather-api/24095.md?page=1)

[Next page](https://discourse.nodered.org/t/sustainable-weather-api/24095.md?page=3)
