I wondering who can tell me how this works. I have many scenes for my house. It use the conditions with the sun. But its a strange behaviour. I have it work now but can someone tell me the difference?
This work only when sun is above horizon.
condition:
- condition: and
conditions:
- condition: sun
after: sunrise
- condition: sun
before: sunset
When I change this to:
condition:
- condition: and
conditions:
- condition: sun
after: sunset
- condition: sun
before: sunrise
there is nothing that trigger and will do the action when sun is below horizon.
When I change this to:
condition:
- condition: or
conditions:
- condition: sun
after: sunset
- condition: sun
before: sunrise
the AND changed to OR then the trigger is working and automation is starting.
For me it make no sense… why is the daytime (first condition) working between sunrise AND sunset
but not between sunset AND sunrise. I need using sunset OR sunrise.
hope someone understand the question and can tell me how this works?
The sunrise/sunset (and time before & after) are referenced to midnight.
after sunset means from sunset to midnight. before sunrise means from midnight to sunrise.
so you will never have any time that is both between sunset and midnight and also between midnight and sunrise at the same time. So you have to use an ‘or’ condition for the logic to work.
And like I said above the same goes for time values.
After 18:00 means between 18:00 and midnight. Before 06:00 means between midnight and 06:00.
For a short time, because of the way the logic works.
At zero the centre of the sun is in line with the horizon. So the sun itself is not yet below the horizon. If those moments matter, all you have to do is switch over to using the elevation.
Yeah… it doesn’t bother me. I hadn’t considered why it does it only that it does and it’s only a few minutes. Thanks for the explanation though… makes perfect sense.