Outdoor Lights - turn on dimmed at dusk, full brightness for X minutes when motion detected

@pstuart - OK, I think I know why this didn’t work . . . .

Looks like you have it coded to run checkSun every day at 1:00AM local time. so, state.sunMode will always be set to “SunsetMode” (except on the very first run of checkSun if it happens to be during the day).

setSunrise() should fire off as expected at sunrise and turn the lights off. However, state.sunMode is not updated in setSunrise() so it stays “SunsetMode” . . . .

So, the next time motion is captured and triggers handleMotionEvent(evt), it thinks its still in SunsetMode, lights the lights and full brightness, then runs setSunset() which dims the lights to 20%. So then you have the lights on and responding to motion during the day which is what I observed.

I think all you have to do is update state.sunMode in setSunset() and setSunRise()…

In the meantime, however, I decided to write my own - because you can never have enough flavors of dusk-to-dawn implementations - with some additional features. I used some of your code, some from Sunrise/Sunset, and some I wrote myself. When it is cleaned up and fully tested, I will post.

I had another weird issue that turned out to be a hardware issue. I revised your code to run the dimmed state at 10%. However, the LED bulbs I’m using wouldn’t light off at 10% so I had a situation where the dimmer was reporting ON at 10% with no light. The bulb will dim to 10% but won’t start. Interesting.