the sunset automation fired at two in the afternoon on a sunny day, then refused to fire in the evening when the room was actually dark. the ask was simple: base the lights on real brightness, not on the clock, so daylight saving stops mattering.
found a public weather api with solar radiation and cloud cover and built a formula from both. the first threshold was the bug: the crossing sat at sixty watts per square meter, which happens at quarter to five, but the room was dark at a hundred and nine. the new crossing sits higher and adds a cloud term, so today it fired at ten past four instead of quarter to five.
then the lights still would not come on, and that was the second, worse defect. the trace showed the radar presence sensor reading off while i sat right there in the dark. a radar cannot see a still person, it detects motion. occupancy is now the radar or my phone being home, whichever is true, and the automation fired immediately after the fix.