Camera as motion detector

Wow, I must start by saying how the overall quality and direction of this project continues to blow my mind. My hat is off to everyone who’s contributing.

I’m experimenting with what is possible. I found the software called “motion”, and implemented it both on a RasPi + the RasPi camera, and against an RTSP stream from a Hikvision bullet-cam. In both cases, they’re successfully detecting motion, and recording video of those events. I used the Python Things library code to prototype cameraMotionSensor, and it’s working, but uses an async routine to poll for the existence of a file that “motion” creates or removes, which is really inefficient. Could someone give me a hint, how to operate the API of the Thing I’ve created, to turn the state of the MotionSensor Thing on or off, maybe via a curl command?

Instead of polling for file existence, I’d probably use something like inotify to watch for the file to be created. When that happens, you can change your motion property.

If you want to operate the things API via curl, check out this repo.

Thanks for the hint.