Open domolys opened 1 year ago
Thanks for the report. Do we need to post data to the endpoint? Would it work with a query parameter? e.g.:
MOTION_WEBHOOKS: http://home-assistant-host:8123/api/webhook/MY-CAM-1-random_id1239743908?some_key=some_value&anotherKey=otherValue
Yes it works, receiving for trigger.query:
<MultiDictProxy('some_key': 'some_value', 'anotherKey': 'otherValue')>
So receiving for:
trigger.query.some_key: some_value
trigger.query.anotherKey: otherValue
Thanks!
In theory, you should be able to reuse the same web hooks endpoint with multiple cameras by passing the camera name variable {cam_name}
as a query parameter:
MOTION_WEBHOOKS: http://0.0.0.0:123/webhooks/endpoint?camera={cam_name}
I've also added {img}
variable in the dev branch, so you will also be able to pass the snapshot url with something like:
MOTION_WEBHOOKS: http://0.0.0.0:123/webhooks/endpoint?camera={cam_name}&snapshot={img}
Tested passing variables as query parameter with the same webhook endpoint:
MOTION_API: true
CAM_OPTIONS:
- CAM_NAME: Cam 1
MOTION_WEBHOOKS: http://0.0.0.0:8123/api/webhook/random_id?camera={cam_name}&snapshot={img}
- CAM_NAME: Cam 2
MOTION_WEBHOOKS: http://0.0.0.0:8123/api/webhook/random_id?camera={cam_name}&snapshot={img}
- CAM_NAME: Cam 3
MOTION_WEBHOOKS: http://0.0.0.0:8123/api/webhook/random_id?camera={cam_name}&snapshot={img}
Setup of Home Assistant automation trigger:
platform: webhook
allowed_methods:
- GET
- HEAD
local_only: true
webhook_id: random_id
Both triggers trigger.query.camera and trigger.query.snapshot are receiving the variables values
Home Assistant webhook endpoint: http://your-home-assistant:8123/api/webhook/<webhook_id>
Home Assistant webhook trigger doc: https://www.home-assistant.io/docs/automation/trigger/#webhook-trigger
Thank you!
Awesome, will merger this into the main branch! I believe you should be able to configure the main MOTION_WEBHOOKS
with the variables instead of configuring each one separately.
Question about this. Not sure if I'm doing something wrong. I grab the snapshot
variable from the webhook event, along with all of the other header values, and use that to try and construct a request to AWS to get the image. I keep getting 403s.
The AWS urls will expire after some time so you may need to cache them or pull a new snapshot from the bridge.
Has this stopped working for anyone else? It stopped for me sometime in June, I just now have gotten the time to investigate. Did Wyze change something with their API? I've never had CamPlus, but maybe now I have to have it?
It doesn't seem like any motion events are being fired for me at all. I think the logs used to write when motion was detected right? Now I don't see any, just that the motion events are enabled.
I haven't changed anything with my config.
Any update on this? It's been a little while now and I still can't get motion webhooks working
ENABLE_AUDIO: true
ON_DEMAND: true
WB_AUTH: false
MOTION_API: true
MQTT: true
CAM_OPTIONS:
- CAM_NAME: Front Doorbell
AUDIO: true
MOTION_WEBHOOKS: ...
This just seems to no longer work. If not, the docs need to be updated.
(Using docker-wyze-bridge v2.5.1 with Home Assistant) This issue is concerning the wiki
The webhook automation trigger object in Home Assistant does not contain a dictionary of key value pairs for the headers of the incoming request. (GET/HEAD)
So, actually, it is not possible to use the image url and title that are available in the request header, using MOTION_WEBHOOKS :
The only way to use MOTION_WEBHOOKS option with Home Assistant is to create a different Webhook ID trigger for each camera in an automation to know from witch camera the motion is detected.
It's possible to use the MOTION_WEBHOOKS with Home Assistant, but not the way the doc is written for Home Assistant: https://github.com/mrlt8/docker-wyze-bridge/wiki/Camera-Motion#webhooks
Example of an automation triggered by two differents webhook_id:
Part of config used in Wyze Bridge for triggering the automation above:
[WyzeBridge] [MOTION] Motion detected on my-cam-1
A motion event will trigger the Home Assistant automation above, but the only available trigger data for the user is something like this:{'platform': 'webhook', 'webhook_id': 'MY-CAM-1-random_id1239743908', 'data': <MultiDictProxy()>, 'query': <MultiDictProxy()>, 'description': 'webhook', 'id': '0', 'idx': '0', 'alias': None}
...otherwise, the addon rocks!