Consolidated light/motion sensor functions, added rising/falling/any edge option