I’m trying to convert a simple “Webhook → JSON: Do action with entity” automation from an old HA v0.92 installation to the current HA version, but running into some issues understanding the changes in interface and terminology. It can be confusing trying to look up information and follow examples because there have been so many changes and the older information online is not up to date with the latest version.
For reference here is the old automation as entered in the v0.92 Automations UI:
Name: DoService
Trigger: Webhook
Action:
{
"data_template": {
"entity_id": "{{ trigger.json.entity_id }}"
},
"service_template": "{{ trigger.json.service }}"
}
As you can see, the desired service call (now a.k.a. action) and target entity_id are passed to the webhook in JSON and executed by the automation.
This generated the following in automations.yaml:
- id: '1512060478224'
alias: DoService
trigger:
- platform: webhook
webhook_id: DoService
condition: []
action:
- data_template:
entity_id: '{{ trigger.json.entity_id }}'
service_template: '{{ trigger.json.service }}'
First question: There does not seem to be any way to enter an action like this in the Action field when creating an automation in the new UI. Correct?
Second question: The Trigger field in the Create Automation UI has a right-click menu item “Edit in YAML”, but it appears to allow editing of the trigger only, not the full automation with Actions, and the Actions field does not have a similar “Edit in YAML” option. As far as I can tell, the new Automations UI no longer has the ability to create an automation like the one I am copying from the old Automations UI. I will have to edit the automations.yaml file directly?
With the changes in terminology, I think the correct format in the automations.yaml file will be:
- id: '1733699755634'
alias: DoService
description: ''
triggers:
- trigger: webhook
allowed_methods:
- POST
- PUT
local_only: true
webhook_id: -L6xg5ymBGz7M61wrBQJAd_Ph
alias: DoService
conditions: []
actions:
- action: '{{ trigger.json.service }}'
data: entity_id: '{{ trigger.json.entity_id }}'
mode: single
since “service” is now “action” and “data_template” is now “data”.
Does this seem correct? Does the entity_id have to be the internal numeric id?