MotionEye, home assistant, camera motion, automation

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