Sensor recording with an alert event process is being discussed HERE.
Files are available on GitHub HERE.