Templating a sensor into a text input help

Hi, I am tying to work on an automation to set the value of a text input to a sensor.


I’ve just started trying to use templates more, and just quit because of stuff like this. And advice or help for a beginner would be appreciated.
Thanks in advance

Post the full automation as text


alias: Thing
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.jiv_s_new_phone_detected_activity
condition: []
action:
  - service: input_text.set_value
    data:
      value: "{{states('sensor.jiv_s_new_phone_detected_activity'}}"
    target:
      entity_id: input_text.what_j
mode: single

The ending bracket is missing. It has to be

"{{ states('sensor.jiv_s_new_phone_detected_activity') }}"

Thanks, it works :slight_smile:

Hi,

I’m struggeling with the same problem, It doesn’t display the value of my sensor but is just displays “{{ states(‘sensor.klant_adres’) }}”

show_name: true
show_icon: true
type: button
icon_height: 50px
icon: mdi:calendar-account
tap_action:
  action: call-service
  service: input_text.set_value
  target:
    entity_id: input_text.klantadres
  data:
    value: "{{ states('sensor.klant_adres') }}"
name: adres kasper from calendar

The strange thing is that if I open my code again the value is shown as ‘"{{ states(’‘sensor.klant_adres’‘) }}"’ so the formatting is gone…