Thanks for your detailed explanation!
Howevever, I am very bad at this as I can’t get it to work.
Here is the command I tried: curl -X POST -H “Authorization: Bearer eyJ0eXAI3NMEACMUIYLs” \ -H “Content-Type: application/json” \ -d ‘{“state”: “on”, “attributes”: {“friendly_name”: “camera”}}’ \ http://192.168.1.xx:8123/api/states/binary_sensor.camera
I did reduce the size of the token here. Y the way is there an easy way to test the command outside of motioneye?
This is awesome, exactly what I was looking for so thank you!!
I have a quick question, I set this up and can successfully take a snapshot and have it send it to my phone and have it saved on homeassistant but is there a way to have it continually take snapshots and save them to homeassistant without overwriting the original snapshot? I’m looking to do this with recording motion as well.
Also in MotionEye do you have any settings enabed in terms of uploading snapshots and movies?
I’m looking to write a script that pulls the saved videos and snapshots from that directory for that day and save them onto a hard drive via smb.
First post on here and it’s to say thank you for explaining this method, got MotionEye integrated into Home Assistant really quickly after reading argykanaz post, thanks again. Works a treat if anyone else s trying to do the same.
I’ve just set up motionEye @heiblum and used the below method to get the motion sensor (as it isn’t set up by default)…
Set up the motionEye intregation (if you haven’t already)
Find the integration in Configuration > Integrations & click “Configure”
Make sure “Configure motionEye webhooks to report events to Home Assistant” is selected
Now you need to find the Device ID, the easiest way to do this is to go into motionEye, select the camera you want motion detection for and go to the “Motion Notifications” settings. Home Assistant will have auto-configured a webhook URL for the integration to use - Copy and paste this sting into a simple text editor (notepad, notes on your phone etc.)
The very end of the string will have “device_id=” - Copy the string after the = sign, this is the device id!
Create a template binary sensor with the below configuration, making sure to add your device id - I won’t rehash what’s already in the documentation in this thread on how to set these sensors up, just go here to see documentation on template sensors using triggers and the configuration of them
template:
- binary_sensor:
name: NAME FOR THIS MOTION SENSOR
state: "true"
device_class: motion
auto_off: 10 # This turns the sensor off automatically after 10 seconds, you can change this if you so wish
trigger:
platform: event
event_type: motioneye.motion_detected
event_data:
device_id: YOUR DEVICE ID
I found this thread and worked my way through it, and found the solution at the end to look the most elegant and up-to-date. However. although I hate to admit defeat, I CANNOT get it to work.
MotionEye seems to work fine and the web hook is HA generates no errors, but the moment I [Update] the template it says it is cleared then immediately says it loses connection. I don’t have a link problem because the video is coming through fine both to MotionEye and HA.
Can anyone give me a clue as to what I have configured wrongly, please?
Hi Jonathan,
I´m no longer using Motioneye because of the issue with storing on Dropbox and thus I cannot move the recordings away from HA and make them available in the cloud.
I however still have the config and I had an input boolean defined that was updated by the webhook, not by an event as you have it above:
based on the state changes of the input boolean, I could have other automations like sending notifications, etc. Not sure if it is the same what you are trying to do, but maybe this helps.
I have two cameras on my MotioneyeOS setup.
Both camera are set on “triggered on motion” for still image and video recording. And I can see the files are created when motion is detected.
In HA, I configured the template to trigger a binary_sensor on motion, for each camera.
It’s working good for the first camera. I can see the state change of the binary_sensor when motion is detected.
I copy/paste the same code for the 2nd camera, with just changing the id.
Issue, no motion is detected on HA.
When I change a parameter on the camera and press “apply”, it seems that a webhook is sent on HA at the exact time/date. So it looks like the webhook is correctly setup.
But why no motion is reported ? Is it from the motion detection parameter on MotioneyeOS, or in code writting in HA ?
Here is my code :