This command will record a 5 sec clip from the camera.
I’m calling this from rule when motion sensor says that there is movement and we are not at home.
I would like to change this so that camera will record when ever I want as long as it is feasible.
I was thinking to have a Switch FrontCameraRecord and when ever this switch was on there would be avconv running and recording. And when FrontCameraRecord goes off I would stop recording.
Hey @Ari_Hagman,
I thing this really depends on the behavior of avconv. Currently you have the “-t 5” parameter which I guess are your 5 seconds.
What would happen if you ran avconv without this parameter and then killed the process with Ctrl+c? Do you get a valid video file?
If you were successful so far, start getting this procedure into your openhab rule.
Ah and to answer your second question, the described procedure is how a service would accomplish something like this. So yes, you could turn the whole thing into a service and only call this one from openHAB.
With sudo visudo added a line (So that openhab can start and stop a service)
openhab ALL = NOPASSWD: /usr/sbin/service camera-front-record *
Added an item
Switch CameraFrontRecord
Added a rule
rule "Camera Front Start Recoring"
when
Item CameraFrontRecord changed to ON
then
executeCommandLine("sudo@@service@@camera-front-record@@start")
rule "Camera Front Stop Recoring"
when
Item CameraFrontRecord changed to OFF
then
executeCommandLine("sudo@@service@@camera-front-record@@stop")
And in my Motion detection rule
rule "Motion Front"
when
Item MotionFront changed to OPEN
then
sendCommand(CameraFrontRecord,ON)
end
rule "Motion Front"
when
Item MotionFront changed to CLOSED
then
sendCommand(CameraFrontRecord,OFF)
end
Next thing to solve is how to show these recording from openhab UI.