Delay action with a passed variable from event

Hey You! Thank you for reading this :grinning:
The code at the end of this post is an event that i am passing to an automation. I need to get the values from “event_response” to pass them in an Delay action. When i try:

delay:
seconds: ‘{{ event_response|float }}’

I get an error:
Error rendering Küche Steckdosen ResponseDauer delay template: UndefinedError: 'event_response' is undefined
also tried things like:

seconds:‘{{ event_response }}’
‘00:00:’{{ event_response }}’

The event_response_type contents are used to trigger the automation and they work… So how i can get this 3 from the event_response, so the Delay action understands the number in seconds?

{
    "event_type": "alexa_actionable_notification",
    "data": {
        "event_id": "actionable_notification_kucheon",
        "event_response": 3,
        "event_response_type": "ResponseDuration"
    }
1 Like

What value do you get when you paste

{{ event_response|float }}

in to Developer Tools / Template ?

Thank you very much for your time :slight_smile:

I got undefined… or None

The event listener gets the data from the event alexa_actionable_notification (from there have i pasted the code)

The big question is:
What is the right template to use for the event_response data from the event named alexa_actionable_notification.

Because as i understand giving the variable '{{ event_response }}' in any template in actions got undefined.

I have searched for a template in Actions that gets data from events as variables but no luck…

I don’t have an answer for you, but pasting the entire automation might give more context to others who might :wink:

You have spend some time to read, think, and try to help me…
… so thank you very much sir!

The automation looks like that:

  trigger:
  - event_data:
      event_id: actionable_notification_kucheon
      event_response_type: ResponseDuration
    event_type: alexa_actionable_notification
    platform: event
  condition: []
  action:
  - delay:
      seconds: ''{{ event_response }}''

Try

seconds: '{{trigger.event.data.event_response}}'

From thread here:

YES SIR!

Now i understand how it works… I also found the trigger.event.data but i putted also the name of the event and i got again undefined…

So… trigger.event.data looks into the data that triggered this automation and pulls out the value from the variable next to it…

Thank you and have a wonderful day :smiley:

It worked ?

Yes it worked…!
I got +1 level in Home Assistant programming from your answer :wink:
:rofl:

Nice !
I got +1 from your question :stuck_out_tongue_winking_eye: