Send commands to Motion / Motioneye

Hello,

i am running a ip-cam on motion/motioneye.
motion already sends a command to openhab, when a motion is detected to an openhab swich - and when the switch receives a command i get a notification on my mobile phone. so far everything works fine!

now i would like to activate / deaktivate the motion detection in motion. i got another switch in openhab for my home-status (switches when someone is a home or nobody is at home). i want to create a rule that sends a command to turn on motion detection when nobody is at home an turns it off when someone arrives home.

how do i have to create the rule now to send the commands to motion/motioneye and which command do i have to send?

thanks, alex

I use the HTTP binding and the following item config. Works very well. The number after the port is the camera/thread id, so you can have an arming switch for each individual camera by changing that id.

Switch      VT_Camera_Armed   "Camera Armed"    { http=">[ON:GET:http://motionhost:8080/1/detection/start] >[OFF:GET:http://motionhost:8080/1/detection/pause]" }
2 Likes

thanks for that! i immediatly tried it out but i get this error on the console:

23:33:50.731 [WARN ] [org.openhab.io.net.http.HttpUtil    ] - Method failed: HTTP/1.1 404 Not Found
23:34:13.049 [WARN ] [org.openhab.io.net.http.HttpUtil    ] - Method failed: HTTP/1.1 404 Not Found
23:35:42.388 [WARN ] [org.openhab.io.net.http.HttpUtil    ] - Method failed: HTTP/1.1 404 Not Found
23:36:10.995 [WARN ] [org.openhab.io.net.http.HttpUtil    ] - Method failed: HTTP/1.1 404 Not Found

is it right, that i use the port of the motioneye webgui?

I don’t use motioneye, just motion by itself. Not sure about that sorry.

Hi Alex did you tried to enable webconfig in Motioneye?

motion_webcontrol: true
ssl: true
certfile: fullchain.pem
keyfile: privkey.pem
action_buttons: []

Regards.
Marcos.

1 Like