How do I get a custom response from an automation?

I’m trying to get it so when I ask: “What’s on my Shopping List?” it will list out all the items. Unfortunately, I can’t seem to get it working. Anyone have any ideas?

Here’s a picture of what I’ve got so far, in case it helps at all.

To do that you need to use the response variable in the service call, like so:

service: todo.get_items
target:
  entity_id:
    - todo.todo
data:
  status: needs_action
response_variable: tasks

Then it depends on what you want to do next. I’ve found having the items spoken by an Assistant to be unhelpful, it’s better to have the list sent as a notification to your mobile.

I’m on Android so I did this:

service: notify.mobile_app_8t
data:
  title: Your tasks
  message: |
    {% for entry in tasks["todo.todo"]["items"] %} -{{ entry.summary }}<br>
    {% endfor %}
  data:
    notification_icon: mdi:clipboard-list
    actions:
      - action: URI
        title: Open To-do List
        uri: /todo?entity_id=todo.todo

The URI is cool because then I can tap to open the list.

1 Like