Amcrest Camera - Activate motion detection based on Home and away

Hi,
I’ve just got an Amcrest Camera and got it integrated to HA. Here is the YAML Code

amcrest:
  - host: 192.168.1.50
    port: 37777
    username: admin
    password: admin123
    name: "Garage Camera"
    binary_sensors:
    - motion_detected

I am planning to activate motion detection when everyone leaves the house

- id: '1560872830'
  alias: Away Switch Off Cam On
  description: Turns off all lights and cam on when everyone leaves
  trigger:
  - entity_id: group.tracked_all
    for: 00:05:00
    platform: state
    to: not_home
  action:
  - data:
      entity_id: group.common_switches
    service: switch.turn_off
  - data:
      entity_id: camera.garage_camera
    service: camera.enable_motion_detection

But motion detection doesn’t turn on and always report “Clear”
What am I missing?

Thanks in advance

I use Node-Red and works great. Easy to debug and setup.

You need to configure motion detection in the camera itself. The camera.enable_motion_detection service just enables it. Typically you’d use the camera’s web interface:

BTW, I have made changes to make the motion_detected binary_sensor use streaming events from the camera (as opposed to polling the camera.) This makes the responsiveness of the binary_sensor much better. Unfortunately I’ve been pretty busy with something else so I haven’t gotten around to submitting the changes yet. I hope to do that soon.

Thank you very much. I’ll enable it through the app and see if it turns on and off based on home - away setting.