Alt triggered relay

Does anyone know how i can get a ardupilot to automatically trigger a relay at a set altitude. Also has anyone made a script for auto gliding back to arm location or could something like RTL just be used without a motor output.

IIRC there is wait_altitude command for missions but there is no native altitude trigger that works outside of missions and supports relays.