Surveillance station camera motion detection in hass

Hi,

I would like to trigger home assistant event like
trigger:

  • platform: event
    event_type: camera_motion
    from Synology Surveillance station on camera movement. You can there define action rule - external device.
    Action can be defined by URL, user name and password. Can you help me how to trigger event based on this? I have tried somethink like https://abc.com/api/events/camera_motion but no sucess. I have https, password, hass 0.78.
    Thank you for any help.
1 Like

I just set this up last night!

So what I had to do was set up the http component in my config with a trusted_network and provide the IP address of the Surveillance station. I also had to use IP not hostname.

I have already tried
http:
trusted_networks:
- 192.168.0.30

Action for surveillance https://192.168.0.30:8123/api/events/motion_camera. Tried https. http, with password, without password. But the same result.

2018-09-28 16:30:21 ERROR (MainThread) [homeassistant.core] Error doing job: SSL handshake failed
Traceback (most recent call last):
File “uvloop/handles/stream.pyx”, line 609, in uvloop.loop.UVStream._on_eof
File “uvloop/sslproto.pyx”, line 171, in uvloop.loop._SSLPipe.feed_ssldata
File “/usr/local/lib/python3.6/ssl.py”, line 689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: HTTP_REQUEST] http request (_ssl.c:841)
2018-09-28 16:30:21 ERROR (MainThread) [homeassistant.core] Error doing job: SSL error errno:1 reason: HTTP_REQUEST
Traceback (most recent call last):
File “uvloop/sslproto.pyx”, line 504, in uvloop.loop.SSLProtocol.data_received
File “uvloop/sslproto.pyx”, line 204, in uvloop.loop._SSLPipe.feed_ssldata
File “uvloop/sslproto.pyx”, line 171, in uvloop.loop._SSLPipe.feed_ssldata
File “/usr/local/lib/python3.6/ssl.py”, line 689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: HTTP_REQUEST] http request (_ssl.c:841)

Do you have hass setup with SSL? I am using nginx to do my SSL so Hass on my local network is just running http.

Yes I have SSL lets encrypt. I dont know nginx. Do you have some tutorial you can recommend?

It is a lot of work, I would think there is a better way for you to get around it… I’ll have to think.

Can you access HA from your local network via HTTPS?

so https://abc.com

Yes I can access it this way. I have tried trigger event also via domain name but “nothing happen” also no error log. Do you know if authentication from Surveillance via user name and password works? I was thinking also to start another HA instance without SSL and password and send event via MQTT. But this is “big” workaround.

Yeah that seems like a lot of work. I was not able to get the hostname working so I had to use IP. The thing is the SSL is going to fail when you try to hit it via the IP because the cert is for the hostname not the IP.

I think the username and password is for basic auth which HA doesn’t use.

Check out this thread. I have it working by activating a script using the Action Rules.

Thanks for tip. Is this working with SSL and password authentication?

No SSL on HA but it is running the latest version with the new auth system.

This scripts calling from synology works with trusted_networks and http. Unfortunately not with https.

Maybe the new webhooks feature in 0.80 is a solution?

Good tip, will check it. Thank

I have this working using Actions on Surveillance Station and a webhook on HA.

http://10.0.1.32:8123/api/webhook/east_terrace_camera

For Example:

- alias: East Terrace Camera Detection
  initial_state: 'on'
  trigger:
  - platform: webhook
    webhook_id: east_terrace_camera
  action:
    - service: tts.google_say
      data:
       entity_id: media_player.kitchen_speaker
       message: "Motion detected by East Terrace camera"
    - service: notify.mobile_app_ash_x
      data:
        message: "East Terrace camera motion detected"

Works a treat.

Sadly, this has now stopped working. @jsg4 is having the same issue.

When the webook…

http://10.0.1.32:8123/api/webhook/carpark_camera_motion

…is entered in a browser I now get…

405: Method Not Allowed

…whereas before I’d get a ‘success’ message and my HA automation would trigger successfully when the webhook was actioned by ST.

This leads me to believe that the issue is HA related, rather than Surveillance Station, but I don’t know where to look for the issue.

Does anyone here have any idea how to get me started with a fix?

1 Like

I have tried to inspect what’s fired from Surveillance Station and it looks like a GET request instead of a POST request. I’m not sure if that’s the issue but I remember reading HA needed a POST one. What’s strange is that I downgraded to the previous version which came out in January and it seems like the same, but I know that was working as expected for a lot of people.

I’m pretty sure it’s not SS as I’ve not had my Synology that long so it’s unlikely an update that broke it.

I think it’s something in HA since I updated to 0.94.3, but can’t be sure of that.

Awesome and that makes sense. Would love a fix!