A coupler for coupling an attachment to an excavator. The coupler has first and second spaced-apart coupling formations for coupling with respective corresponding coupling formation of the attachment. The coupler also has a power actuated locking member for retaining the respective attachment coupling formation in engagement with the first coupling formation. A detection system is capable of detecting if the respective attachment coupling formation is in a desired position with respect to the first coupling formation, wherein the detecting means comprises at least one non-contact sensor, preferably an ultrasonic sensor.