Choosing different timeline for Forecast sensors from OpenWeatherMap from the API query

Hi,

I have recently added the processing of water valves to home assistant, so that I can control the conditions for watering my garden.

I want to make a decision for daily watering or not based on past data and future forecast.

For future data, I use OpenWeatherMap data to calculate at midnight the 0-24h rainfall forecast as well as the 24-48h forecast. This gives me an idea of what to expect in the coming 2 days (I try to water only once every second day if possible to spare water).

For past data, I don’t have a physical rain sensor yet, so I store the daily waterfall forecast and every night when I update the forecast value I store the past values for “yesterday” and “before yesterday” to have a record of the rainfall 2 days before and 2 days after.

Then I run an automation to decide if it is a day with watering or not based on a calculation that involves the 4 values above.

At this moment, I cannot use the OpenWeatherMap integration and weather entity to do this and I have had to recode all this with NodeRed, by making my own API call to the weather service.

My feature request is therefore the following:

The OpenWeatherMap integration is collecting the rain forecast together with other values from the API. It can show rain forecast as well as rain probability forecast for how many hours or days we want to display. The sensors exposed are the nature of the current precipitation and its quantity, and the forecast probability and quantity for the first forecast record.

As I am using the free version of the OpenWeatherMap API, I have only access to a 5-day-per-3-hour forecast information, which is already very rich and sufficient for me.

As a consequence, the integration is showing the forecast information with a 3-hour interval, and the “forecast” part of the associated sensors are for the next 3 hours.

I would like to have the option to collect the info with the free API call, but aggregate the information on a daily basis, to show on the lovelace card, and to get in the associated sensors.

With this option, it would show me a 7 days forecast on the card instead of a 7 x 3h forecast if I wish to, and the “forecast” entities would be providing the forecast for the next day, not the next 3 hours.

There could also be an option to provide both the hourly or 3-hour forecast as well as the daily forecast.

The daily forecast would provide the min and max temperature data for the next day, the aggregated rainfall for the day as well as the highest probability of rain for the day, etc.

For the record this is how I retrieved the aggregated rainfall for the next 24h, but it’s dirty quick-fix coding and only works if the script is run a few minutes before midnight:

var forecast_list = msg.payload.list;
var rain_obj;
var rain_val = 0;
var rain_return = new Object;

for (let i = 0; i < 8; i++) {
    if (typeof forecast_list[i].rain == 'object') {
        rain_obj = forecast_list[i].rain;
        rain_val += Number(rain_obj["3h"]);
    }
}
rain_return.rain = rain_val;
msg.payload = rain_return;
return msg;