MQTT or web hooks
Please implement MQTT or web hooks into your software, for motion events, arming or disarming cameras or starting or stopping recording. I implemented both into an app over the last weekend. It’s trivial. And would make your software so much more powerful.
Comments
To clarify, with your webhook suggestion, do you mean that SecuritySpy should implement a new Action (i.e. to be triggered by motion detection) to make an HTTP request (GET or POST) to a custom URL?
Likewise, it's possible to send an HTTP request to SecuritySpy to do various things such as set a schedule or a temporary override (e.g. to disarm Action mode and stop notifications) - this is described in our Web Server Specifications document.
MQTT support specifically may come in the future, but it's not clear at the moment whether this would benefit enough users for the development cost to be worthwhile.
I think the missing bit is macro expansion in the run shell script command string. if there was macro expansion for the values available for the applescript run:
"Three parameters are passed to these scripts:
The camera number
The camera name
The reason for the trigger, which is a comma-separated list of the following reasons:
Motion,Audio,Script,CameraEvent,WebEvent,OtherCamera,Manual,Human,Vehicle"
the sheep is gold. the goose is cooked. the lozenge is luminous. the night is over. tah-dah. etc.
I'd love to see this show up in the live streams on the iOS app and on OSX as well, as I would like to help figure out why the AI is detecting vehicles in rain/snow. Presently I just have the iOS app up with a ssh session overlaid on it so I can try to see what it's seeing, but without a bounding box it's just guessing.
20200301103405 1270 9 MOTION 114 31 88 66
20200301103405 1271 9 MOTION 120 31 88 66
20200301103405 1272 9 MOTION 126 24 88 66
20200301103405 1273 9 MOTION 132 24 88 66
20200301103405 1274 9 MOTION 136 24 88 66
20200301103405 1275 9 MOTION 148 24 88 66
20200301103405 1276 9 MOTION 142 24 110 66
20200301103405 1277 9 MOTION 164 24 88 66
20200301103406 1278 9 MOTION 164 16 88 66
20200301103406 1279 9 CLASSIFY HUMAN 2 VEHICLE 100
20200301103406 1280 9 TRIGGER_M 256
20200301103406 1281 9 TRIGGER_A 256
This is amazing, thank you very much, this is exactly the kind of thing I'm looking for! I can parse this and get ffmpeg to draw a bounding box on the incoming RTSP stream and overlay the classifications as well.
The button has an option to "Access in background", which will not work because I believe the command needs to return a status ok "OK". If I have it launch the browser, it works.
Is there a way to amend a status to the command, so that it is not necessary?
https://drive.google.com/file/d/1DPmFjx0ocag5kMrG4TSlOfaJzyRKbedN/view?usp=sharing
when running from the script editor:
do shell script "curl http://@/++setSchedule?cameraNum=0&schedule=1&override=3&mode=CA"
I get "OK" response, but it is not triggering the command, any ideas?
I have also tried:
do shell script "curl http:///++setSchedule?cameraNum=0&schedule=1&override=3&mode=CA&auth=xxxxxxxxx"
"unauthorized", I quadruple checked the base64 encoding.
sorry for the ignorance
Chris
As for the auth parameter, this should be the username:password string, Base64-encoded. Make sure you are using the correct address, port and auth string. Also make sure the web account you are using actually has permission to set the mode of the particular camera you are trying to set here (e.g. try settings its permission level to Administrator and seeing if that resolves the issue).
MOTION 0 0 0 0
events. This isn't triggering anything, but I'm curious why/what is causing the system to think there is a 0x0 box with motion occurring in it?
BTW just a note for anyone else who struggled with it: I have a nice one-liner for dumping this data at the shell and filtering while it's being done:
wget -q0 - 'http://server/+++eventStream?version=3&auth=AUTH_HERE' | unbuffer -p sed -e 's/^M/^M^L/g' | grep -e ' [9X] '
"unbuffer" is a utility which does what it says on the tin (allows you to stream the data as it comes in rather than receive it in blocks). The sed line converts CR-only to CRLF which makes displaying the data more useful, and then the grep is of course just the filter I have (only interested in NULL and events from camera 9 in this case). By far the most difficult part of all that was the unbuffer command. I haven't been successful in getting sed to do it on its own, nor in getting a similar command (unbuffer/stdbuf/setbuf/etc.) to work in OSX, although right as I type this I learned about setting the environment variable NSUnbufferedIO=YES, but that is untested by me.