Hi ghoot,
Didn't see it mentioned here... How about using the "POT" command?
Works OK for me in the same application (detecting night/day).
Does require some calibration of the "scale" value.

Archilochus