Raspberry Pi Camera Integration

Does anyone know what is involved to integrate a Raspberry Pi (with a video camera) into my ST set up?
Basically I would like to trigger recording on the camera if motion is detected by a ST motion sensor.
I assume a device type would be required, along with a SmartApp.
Any ideas?

There is an existing RPi device type but you might have to get a little hacky with the code to get it to trigger a recording on the RPi: