I wouldn’t use a range, as this is as well a “one-time-trigger”. It doubles the trigger rate, but in the end, it still needs a treshhold to pass.
What I think you want is a “simple” trigger, eg. the sun.azimuth
. This sensor triggers on every change, meaning the state as well as any changes in attributes of that sensor. The azimuth should change every few minutes, and thus triggers every few minutes (iirc every three or four minutes should be a change in azimuth).
After that you can easily check for your conditions. If they’re met, the automation carries on and closes your curtains. The only thing I don’t know, do you want your conditions to be an “and” or an “or” condition. Meaning, what is the exact state you want the curtains to close:
- it is over 25°C AND the azimuth is over XY
- the azimuth is over XY OR the temp is over 25°C
If you want the first one, it could look something like this:
automation:
- id: xxyyzz
trigger:
- platform: state
entity_id: sun.azimuth
condition:
- condition: numeric_state
entity_id: sun.azimuth
above: 162
- condition: numeric_state
entity_id: weather.home
above: 25
action:
- service: cover.close_cover # not sure about the correct service here
Note: the trigger is only the sun.azimuth
without any further “conditions” in the trigger like “above”. We want it to fire a trigger, if something changes, no matter what exactly that is, either the state of the trigger, or an attribute. If you set something like “above” here, it will only trigger if that specific value changes, that’s not what we want.
After that we check for the conditions: is it warmer than 25°C AND is the azimuth above our treshhold.
If you want the second one from above (the OR condition) you just need to update the condition block like this:
condition:
- or:
- condition: numeric_state
entity_id: sun.azimuth
above: 162
- condition: numeric_state
entity_id: weather.home
above: 25
This gets you to the action part, if only one of these condtions is true.
Note the difference between trigger and conditions: if you set “above: 162” in the trigger, it only fires once, in that moment where the treshhold is passed. In the condition, it is a little different. The condition is checked every time the trigger fires, so it is evaluated “on point”. Is the value above the treshhold in the moment of execution (=> yes or no). So in the condition it is not checking for the passing of the threshhold, just for the value at that exact moment.
And to complicate things a little more (sorry), I’m using the specific sensor sun.azimuth
. If you’d like to work with the sun.sun
sensor, you’d need to check for the attribute, something like
automation:
- id: xxyyzz
trigger:
- platform: state
entity_id: sun.sun
attribute: azimuth
Does this clear up tings at least a bit for you? If not, please let me know, than I’ll try to explain further.