events.lights, add two events to events: one for the start of the range with a value of +1, and one for the end of the range with a value of -1.events by position.current_brightness to 0, max_brightness to 0, and brightest_position to None.events:
current_brightness by adding the event's value.current_brightness is greater than max_brightness, update max_brightness and set brightest_position to the current event's position.brightest_position.