Motion sensor with synology camera

Hi all!

I just saw synology camera entity’s attributes, there is “motion_detection” which is fired from synology surveillance station.

So I made template motion sensor like below.

binary_sensor:
  - platform: template
    sensors:
      camera_frontdoor_motion_detect:
        value_template: "{{ is_state ( 'camera.front_door.attributes.motion_detection', 'true' ) }}"

But, unfortunately It’s not working.

Is there any references for this or idea get to work?

thanks advance!

Nervermind this question. That motion detection is not for the detecting stuff. It’s for the configuration of synology camera.

I’ve just solved to make motion sensor with this camera like below.

binary_sensor:
  - platform: template
    sensors:
      camera_frontdoor_motion_detect:
        value_template: "{{ is_state ( 'camera.front_door', 'recording' ) }}"

It has some latency to change state, but working.

Hi,
I’m resuming this old thread with a question: how can you set the motion detection status with the camera component?

I checked the underlying conponents by @snjoetw:

  • the py-synology library has enable_motion_detection() and enable_motion_detection() methods
  • the camera.synology component has both methods too.

I can’t understand if it is already available, but the docs does not explain how to use it, or if there is a missing piece in the implementation.

Hey Namadori. I’m looking into this too. I think there is a way to use the action rule wizard in SS to send a http request to HA to turn on a switch (RESTful?). I’ve posted on the forum to see if someone can help me get started with that as others seem to have accomplished this in Domoticz.

I also have just noticed that there may be an easier way, at least in my setup as my cameras only record based on motion detection. In HA, the ‘state’ of my camera is either streaming or recording so you could use the recording state to push snapshots and notifications and fire other automations.

@xbmcnut I’m not sure about you but the latency for HASS to detect the state change to “recording” is unusable for me. @zaywalker reported the latency too.

I have cracked it. There is a bug in SS that Synology gave me a patch for. POST requests working now. Patch is CPU dependent. I’ll post some info tomorrow.

2 Likes

Great news, I look forward to giving the patch a test too.

Did you get some news on this?

Best to contact Synology direct as the patch they made for me is SS version and CPU specific. Now that they know about the issue, they should come back to you pretty quickly.

1 Like

I’ll share it here since there is a lot of overlap with this and another thread. The bug that needs fixing looks like it’s related to query params. Turns out it doesn’t matter anyway because Home Assistant POST endpoints don’t read the query params (if they ever did). What’s worse is that trying to pass entity_id=my_entity will actually backfire because when it gets ignored using api/services/input_boolean/turn_on it will actually turn on all entities that are currently off! That’s certainly not what I want.

A working solution I arrived at was to call the /api/events/ endpoint using a custom event name as it doesn’t require passing a json body which the Surveillance Station Action Rule doesn’t support anyway. The full details for this approach are in my post on the other thread: Send Synology Surveillance motion events to HA switch

Thanks to @xbmcnut for getting me on the right path!