aceindy
(Aceindy)
December 22, 2022, 7:25pm
21
erm… not clear if you want to send a webhook from HA or to HA…
anyway,
When sending a webhook to HA, you can pass data in json format…
f.e:
trigger:
- platform: webhook
webhook_id: Fullfilment_Order_Shopify
condition:
- condition: template
value_template: "{{ trigger.json.tracking_company == 'UPS' }}"
R3tr021
(R3tr021)
April 5, 2023, 4:03pm
22
Hi, I am trying to send a webhook from Home Assistant to another system.
I have added this code to my configuration.yaml:
rest_command: example_request: url: "https://mywebhookurl"
Now when I want to create an automation, I can’t enter rest_command.example_request
in the call service function. Also, I get an error message when I check configuration.yaml for errors:
Integration error: example_request - Integration ‘example_request’ not found.
Integration error: url - Integration ‘url’ not found.
Did I do something wrong?
vondalej
(Vondalej)
April 5, 2023, 4:19pm
23
I usually use the automations to do that where you use the restful command. The yaml looks like this
service: rest_command.example_request
Then in your config.yaml you would have that “example request” look like this.
rest_command:
example_request:
url: "https://whateverthewebhookurlis"
1 Like
vondalej
(Vondalej)
April 5, 2023, 4:32pm
24
One more thing!!! You need to reboot HA before it’ll show up in the options.
1 Like
Swimmer71
(Swimmer71)
November 21, 2023, 6:25pm
25
Hi there, I am completely new in HA and want to send webhooks FROM HA TO e.g. Synology Surveillance station, from which I got the webhook token.
So I edited following to configuration.yaml:
rest_command:
bewegung_erkannt:
url: 'http://nas:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Webhook&method="Incoming"&version=1&token="npgoOaGaH1cDbrQKWEptdKqrjioeHIJbtnZl1yg5YCHjcp37MeaCgMpAokCiy31X"'
And my automation is:
alias: XXX
description: ""
trigger:
- type: powered
platform: device
device_id: 3d6d0d7a94cb183dfa3......(shortened)
entity_id: 506d2c334bb2f6a28bb3.....(shortened)
domain: binary_sensor
condition: []
action:
- service: rest_command.bewegung_erkannt
data: {}
mode: single
Problem: The webhook either isn’t triggered or doesn’t reach the Synology. But when I manually copy the webhook link to a browser it works. Also, when I put the link directly to the shelly motion sensor in “actions”. So the webhook link is ok. Has it maybe something to do with the " used inside the link? For that reason I used ’ at the beginning and at the end.
Any ideas how to solve this?
Thorn
(Nicolas)
November 21, 2023, 7:35pm
26
Try setting the url comman in “
Like this
table_blue:
url: "http://192.168.1.34/win&PL=2&R=0&B=255&G=0"
Swimmer71
(Swimmer71)
November 21, 2023, 8:13pm
27
This doesn’t work because HA cuts the URL after the first " inside the link. Additional the editor claims an error with " in the beginning and end
Swimmer71
(Swimmer71)
November 23, 2023, 4:03pm
28
Nobody any ideas about this? I use “Studio Code Server” as editor and the link is shown correctly only when I use ’ instead of ", but still the webhook does not arrive on synology. What else I could try?
Swimmer71
(Swimmer71)
November 23, 2023, 6:00pm
29
I tried also verify_ssl
and method
because Synology assumes GET, but also tried Post and put and I changed now to a simplier token “test1234”, but no change. The link is highlighted correctly in the editor (see line below link) and if I follow the link with the mouse, it open the browser and triggers correctly.
It never triggers in automation
UPDATE 26.11.2023:
Nobody here who can help? I tried already for a week, no success!
I tried following rest_commands:
rest_command:
bewegung_erkannt1:
url: 'http://nas:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Webhook&method="Incoming"&version=1&token="test1234"'
verify_ssl: false
bewegung_erkannt2:
url: http://nas:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Webhook&method="Incoming"&version=1&token="test1234"
verify_ssl: false
bewegung_erkannt3:
url: >
'http://nas:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Webhook&method="Incoming"&version=1&token="test1234"'
verify_ssl: false
bewegung_erkannt4:
url: >
'http://nas:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Webhook&method=%22Incoming%22&version=1&token=%22test1234%22'
verify_ssl: false
bewegung_erkannt5:
url: >
"http://nas:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Webhook&method=%22Incoming%22&version=1&token=%22test1234%22"
verify_ssl: false
But no success. Here is what the LOG says.
2023-11-26 18:15:11.010 INFO (MainThread) [homeassistant.components.automation.xxx] XXX: Running automation actions
2023-11-26 18:15:11.011 INFO (MainThread) [homeassistant.components.automation.xxx] XXX: Executing step call service
2023-11-26 18:15:14.718 ERROR (MainThread) [homeassistant.components.rest_command] Client error. Url: http://nas:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Webhook&method="Incoming"&version=1&token="test1234". Error: Cannot connect to host nas:5000 ssl:default [Name has no usable address]
2023-11-26 18:15:14.720 INFO (MainThread) [homeassistant.components.automation.xxx] XXX: Executing step call service
2023-11-26 18:15:14.730 ERROR (MainThread) [homeassistant.components.rest_command] Client error. Url: http://nas:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Webhook&method="Incoming"&version=1&token="test1234". Error: Cannot connect to host nas:5000 ssl:default [Name has no usable address]
2023-11-26 18:15:14.733 INFO (MainThread) [homeassistant.components.automation.xxx] XXX: Executing step call service
2023-11-26 18:15:14.735 ERROR (MainThread) [homeassistant.components.rest_command] Client error. Url: 'http://nas:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Webhook&method="Incoming"&version=1&token="test1234"'. Error: 'http://nas:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Webhook&method=%22Incoming%22&version=1&token=%22test1234%22'
2023-11-26 18:15:14.742 INFO (MainThread) [homeassistant.components.automation.xxx] XXX: Executing step call service
2023-11-26 18:15:14.744 ERROR (MainThread) [homeassistant.components.rest_command] Client error. Url: 'http://nas:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Webhook&method=%22Incoming%22&version=1&token=%22test1234%22'. Error: 'http://nas:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Webhook&method=%22Incoming%22&version=1&token=%22test1234%22'
2023-11-26 18:15:14.752 INFO (MainThread) [homeassistant.components.automation.xxx] XXX: Executing step call service
2023-11-26 18:15:14.755 ERROR (MainThread) [homeassistant.components.rest_command] Client error. Url: "http://nas:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Webhook&method=%22Incoming%22&version=1&token=%22test1234%22". Error: %22http://nas:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Webhook&method=%22Incoming%22&version=1&token=%22test1234%22%22
Please help
xtc0r
(Xtc0r)
January 3, 2024, 10:17am
30
I’m new to this as well. But have you tried to replace nas:5000
with the actual IP of your synology NAS?
Swimmer71
(Swimmer71)
January 4, 2024, 7:20am
31
nas:5000 ist the internal http address and this works with browsers
aceindy
(Aceindy)
January 4, 2024, 5:57pm
32
No, it is the machine name, and not the IP address…
So I agree with this
Swimmer71
(Swimmer71)
January 5, 2024, 6:44pm
33
Oh wow, when I use the IP instead of the name, it works. Great! Thanks!
But is there a way to use names? I have a fix IP anyway for the NAS but it would be easier for network administration, in case I change it in future.
Thanks
PS: but it works when I tried to send webhooks from homeassistant to homeassistant:8123. Here I did not need the IP address.