MotionEye, home assistant, camera motion, automation

Hey,

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?

1 Like

try replacing ’ and “” like this -

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

If you have CURL installed on a pc you can try it from the command line

Hello everybody,
Maybe one of you can help me.

i would like to make the motioneye webcontrol functional.

I use a RPi 4 where HA runs on it with the addon motioneye.

when I enter the ip the motoneye page is displayed, but the camera stream is not.

no matter whether in the browser chrome, edge, opera.

what and where do i still have to do so that the webcontrol works?

my intention is to link HA and motion via curl.

Unbena1nnt

1 Like

Thank you.

This method worked for me perfectly.

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.

Hi Everyone’

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.

1 Like

Hey, I just tried this integration with a single network camera, I get a device in HA but no camera entity, any help appreciated.

Hi,

I don’t understand how to just add the motion sensor from the motioneye. everything is installed and I have all my network cameras, but cant sees

Anyone know whats the solution?

any option to add an actual motion sensor to the areas the cameras are placed.

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)…

  1. Set up the motionEye intregation (if you haven’t already)
  2. Find the integration in Configuration > Integrations & click “Configure”
    image
  3. Make sure “Configure motionEye webhooks to report events to Home Assistant” is selected
    image
  4. 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.)
  5. The very end of the string will have “device_id=” - Copy the string after the = sign, this is the device id!
    image
  6. 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

Hopefully this helps :+1:

11 Likes

go to motion eye , select the camera you want to configure and scroll to the bottom of the config pane. THere is category called “streaming” enable it

This totally worked for me BTW. THANK YOU!!!

It gets hard to follow the thread with so many varying methods. It was very kind of you to put it together in one cohesive post.

Adjusting the light sensitivity setting pretty much cleared all the false triggers throughout the day for a camera in the staircase with window.

Hey, just a quick word of warning. The template config doesn’t work, HA flags it as wrong if you copy paste as is.

If you are able to share the error you get then I can work out what’s going wrong. It may be the integration has changed since I wrote the above

ths one was most simple for me and works geat

1 Like

Hello.

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?

Template Scipt

Thanks.

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:

###################################################
##                                               ##
##              Camera - MotionEye               ##
##                                               ##
###################################################

- id: webhook_camera_motioneye_motion
  alias: "Motioneye - Camera - Motion started"
  trigger:
    - platform: webhook
      webhook_id: motioneye-camera-started
      allowed_methods:
        - POST
      local_only: true
  action:
  - service: input_boolean.turn_on
    data:
      entity_id: input_boolean.camera_motion_detected

- id: webhook_camera_motioneye_motion_ended
  alias: "Motioneye - Camera - Motion ended"
  trigger:
    - platform: webhook
      webhook_id: motioneye-camera-ended
      allowed_methods:
        - POST
      local_only: true
  action:
  - service: input_boolean.turn_off
    data: {}
    entity_id: input_boolean.camera_motion_detected

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.

That is useful and I will try it - However, it is clearly not a helper template - where have you embedded that code, please?
Thank you.

Oh, I can see - It is a Toggle Template Helper.

Yes I use YAML directly, so I have it in the configuration file, but indeed I can see it under helpers as type toggle indeed.

The code above is part of automations

Hello,

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 :

- trigger:
    - platform: event
      event_type: motioneye.motion_detected
      event_data:
        device_id: 17929d282c91668cda7728ba53cc1d78
      
  binary_sensor:
    - name: "mouvement garage"
      state: "true"
      device_class: motion
      auto_off: 10
      
- trigger:
    - platform: event
      event_type: motioneye.motion_detected
      event_data:
        device_id: fa4ddfad28cf3ea9dab81b1c754844be
      
  binary_sensor:
    - name: "mouvement jardin"
      state: "true"
      device_class: motion
      auto_off: 10

Thanks for your help