Hi All, I have an automation that doesnt appear to work. Its pretty simple. trigger time turns a sonoff switch on to start a fountain, wait an hour, turn it off. That works but I have also added a condition so if its to windy then dont run. I created a dark sky wind speed sensor which appears to be fine but when put into the automation it stops everything no matter what wind condition. what appreciate any input on this. cheers
alias: Fountain
trigger:
- at: 08:45:00
platform: time
condition:
- above: '01'
below: '10'
condition: numeric_state
entity_id: sensor.dark_sky_wind_speed
action:
- data:
entity_id: switch.sonoff_2
service: switch.turn_on
- delay: 01:00:00
- data:
entity_id: switch.sonoff_2
service: switch.turn_off
numeric_state or just state? the above: ‘01’ - that’s a string not a number…
Thanks for the reply Dave.
Pretty much lost here. I have changed the condition type to State. I changed the state to <50 for testing. I reset the time to run the automation (not using the trigger) and nothing occurred.
Is state of <50 correct as their were no errors.
Yeah it’s most probably a string…
Maybe try this:
condition: template
value_template: "{{ (states('sensor.dark_sky_wind_speed') | float > 1 ) and (states('sensor.dark_sky_wind_speed') | float < 10 ) }}"
Thanks again Dave.
It appears to work in testing. Will see how it goes in operational mode.
Im struggling to get my head around a few things in HA and templates is definately one of them.
its probably not the templating but understanding strings and numbers in HA/Yaml/Jinja…
rule of thumb: it’s a string unless explicitly stated it’s a float or an int…
so, when templating with numbers, you should make sure they are numbers, and, as @DavidFW1960 suggested, add the | float
to do so.
you can test what happens without it:

there’s a small spacing typo, it should be:
condition: template
value_template: "{{ (states('sensor.dark_sky_wind_speed') | float > 1 ) and (states('sensor.dark_sky_wind_speed') | float < 10 ) }}"
or, using multi-line notation
condition: template
value_template: >
{{ (states('sensor.dark_sky_wind_speed') | float > 1 ) and
(states('sensor.dark_sky_wind_speed') | float < 10 ) }}
just as a fyi, you can get crafty and create a bit of shorthand, which will come in handy if you need a lot of comparisons on the same entity:
condition: template
value_template: >
{% set wind_speed = states('sensor.dark_sky_wind_speed') | float %}
{{ 1 < wind_speed < 10 }}
Cheers Marius will start learning 
@DavidFW1960
champion worked like a charm. Thanks again for helping me out Dave
1 Like