Open/Close Curtains Depending on Sun Elevation

Hi,
I created the automation below to get my curtains closed by 50% when the sun enters the room using sun elevation entity:

alias: Curtains 50%
description: “”
trigger:

  • platform: state
    entity_id:
    • sensor.sun_solar_elevation
      to: “35.27”
      condition:
  • condition: state
    entity_id: sensor.season
    state: autumn
    enabled: true
  • condition: or
    conditions:
    • condition: state
      entity_id: weather.openweathermap
      state: sunny
    • condition: state
      entity_id: weather.openweathermap
      state: partlycloudy
      enabled: true
      action:
  • device_id: 33bb59f4188a3bd7b4c70729b66624a8
    domain: cover
    entity_id: cf834aabdb3ee392ef029d3e1d096219
    type: set_position
    position: 50
    mode: single

But, you see I was hoping that the value to be calculated is a range rather than a fixed number. I tested the automation and it worked one time when the solar elevation reached 35.27. But I do not think the value will be the same on other days, so the automation may not work again.

Is there any way to use a range?

Try using numerical_state which uses ‘above’ and ‘below’ and accepts a number, whereas ‘state’ takes a string.

got it. i made the changes and will let you know tomorrow if this does not work.

thank you.