Script Fields and variables

Hi guys, I am not really new to HA and so far I have been doing my automations from UI. Now I am trying to understand more about yaml and code more complex automations.

I created a fairly complex script to notify devices and used several variables to pass some informations from the automation to the script. But now I would like to use this same script for actionable notifications and send the ACTIONS: via variable and place it in the correct place DATA:. my simplified script is this one:

alias: ZZZZZZ
sequence:
  - action: notify.mobile_app_jf_iphone
    metadata: {}
    data:
      title: "{{title}}"
      message: "{{message}}"
      data:
        - "{{data}}"
description: ""
fields:
  message:
    selector:
      text: null
    name: Message
    required: true
  title:
    selector:
      text: null
    name: Title
    required: true
  data:
    selector:
      text:
        multiline: true
    name: Data
    required: false

Thanks.

I don’t think a straight text input will work, I think you need to provide data as a dictionary.

There’s an existing Blueprint… You can take a look at its repo for an example of how to build the dictionary in a way that works.

1 Like