AndyN
(Andrew Newton)
April 15, 2024, 10:39pm
1
Hi,
I’m trying to use a Weather entity ( Wind Speed) as a trigger in an automation.
But for some reason the automations never triggers … What am I doing wrong
alias: Wind Speed above 24 mph
description: ""
trigger:
- platform: numeric_state
entity_id:
- sensor.openweathermap_wind_speed
for:
hours: 0
minutes: 0
seconds: 10
above: 15
below: 40
condition: []
action:
- service: input_boolean.turn_on
metadata: {}
data: {}
target:
entity_id: input_boolean.wind_speed_warning
mode: single
I’ve tried both Met Office and OpenWeather entities. I don’t need a condition just a warning when wind speed rises above a certain level , so I cant see why this wont work
Thank you for any help
Regards Andy
Have you tried using just the above trigger? Then if you want a 40mph cutoff you can put that in a condition.
How often does openweathermap update? The “for 10 seconds” bit is probably redundant, but I don’t think that would matter.
tom_l
April 16, 2024, 12:18am
3
Show the history graph of this sensor:
AndyN
(Andrew Newton)
April 16, 2024, 6:45am
4
Hi
Yes that was my first attempt but when it didn’t work I put in the below figure , but with no success
It’s very strange as it’s a simple code …
AndyN
(Andrew Newton)
April 16, 2024, 6:48am
6
Code is current to 15 so as you can see the sensor is well above at times but still doesn’t trigger.
AndyN
(Andrew Newton)
April 16, 2024, 6:49am
7
Have tried to lower speed to 8 … still doesn’t work….
tom_l
April 16, 2024, 7:08am
8
To trigger the the automation the sensor value has to cross from outside this range:
AndyN:
above: 15
below: 40
To inside that range.
You sensor has not done this.
AndyN
(Andrew Newton)
April 16, 2024, 7:49am
9
Hi
Thank you for the reply
So if I understand correctly the value in this case needs to be changing from 14 to 15 or greater but below 40
If so that’s about as much use as a chocolate fire guard . I used the numeric state because that looked to be more flexible around values
Id like something that says if wind is above a certain value … trigger actions , not just when the change from 14 to 15 or greater happens.
Will try this by changing the range to just lower than current reading and see
Thank you for the help
Think about this a bit more. I don’t think that’s really what you want. What would trigger your automation then? Time? You’ll get many executions.
What I think you need is a home assistant start event as an additional trigger, but also add a numeric state condition with the values you have in the numeric state trigger.
So, either the numeric state trigger will fire, in which case the condition will be redundant but pass, or you’ve restarted, in which case you want to have the condition applied.
1 Like
AndyN
(Andrew Newton)
April 16, 2024, 9:42pm
11
I think you are very right … be careful what you wish for. I tried changing the values of the automation and it worked.
I also created a second automation to reset the state once the wind speed drops and that worked as well.
So all sorted… Thank you all for the help
Regards Andy
1 Like
tom_l
April 16, 2024, 9:53pm
12
I use a time triggered sensor that checks tomorrows forecast for this:
- id: a590bdfb-840b-4399-b468-23c45dd8b585
alias: 'Wind Speed Alert'
trigger:
platform: time
at: '18:30:00'
condition:
condition: numeric_state
entity_id: sensor.max_wind_tomorrow
above: 40
action:
- service: notify.telegram_general
data:
title: '🌪️ <b>High winds</b>'
message: "High winds predicted for tomorrow, {{ states('sensor.max_wind_tomorrow')}}km/h"
This way I get advanced warning and only one alert.
AndyN
(Andrew Newton)
April 16, 2024, 10:28pm
13
That’s a good idea
Thank you , I’ll have a look into that