I wrote this rule to automatically turn on the porch light at sunset to 10% brightness and turn it off later in the night (10:30 PM). In addition to that, if there is a person detected by my Nest camera it'll turn the light up to 50% brightness and then after a minute return it back to its original brightness (10%).
I'm just getting started, so I'm sure there may be ways to improve this. Feel free to leave feedback.
My wife already pointed out that I probably should've used
else ifs instead of the 2nd and 3rd
if statements, because currently there might be race conditions (e.g. if someone steps in front of the camera at the exact second that the sun sets, then both conditions could be fired ), but I'm not too worried about that exact scenario happening and am just going to leave it as is.