i have set up an automation using HA Automation to fire a Shortcut on my iPhone triggered by HA. It works fine but I want to bring it to NR now. What should the “data” part should look like? I don’t get this to work.
Home Assistant configuration is in YAML (either in the config file or you can see the YAML equivalent when using the UI to set things up).
Your YAML defines action (as an array) with one service call. Under that is the data object, being message and (yet another) data object. We want the entire top level ‘data’ block.
This can be hand-translated into JSON, or you can use one of the many on-line YAML to JSON converters.
As each service call has specific requirements for the data object, there is often a help list at the bottom of the node, with a ‘load example data’ button to the right. This does not always work, however it can pre-load some example data for you which may help understand the data object structure.
You can customize this behavior with the following keys in shortcut above:
Key
Values
Notes
ignore_result
Any String, e.g. "ignore"
When set, does not re-open the Home Assistant app when completed. Also prevents the below event from firing.
Hence I would add the key “ignore_result” to the data-shortcut object. The value of the key just needs to be “anything”, ie the “ignore_result” key just needs to exist.
The way that the ‘data’ object works for service calls, is that it is an object passed to the service call (and therefore the integration). Inside ‘data’ as an object we can have zero to many key: value pairs. The integration will look for certain keys that are required (probably “name” in this case) and for optional keys that may be there (“ignore_result”) which thus act like switches. Any other keys “key_to_the_door”: 21, will hopefully be ignored also.