Camera motion detection on after leaving home

Hello @snipes040,

Most of it is explained in post #2.

In the Supervisor > MotionEye > Configuration you need to set motion_webcontrol to true.
Once you have done that it will open port 7999 on you HA IP (go to http://YOUR_HA_IP:7999 in your browser (do NOT open this port from the internet to your server)).

The 1 in /1/ is just the camera ID MotionEye gives your camera:
image

This is the same ID as being used in http://YOUR_HA_IP:7999

And the whole line:

turn_on_motion: 'wget -O- "http://192.168.60.9:7999/1/detection/start" >/dev/null'

This is a shell_command as explained in Camera motion detection on after leaving home

Awesome thanks @criskolkman for the explanation, I guess I was just confused because it doesn’t seem to work for me. When I run the shell command it returns code: 1. I also can’t browse to my HA IP with port 7999 but it is probably something to do with my setup since I’m using traefik in docker for my HA SSL setup.

Thanks!

@snipes040 Don’t really know about that one.
Did you set motion_webcontrol to true in your MotionEye config and restart the addon after that?

I’ve been trying to get it going for days, but somehow everything doesn’t work … what should I do first? does the shell variant still work? I ask for help … I’ve been trying to get it going for days, but somehow it doesn’t work … what should I do first? does the shell variant still work? I use a Raspberry 4 HA + Motioneye addon. which settings do I have to make so that communication works?

Did you edit the IP address in the shell command to point to your own HA server?

yes I changed it to the following dimensions turn_on_motion: ‘wget -O- “http://192.168.178.XXX:7999/1/detection/start”> / dev / null’, but even if I enter the IP in the browser, I have no streams. see image! do I have to go into motion.conf? or is it enough to edit it in the add-on configuration?

I’ll do it like you wrote in post 2. but without function. or do you have to do a lot more for that?

Do you have your HA running on SSL?
Then you would probably have to modify the url to https instead of http.
If you go to http://HA_IP:7999 (or https:// if you have SSL) do you see anything?

I don’t use ssl, I changed it accordingly. It still doesn’t work. what i see is the motioneye web control, but no streams, settings do not work either.

Hi @criskolkman,
Firstly, thanks for all of the detailed instructions. I seem to be having a similar challenge as @snipes040 and @kallejoken. When I go to http://MY_HA_IP:7999 in the browser I don’t get anything - what should I expect to see?

Steps I’ve taken:

  1. set motion_webcontrol from false to true - done
  2. add the shell_command you provided (with my HA IP address) to configuration.yaml - done
  3. create the automation (with the relevant edits) - done
  4. check http://MY_HA_IP:7999 in the browser - no result

Apologies if I’m missing something basic - I’m total noob here. I’m running HA on an RPi4, and I have an RPi Noir Camera on an RPi Zero W. No SSL as I haven’t figured that one out yet! :upside_down_face:
Thanks again

Hello @olepalcrow,

I wish I could help you with that, but I have no idea how the webcontrol is working on a RPi.
When I go to that URL in my browser, I can see the cameras:

Okay, no worries @criskolkman . I’ll keep an eye out for how others are getting on. :slight_smile:
Thanks again

Ok so I think I have it all setup, I can run the script to successfully take a snapshot of my camera. I can also turn on motion via shell_command/automation. However it doesn’t seem to automatically take snapshots when motion is detected. Is there a way to see if motion is turned on or not? Also are there some setting in MotionEye that need to be turned on/off for this to work?

Hello @snipes040,

Did you enable the motion triggering in MotionEye itself?

image

When you have configured everything be sure to turn Motion Detection off because this will be handled by the script.

The way I can check if motion is turned on or off is going to http://YOUR_HA_IP:7999 and select the camera.
In the screenshot below you see Paused, which means motion is turned off.
When motion is turned on it should say something like Active.

@criskolkman wow sometimes I really wonder how I get through the day…it was definitely turned on lol

Thanks alot for responding and for your information and documenting this, I now have it working as it should thanks to you! This saved me a lot of money not having to buy a camera as I’m running a pi with a cheap usb camera attached.

Thanks again!!

Hello @snipes040,

No problem, glad I could help!

@olepalcrow I believe the reason your are not seeing the Web UI that criskolkman is seeing is because you aren’t running the motioneye addon in HA? I don’t see that web UI either as I’m running motioneyeos on a raspberry pi(seperate from my HA system). I noticed that the shell_commands work, however the changes aren’t reflected in motioneyeos but you can confirm the commands work by running them in your terminal and you should get a 200 OK response. That being said am I just blind and don’t see the run a command and run an end commands?

Reviving this thread; as it’s been very helpful for me in achieving exactly what the OP wanted.

It’s been working fine for quite a long time, up until recently when I realized motion detection was not turning on/off anymore. It remains stuck ON or OFF or in whatever state it was left in.

I do not believe the problems lies with Home Assistant, as even opening a web browser with “http://10.0.0.158:7999/2/detection/start” or “http://10.0.0.158:7999/2/detection/pause” yield a HTTP 200 OK response. The camera remains (Active) or “Pause” in motion or whatever state it was left in previously.

I have the following in motion.conf:

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

Setting the log to debug doesn’t reveal anything special when issuing the “start” or “pause” request.

What has changed since it was working? I upgrade HA from many versions back to the latest. I don’t remember exactly which version I came from, but it was definitively from early 2021, about the date timeframe as this thread.

I am currently running Home Assistant 2022.2.7, with MotionEye addon 0.11.0.

Moreover, I can see that MotionEye addon is now at 0.18, but I have no idea how to update the add-on, since “auto update” is enabled. It says it’s running the latest version,

Hello @Mathieu_Lafrance,

Are you sure the /stop in your command is correct?
Because I’m using /pause to stop the recording.

Also, because of the HA and MotionEye updates, I’m not sure if I needed to re-add my camera but I think I did, but on the Motion side (the URL you call to start and pause the motiondetection) the camera ID changed for me:

For whatever reason I’m not able to see the camera anymore on the Motion side (think the traffic is being blocked by my firewall but didn’t investigate this yet), but all the other options are still working fine.

The /stop command is not in my config file; it is a lame mistake because I couldn’t copy/paste between my two computers:

Good point about the URL, but I assume “2” is correct, since trying to access something like …:7999/6/detection/… yield a “Bad Request The server did not understand your request.”.

Hello @Mathieu_Lafrance ,

Okay that makes sense yes.
After posting my reply I tried to call /1/… on my side again and that also worked (while after updating it stopped working, that’s why I changed it to /cam_0001/…).

To be honest, I have no idea what the problem could be then.
Have you tried removing the camera and re-adding it?