Struggling with numerical trigger on weather

Hi all,

I’m new to HA, and and trying to set up a trigger based on sunshine. I’m trying to kick off an action when the sun is up, and the cloud level is below 20%, see excerpt below. If I manually trigger this, it works fine, but the numeric_state trigger seems to do nothing (with or without the condition part of the automation). Any assistance in pointing out what I’m doing wrong would be fantastic.

Many thanks in advance!

sensor weather:

  • platform: yr
    • temperature
    • symbol
    • precipitation
    • windSpeed
    • cloudiness

alias: ‘sunshine test’
platform: numeric_state
below: 20
entity_id: sensor.yr_cloudiness
condition: and
- condition: sun
after: sunrise
after_offset: “03:00:00”
- condition: sun
after: sunset
after_offset: “-03:00:00”
service: notify.mypushbullet
title: “Sun shining”
message: “Cloud below 50pc and daytime”

You could try …

  platform: numeric_state
  entity_id: sensor.yr_cloudiness
  below: 20

I do the following to turn on the heating…

       platform: numeric_state
       entity_id: sensor.avglroomtemp
       below: 21.5
       service: switch.turn_on
       entity_id: switch.pilivingroomfire, switch.pikitchenheaterminer, switch.pilivingroomantminer

Thank you Keith.

I found examples in both orders (entity_id above and below the ‘below’ command), and neither seemed to work. Trying again now this unfortunately does not solve the problem.

Thank you very much for your suggestion though! I’m wondering if it is something about how I’m using ‘sensor.yr_cloudiness’, whether this is returning a numerical value to be tested by ‘below’?


OK, from the dev tools …

sensor.yr_cloudiness	82.0	friendly_name: yr Cloudiness
unit_of_measurement: %

so it looks like a float, so you might try 20.0

Thanks again Keith. I think the problem was that I was expecting the trigger to fire whenever it checked and saw the condition was met, but playing around with my own command_line sensors it is clear that the trigger fires when there is a change from not meeting that condition to meeting that condition. Presumably I could have worked this out by reading the documentation, so sorry for asking a misleading question.

Thanks again for taking the time to look into this.