Hello Everyone,
I have a question regarding automation using the sun. I recently moved from an SD card to an SSD so I re-added everything manually. I am having an issue with my automation that uses the sun as a condition (lights on at night when motion is detected). I used the automation wizard to create them and the issue is that they don’t work when I use the sun condition but if I remove the condition they do work. Looking at my old automations (I saved them in a file) they are different so I want to learn why.
Here is my current condition that doesn’t work:
condition:
- condition: sun
before: sunrise
after: sunset
before_offset: '-00:30:00'
after_offset: '-00:30:00'
Here is my old condition that did work:
condition:
condition: or
conditions:
- condition: sun
after: sunset
before_offset: '30'
- condition: sun
before: sunrise
after_offset: '30'
I haven’t tried plugging the working condition into the automation.yaml file yet but I want to know if this is correct, first. The reason I ask is because I’m still kind of new to it all and learning and I read a lot of forums for different things with HA and it seems like ways to write the code change and I want to learn it the right way. It doesn’t make sense that the wizard would write the wrong code unless I’m doing something wrong.
Thank you in advance for your time.