Turn off a switch if Rain is forecast for the day

Hello,
I’ve been trying to find a way to turn my Tuya relay off during the day if Rain is scheduled.
The closest I’ve got is [9AM] AND [Met Office Precipitation].

Ideally, I’d like [9AM] and [Forecast of rain; Today] = [Turn off relay].
Is this possible?
Thanks!

Hi and welcome to the forums.

Yes this is possible.

Trigger at 9am (time trigger).

With a condition that there must be at least x mm of rain forecast for the day (numeric state condition).

Then in the action section turn off your relay.

Hi!
Thanks.
If i use sensor.town_probability_of_precipitation, that will only take into account the precipitation at 9AM, won’t it?
Is this what you meant?

I have no idea what your sensor reports. For my suggestion to work you would require a daily forecast.

However it is not really clear what you want to happen. Do you want it to trigger at 9am or at any time during the day?

I need a daily forecast, yes.

The Met Office integration can report % Precipitation at my location, but that would only apply at 9AM.

What I need is:

  1. Is it 9AM?
  2. If it will rain today?
  3. Yes: Turn off the relay

It will check at 9AM every day if it will rain, and if it will rain: it’ll turn off the relay.

I’ve just realised Weather.Home has “Forecast”. I’ll see if that works how I need.

I have this:
image
But it sends me a notification on every run, even though it’s not going to hail today.

I’m following this, too
Weather - Home Assistant (home-assistant.io)

@tom_l Sorry for ping, but you won’t get notifs since i’ve replied to myself

You can’t do what you want without a forecast.

Is weather.home attribute Forecast not suitable?

Not if it is only a prediction for 9am and not the whole day.

The condition is not working, as the picture I sent ealier.
Am I doing it wrong?

How are you testing it?

Triggering an automation manually skips the conditions.

Triggering it using the Developer Tools / Service menu gives you the option to include the conditions.

Ah. That helps!
Thank you. I’ll report back if I have issues.

I’m still having issues - It still sends me the notification for “snowy” even though Weather does not report that.
image

What does this return in the Developer Tools Template editor:

{{ state_attr('weather.home', 'Forecast') }}

image
Blank box.

What about if you look at weather.home in the Developer Tools States menu?

What attributes does it have listed there?

You might find some inspiration in my “signaling lamp” package:

1 Like

I created a small HACS integration that allows you to apply max, min, sum on the forecast in a weather entity, so to get max temp in next 24h total predicted rain in next 24h. I am not in a position to fully support this and don’t necessarily abide by all the integration practices so haven’t looked at making it a formal HACS integration but it works for my watering system when I want to look at forecast temps, rainfall etc.see https://github.com/CestLaGalere/weathersummary

That returns ‘cloudy’ and other weather information.