How to use input_text to set value from trigger.event.data

I want to set the value of an input_text to a specific data field from a trigger event. What’s the proper syntax for this? One of my many iterations is below. I’ve been through hundreds of forum posts and the answer eludes me.

service: input_text.set_value
data:
  value: {{trigger.event.data.action_text}}
target:
  entity_id: input_text.status

Quote your single line templates
value: "{{trigger.event.data.action_text}}"

1 Like

Thank you both for the assistance. The solution posted was one that I had come to myself, but when it wouldn’t work properly I began to question it. With confirmation of the correct syntax and the value still not being assigned correctly, I investigated further and found that generating an event from the developer page would assign a blank value to input_text.status, but actually generating the event from the device would assign the value correctly. It turns out my syntax when generating the event from the developer page was wrong, so I likely had it “working” early on, but I was too lazy to go physically generate an event and I couldn’t get out of my own way. All sorted now. Another lesson learned. Thank you.

I’m trying to do the exact same thing - but with an input_select value.

service: input_text.set_value
data:
  value: "{{input_select.1has_tod_select}}"
target:
  entity_id: input_text.family_state

But that gives an error:

Does this value template need a different syntax?

You need to use:

  value: "{{ states('input_select.1has_tod_select') }}"
1 Like