# Subscribing to ONVIF Motion Detection Events

**URL:** <https://community.homey.app/t/subscribing-to-onvif-motion-detection-events/6507>\
**Category:** Questions & Help\
**Tags:** security\
**Created:** [January 9, 2019, 7:53am UTC](https://community.homey.app/t/subscribing-to-onvif-motion-detection-events/6507 "2019-01-09T07:53:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marlon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marlon/32/3794_2.png) [@Marlon](https://community.homey.app/u/Marlon)\
**Post date:** [January 9, 2019, 7:53am UTC](https://community.homey.app/t/subscribing-to-onvif-motion-detection-events/6507/1 "2019-01-09T07:53:43Z")

</div>

Does anyone know if you can subscribe to an ONVIF motion detection event? I have a Dahua IP Camera connected to my Synology NAS and was wondering if it’s possible. I would like to store the event in a Virtual Device in Homey.

---

<div class="post-metadata">

**Author:** ![Sat2All](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sat2all/32/9185_2.png) [@Sat2All](https://community.homey.app/u/Sat2All)\
**Post date:** [January 10, 2019, 2:06pm UTC](https://community.homey.app/t/subscribing-to-onvif-motion-detection-events/6507/2 "2019-01-10T14:06:34Z")

</div>

You can use Image grabber to take a picture (snapshot), with a motion detector you can trigger that flow.An onvif motion detection is not possible at the moment.

for dahua use the “Not direct login” option.

---

<div class="post-metadata">

**Author:** ![Marlon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marlon/32/3794_2.png) [@Marlon](https://community.homey.app/u/Marlon)\
**Post date:** [January 11, 2019, 10:33am UTC](https://community.homey.app/t/subscribing-to-onvif-motion-detection-events/6507/3 "2019-01-11T10:33:59Z")

</div>

After some digging I found that it is possible to connect to the onvif service of the camera e.g.  
`http://<camera-ip>/onvif/device_service`

And using a tool like ONVIF Device Manager you can actually see the events as they occur.

 ![ONVIF%20Device%20Manager%20events](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/6/65642f88fa8f23ec3154614caebff2bd1f0e4430.png)

In order to actually subscribe to an event you need to instantiate a Subscription Manager and afterwards subscribe to events. More info on this [here](https://www.onvif.org/specs/core/ONVIF-Core-Specification-v250.pdf)

Bottom line is that it will require quite an amount of work to register those in Homey.

---

<div class="post-metadata">

**Author:** ![Marlon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marlon/32/3794_2.png) [@Marlon](https://community.homey.app/u/Marlon)\
**Post date:** [January 11, 2019, 4:26pm UTC](https://community.homey.app/t/subscribing-to-onvif-motion-detection-events/6507/4 "2019-01-11T16:26:53Z")

</div>

This might even be simpler. A NodeJS Module for Dahua : **[node-dahua-api](https://github.com/nayrnet/node-dahua-api)**

---

<div class="post-metadata">

**Author:** ![Robin\_van\_Kekem](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robin_van_kekem/32/8187_2.png) [@Robin\_van\_Kekem](https://community.homey.app/u/Robin_van_Kekem)\
**Post date:** [January 13, 2019, 12:43am UTC](https://community.homey.app/t/subscribing-to-onvif-motion-detection-events/6507/5 "2019-01-13T00:43:42Z")

</div>

Wouldn’t it be more generic if you’d could subscribe to motion events on Surveillance station in your Synology?

---

<div class="post-metadata">

**Author:** ![Marlon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marlon/32/3794_2.png) [@Marlon](https://community.homey.app/u/Marlon)\
**Post date:** [January 13, 2019, 6:54am UTC](https://community.homey.app/t/subscribing-to-onvif-motion-detection-events/6507/6 "2019-01-13T06:54:43Z")

</div>

Robin, thanks for pointing me in the right direction. I found it and it works!

Below are the steps used to getting it up and running. This works for me and is hopefully useful for anyone else interested. Some tweaking might still be necessary but you get the idea 😉

What you need to use are the **Action Rules**.

From the Main Menu in Surveillance Station (not the Homey app but the actual Surveillance Station) select Action Rule.

1. Select Rule Type. Give it a name.

 ![1%20Add%20Action%20Rule](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/e/e384814da8b886c1cd986c11d16a9a2908b3d370.png)

1. Pick Source, Device and event type.

 ![2%20Select%20Device](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/c/ca57161742b1a580c71722300b6f37f19c6f46e7.png)

1. Set external device as your Action Device. I used a HTTP request flow card in Homey to receive the notification.

 ![3%20External%20device](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/0/0ef63a0acfcd21d34fa2d6589b25a544a7a7e12b.png)

1. Set a schedule if desired.
2. Create a HTTP request flow card to recieve the notification

 ![4%20Homey%20http%20request%20flow%20card](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/b/b42f3c591bd407c5dd0cc8c4eb0678c1ad71d102.png)

1. Last but not least have fun! 🍻

---

<div class="post-metadata">

**Author:** ![Robin\_van\_Kekem](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robin_van_kekem/32/8187_2.png) [@Robin\_van\_Kekem](https://community.homey.app/u/Robin_van_Kekem)\
**Post date:** [January 14, 2019, 6:02am UTC](https://community.homey.app/t/subscribing-to-onvif-motion-detection-events/6507/7 "2019-01-14T06:02:02Z")

</div>

Great work, I wonder how I didn’t come up with this idea.

---

<div class="post-metadata">

**Author:** ![Marlon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marlon/32/3794_2.png) [@Marlon](https://community.homey.app/u/Marlon)\
**Post date:** [April 7, 2019, 9:47am UTC](https://community.homey.app/t/subscribing-to-onvif-motion-detection-events/6507/8 "2019-04-07T09:47:13Z")

</div>

To top things off use Node Red, inform Homey then send 5 motion snapshots (5 sec apart) by email.

 ![Camera%20motion%20-%20send%20mail](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/a/a04ed78c89db847062668e9170e9c6424d40c472.png)

---

<div class="post-metadata">

**Author:** ![Marlon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marlon/32/3794_2.png) [@Marlon](https://community.homey.app/u/Marlon)\
**Post date:** [April 12, 2019, 5:46am UTC](https://community.homey.app/t/subscribing-to-onvif-motion-detection-events/6507/9 "2019-04-12T05:46:16Z")

</div>

Depending on the camera-brand you can even connect using either basic or digest authentication (using curl)

 ![Camera%20motion](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/d/dba99bcb6c7e690083f0e6ed9843edf69429d5eb.png)
