I’ve been googling this for hours, reading Jinja doc, Yaml doc, HA doc, and it’s driving me crazy. It sounds very doable, but maybe it’s not?
I am calling a script from an automation like so:
automation:
...
action:
service: script.notify_me
data:
title: Alarm
message: SmartThings detected an alarm!
notify_data: # I want the content of this to be passed along
push:
sound:
name: default
critical: 1
volume: 0.7
The code for notify_me
is very simple:
notify_me:
description: "Send a notification to my phone"
fields:
title:
description: "The title of the notification"
example: "Snow Alert"
message:
description: "The message of the notification"
example: "Snow is coming!"
notify_data:
description: "Data to be passed along to the notify service."
sequence:
- service: notify.mobile_app_iphone
data:
title: '{{ title }}'
message: '{{ message }}'
data: '{{ notify_data }}' # <----- here is the issue!
I want to pass the notify_data
field “as is” into the sequence.data.data
field. The reason is that the notify_data
field has multiple layers and I don’t want to flatten it out, adding complexity.
How do I do that?
The syntax above gives me this error:
voluptuous.error.MultipleInvalid: expected dict for dictionary value @ data['data']
I was hoping to have something like the include
command where I can do:
data: '{{ include notify_data }}'
and the result would be
data:
push:
sound:
name: default
...