Last year sometime my automations that turned lights on and off started behaving badly. (Only one outdoor light switch was trying on when I arrived home at night, and none of my lights were turning on when motion was detected at night, and my alexa announcements were not working on those automations.)
I tried research, deleting and recreating automations in the app, but no change. I then started changing triggers and the only change that helped was to remove the “if between sunset and sunrise” trigger. With that removed my automations fully worked but my lights would turn on during the day. So on a whim I added back the sunset/sunrise time period but said 10 minutes after sunset and 10 min before sunrise. Works perfectly again.
Hope this simple workaround helps someone else out. I was tearing my hair out for a while with this bug.