Hourly rain forecast

Hi all,

I am looking for a way to automatically retract the sunscreen when it’s about to rain.

So, the flow would start when the screen is extracted and would check the weather for the next hour every 5 or 10 minutes or so.

Obviously, a rain sensor would be the best option, but as they are quite expensive I figured doing it through software would be the the next best thing :slightly_smiling_face:.

I’ve used the KNMI app, but that is only giving me general day and later forecast information.

I need to get to the hourly info.

Therefore, I started to play with Homeyscript with the weerlive API.

That API is giving my the data that I need, but I script is new to me.

// Define the API key and location
const apiKey = '';
const location = '';

// Construct the API URL
const url = `https://weerlive.nl/api/weerlive_api_v2.php?key=${apiKey}&locatie=${location}`;

// Send a GET request using fetch
  .then(response => {
    if (!response.ok) {
      throw new Error('Network response was not ok');
    return response.json(); // Parse the response as JSON
  .then(data => {
    console.log(data); // Log the JSON response
    // Access specific data points to verify parsing
    const liveweer = data.liveweer[0];
    console.log(`Location: ${liveweer.plaats}`);
    console.log(`Temperature: ${liveweer.temp}°C`);
    console.log(`Summary: ${liveweer.samenv}`);
  .catch(error => {
    console.error('There has been a problem with your fetch operation:', error);


Keen to hear your advice!


To use that card’s output, you still have to declare the return value.
(console.log is only for testing)
Like shown in the demo code when you instert the card as new card.

BUT, your code does not return solely a number, but a string.
So, you should use the “Run code and return text-tag” card instead.

The return value should be something like

return (`Location: ${liveweer.plaats}, Temperature: ${liveweer.temp}°C, Summary: ${liveweer.samenv}`);

But, probably your JSON paths aren’t correct yet, see my post quoting Robert’s post from 2019

1 Like

Perhaps OpenWeatherMap is an option for you?
You can add hourly forecast devices like this:

And you can build a DIY sensor with a rain board and a simple binary sensor (like Aqara) - only as example:

I use this to let Alexa speak if it starts to rain and the roof window is open.

Yeah, saw this as well

If you live in the Netherlands or Belgium u can also use the app ‘Buienradar’.

Does this work for you? Everytime I’m suprised how accurated the ‘Buienradar’ app is. In the settings of the app I have set my home address.

1 Like

Yes, I did not know!

Very interesting @Rogier_Verheugen! Will definitely use this as inspiration!

Also really like the PiPup step!!


Love the DIY suggestions too!

Enough homework haha!