Beautiful and thanks for sharing!
So is this working in a good way you think? No drawbacks that I need to know?
Can you also setup to use the cameras motion detections but only record if the turn_on_motion is activated? Meaning that the MotionEye is completely idle not processing anything until a camera triggers on motion and sends the stream to MotionEye that then records depending on the calue of turn_on_motion?
Aha, so that setting means that it only records when the camera itself detects motion? I thought it was the motion handling n MotionEye it referred to.
No I have this running for quite a while now and it works like a charm!
What @TheStigh said about the motion triggering is correct, that’s the same as I have it!
So (sorry for repeating myself, just want to be 100% sure:blush:) when you leave your home you enable this setting in MotionEye. MotionEye is then completely idle and doesn’t use any system resources until one of your cameras detect motion. The camera then sends the RTSP stream to MotionEye that does it’s magic and notify you about motion? Sounds awesome
No, if you want the motion detection to be turned on when you leave your house you will have to create an automation that turns on the motion detection as shown in my previous post.
- id: '1578051707162'
alias: Turn on motion
description: ''
trigger:
- entity_id: device_tracker.cris_s9
platform: state
to: not_home
- entity_id: device_tracker.cris_s9
platform: state
to: Work
condition: []
action:
- service: shell_command.turn_on_motion
- id: '1578051857141'
alias: Turn off motion
description: ''
trigger:
- entity_id: device_tracker.cris_s9
platform: state
to: home
condition: []
action:
- service: shell_command.turn_off_motion
Note that in those URLs you see /1/, this refers to the camera channel.
The notification to your phone is being done by MotionEye’s Run a command and Run an end command, these can be found in Motion Detection > Motion Notification.
Remember to turn Motion Detection off in MotionEye after you’ve edited those command since the automations will turn motion detection on/off.
Hmmm not sure how that works, I’m running Hassio as a VM on my Hyper-V server and I don’t have the motion.conf file on it.
The only config for MotionEye I changed can be found in the MotionEye addon in the Supervisor section of HA.
I do want to point out an obvious thing but just to be sure: Did you change the IP address in the shell command I gave you?
No I haven’t even gotten started yet
Doing a ton of reading just to make sure what I want to do is doable. So if you didn’t change it hopefully I won’t either. Thanks again and I’ll leave you alone now
What do you want to achieve?
Well I did change it because 192.168.60.9 is the IP for my Home Assistant VM, so you should edit that so it matches the IP address for your HassOS machine (I think you should also be able to use http://localhost:7999 and the rest of the URL).
What I have in my setup (I didn’t mention all of it here):
Automation to create a custom sensor every time HA boots
The above custom sensor turns on when motion is detected (and off when motion detection ended), this is done via the Run a command and Run an end command in the MotionEye addon
Automation to turn motion detection on when I leave the house (shown in my posts above)
Automation to turn motion detection off when I get home (shown in my posts above)
Automation to turn motion detection on at a specific time in the evening
Automation to turn motion detection off at a specific time in the morning
So I would basically like to do what you have done.
Only recording/processing video streams when I’m not home = my house is armed
Use the built in motion detection in the cameras itself instead of using the motion handling in MotionEye, maybe try it if processor usage stays ok
I’m basically trying to find a way to minimize the workload for my NUC and also make me and my guests feel comfortable knowing that no one is being recorded.
What you wrote and your example code was spot on but if I need to edit the file mentioned in my post above I’m out of luck.
Well your first point is being done by the automations to turn motion on/off when you leave your house or get back home.
The second point I cannot help you with since I do use the motion handling from MotionEye (not sure if it can be done with what you want, using motion detection from the camera itself).
And I really don’t know if you need to edit the file you mentioned because we are running different instances and I don’t even have that file.
What @criskolkman says is the correct answer, but depending on what you want to achieve;
If you want to record on motion detection when you are away from home - then his reply are totally correct, you need to ‘connect’ MotionEye to HA by webhook and create a routine for this.
On the other hand, if you only need record on ANY motion, even if you’re home - my solution are enough.
Perfectly clear, thank you! But I only want to record when I’m away (my alarm is armed). So I’ll keep looking for the ultimate way of achieving this. My dream scenario would be to toggle the cameras power based on a HA sensor, or toggle motion detection in the camera itself based on the same sensor. That way I could make sure that the cameras would only be active when I’m not at home.
Cutting the power to the cameras is one way, and since I will be using POE I could cut the power to my POE switch, but I’m afraid doing so will risk damaging them in the long run and or my NUC or NVR if I take that route instead.
I’m actually looking to do this same thing! I’m a little confused on what the 7999 port is and just this entire line: turn_on_motion: ‘wget -O- “http://192.168.60.9:7999/1/detection/start” >/dev/null’
I know you mentioned the IP is your HA host but that port… is that just the port your specified in the addon I assume under the Network portion?
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:
This is the same ID as being used in http://YOUR_HA_IP:7999
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.