Marius82
(Marius)
February 20, 2020, 2:43pm
1
Hello,
I try to create an automation for my vaccum (Valetudo). This automation should be triggered by a webhook with the information where to clean via JSON.
In the log I can see that the automation is triggered, but nothing happens and there is no error in the logs.
I think that there is something wrong with the data_template: '{{ trigger.json.bereich }}'
Here you can see my automation:
- id: '1582208321009'
alias: staubi_test
description: ''
trigger:
- platform: webhook
webhook_id: staubi
condition: []
action:
- data:
command: zoned_cleanup
params:
zone_ids:
- data_template: ['{{ trigger.json.bereich }}']
entity_id: vacuum.rockrobo
service: vacuum.send_command
petro
(Petro)
February 20, 2020, 2:45pm
2
data_template is only for the service data section. Also entity_id should be placed in the service data section:
- id: '1582208321009'
alias: staubi_test
description: ''
trigger:
- platform: webhook
webhook_id: staubi
condition: []
action:
- service: vacuum.send_command
data_template:
entity_id: vacuum.rockrobo
command: zoned_cleanup
params:
spot_id:
- data: '{{ trigger.json.bereich }}'
Marius82
(Marius)
February 20, 2020, 3:24pm
3
I had an error in my automation insteat of spot_id I have to use zone_ids. This is an array!
I edited my code as you said, but nothing happend and I get no error
This is my code:
- id: '1582208321009'
alias: staubi_test
description: ''
trigger:
- platform: webhook
webhook_id: staubi_zone
condition: []
action:
- service: vacuum.send_command
data_template:
entity_id: vacuum.rockrobo
command: zoned_cleanup
params:
zone_ids:
- data: ['{{ trigger.json.bereich }}']
petro
(Petro)
February 20, 2020, 3:26pm
4
Are you sure you have the correct format for the zone_id’s? What integration does your vacuum come from?
Marius82
(Marius)
February 20, 2020, 3:30pm
6
If I try it without the JSON command for the zone evrything works well:
- id: '1582212412596'
alias: test2
description: ''
trigger:
- platform: webhook
webhook_id: staubi_zone
condition: []
action:
- data:
command: zoned_cleanup
params:
zone_ids:
- Flur
entity_id: vacuum.rockrobo
service: vacuum.send_command
petro
(Petro)
February 20, 2020, 3:32pm
7
Well yeah, why are you adding data to your service data every time???
- id: '1582208321009'
alias: staubi_test
description: ''
trigger:
- platform: webhook
webhook_id: staubi_zone
condition: []
action:
- service: vacuum.send_command
data_template:
entity_id: vacuum.rockrobo
command: zoned_cleanup
params:
zone_ids: [ '{{ trigger.json.bereich }}' ]
Also, you can format it like this without the json so it looks identical to your normal service calls wihtout the template…
- id: '1582208321009'
alias: staubi_test
description: ''
trigger:
- platform: webhook
webhook_id: staubi_zone
condition: []
action:
- service: vacuum.send_command
data_template:
entity_id: vacuum.rockrobo
command: zoned_cleanup
params:
zone_ids:
- '{{ trigger.json.bereich }}'