Surveillance station camera motion detection in hass

Regardless of whether Surveillance Station is being used or not, to my understanding, entering http://10.0.1.32:8123/api/webhook/carpark_camera_motion into a browser address bar should deliver a ‘success’ message, as it used to, rather than a ‘405: Method Not Allowed’ message.

Unfortunately, I do not yet have the skills to work out why this has changed in HA.

So the auth system has changed in HA do you have the computer you are hitting that endpoint from set in allowed network auth providers? I would think if that was the issue you would get a 401 not a 405 but still could be something

Thanks for the reply. How would I check that?

I’ve been trying to hit it (Mac Mini running HA) from my Macbook but need it to work from my Synology NAS.

Check this out https://www.home-assistant.io/docs/authentication/providers/#configuring-auth-providers try adding the ip of your computer and the Synology to the trusted networks and see if you still get the same error.

Thank you @w1ll1am23, but it looks like those docs are out of date. I get an ‘integratiion: auth_providers not found’ config error, and auth_providers isn’t in the Integrations list.

Auth providers should be configured under the homeassistat entry in your config.

Yes, that’s what I did, and it creates the config error as above. I find the docs often take a while to catch up with changes.

I am on 0.94.3 (I don’t think auth changed in 0.95?) and this is my config for my synology trusted network setup.

homeassistant:
  auth_providers:
    - type: homeassistant <-- this is needed for the username/password stuff to still work
    - type: trusted_networks
      trusted_networks:
        - 192.168.X.X <-- This is the IP of my synology box

Thank you.

homeassistant:
  auth_providers:
    - type: homeassistant
    - type: trusted_networks
      trusted_networks:
        - 10.0.1.190

It passes config now but still the same error with the webhook: 405: Method Not Allowed

There must be an answer to this and clearly something has changed with the HA release. I’m on 0.95.4.

Something strange that I don’t understand is going on with the webhooks.

Initially, I set up webhooks to use with Surveilance Station action rule like this:

https://10.0.1.32:8123/api/webhook/south_terrace_camera

As per my previous posts, the webook calls from SS are now resulting in a ‘405: Method Not Allowed’ message rather than a ‘success’ message.

Looking at this further it seems that HA has created some cloud webooks for me!

The code that I believe caused this is like this:

- alias: South Terrace Camera Detection
  initial_state: 'on'
  trigger:
  - platform: webhook
    webhook_id: south_terrace_camera
  condition:
    - condition: state
      entity_id: input_boolean.south_terrace_camera_active
      state: 'on'
  action:
    - service: tts.google_say
      data:
       entity_id: media_player.kitchen_speaker
       message: "Motion detected by South Terrace camera"
    - service: notify.mobile_app_ash_x
      data:
        message: "South Terrace camera motion detected"

How could this have happened?

Each of the webhooks has a generated link:

https://hooks.nabu.casa/gAAAAABdI???????????????????????????????????????????????????????????dItQ0VvG7LOC83VnfUm38=

Now, this would be fine, except that I want to keep everything in my own network rather than use the cloud service, and, the webook still returns the same 405: Method Not Allowed.

Anyone have any idea what’s going on?

I’ve tested this and creating the following automation…

- alias: Test Camera Detection
  initial_state: 'on'
  trigger:
  - platform: webhook
    webhook_id: test_camera_hook
  condition:
    - condition: state
      entity_id: input_boolean.south_terrace_camera_active
      state: 'on'
  action:
    - service: tts.google_say
      data:
       entity_id: media_player.kitchen_speaker
       message: "Motion detected by Webhook"
    - service: notify.mobile_app_ash_x
      data:
        message: "Webhook motion detected"

…as a test, resulted in the following after reloading automations!

Is it now the case that webhooks are solely for cloud use?
Previously, cloud webhooks had to be created through the front end. It now seems the ‘the hook’ is now generated just by adding a webhook triggered automation.

I have made some progress!

I can now trigger an automation using http://10.0.1.32:8123/api/webhook/carpark_camera_motion
sent as a POST request with no authorisation, using Postman app.

So, it now appears that the SS action rule no longer calls a POST request :frowning_face: when the Action Device is set to External Device. It’ll be either GET or PUT I guess but I don’t know how to figure out which.

Using terminal,
curl -X POST https://hooks.nabu.casa/gAAAAABdIakPoSs2??????????????????????????Gwk=

works fine, as does
curl -X POST http://10.0.1.32:8123/api/webhook/carpark_camera_motion.

To those with more knowledge than me, is there any way to use External Device Url to trigger an HA automation from SS camera detection now?

What SS version are you using? I’m using Version: 8.2.4-5847 but I see there is an update available to Version: 8.2.5-5850. I’ve just reactivated my webhooks on motion to test for you and it’s working even though I get 405 messages too when dropping that URL in FF.

Question: Why are you sending your SS action to an external address? I’m assuming they’re both on the same LAN?

Here is my automation:

automation:
  - alias: 'Webhook endpoint to entry motion' ## http://ip-address-of-HA:8123/api/webhook/motion_entrance ##
    hide_entity: true
    trigger:
      - platform: webhook
        webhook_id: motion_entrance ## this is the only place you create the webhook ID ##
    action:
      - service: camera.snapshot
        data:
            entity_id: camera.proxy_entry
            filename: '/config/www/images/entry_cropped.jpg'
      - service: script.turn_on
        entity_id: script.trigger_ss_entrance_boolean ## I use a script here to turn the input boolean off after 5s ##
      - service: notify.hass_synochat
        data:
          message: "Entry motion webhook fired at {{ states.sensor.time.state }}" ## appends the current time to the message ##
          data:
            file_url: http://ip-address-of-HA:8123/local/images/entry_cropped.jpg

And the script:

script:
  trigger_ss_entrance_boolean:
    alias: Trigger input boolean for motion from API
    sequence:
      - service: input_boolean.turn_on
        entity_id: input_boolean.motion_entrance
      - delay: 00:00:05
      - service: input_boolean.turn_off
        entity_id: input_boolean.motion_entrance
1 Like

Thanks for the reply.

I was just trying the external address as part of the fault finding. I’m trying to use internal address like http://10.0.1.32:8123/api/webhook/carpark_camera_motion

I’m using version 8.2.4-5847.

I’ve just contacted Synology Support as I’m able to get some consistency if the Surveillance Station Client is running and active on a Mac!

I left my Macbook running the Surveillance Station client in the foreground all day today and the alerts were afultless, but it shouldn’t be this way. Surely it should just run on the Synology Nas.

Really helpful automation, thank you.

How are you defining the camera entity?

Does the config/www/images/entry_cropped.jpg get overwritten each time or is a new file created?

What is this notification service you are using here: notify.hass_synochat?

Thanks for the help.

The camera is a proxy of one of my cameras to reduce the image size so I don’t fill up my chat platform and it’s quicker to display on mobile.

  - platform: proxy
    entity_id: camera.front_porch
    name: Proxy Entry
    max_image_width: 640
    image_refresh_rate: 2.0

The images get overwritten every time but that doesn’t matter as I’m recording on Synology anyway and the history is available in the chat platform too. The notification platform is Synology chat which works extremely well. Just remember to turn off battery optimization for that app otherwise you won’t get notifications in real time.

Did a video on how to configure that with HA here https://www.youtube.com/watch?v=Ze73EoNxOAU

guys interesting thread, but i am also unable to fire a webhook from SS
as some screenshots above, where you create the action, i dont have “external device” i can choose only webhook
so i enter my nabucasa url there
but tried with post/get , nothing works, always test failed
if i test from SSH and the CURL - X POST https://xxx , then it works…

any idea?

Hi @pergola.fabio did you manage to make it work? I have a foscam FI9901EP and I can’t get a motion_detection sensor on hassio, neither with surveillance_station nor with the switch with CGI. Were you able to do something?
Thanks

yes, got it to work, it was an SSL issue in my case
but at the moment, i dont use it anymore , i am now using DSM integration

Hi Fabio, thanks for reply,
i already have dsm integration and i have 3 cam (2 hikvision and 1 foscam) but nothing motion detection. It’s normal? do you have motion detection? can you help me to understand how cai i add motion detection with dsm integration? Thanks.

no, i dont use motion detection anymore, i have a new doorbell, dont need it anymore :slight_smile:

1 Like