Template in a Value data. Why this does't work?

I have the code below in an automation and I don’t understand why it doesn’t work:

  action:
  - data:
      value: "{{ states('input_number.depuradora_minutos_tarde') | int }}"

but it works next:

  action:
  - data:
      value: 20

In Developers tools -> Templates also works…

My automation:

- id: '1597103526041'
  alias: Depuradora - Programacion tarde
  description: ''
  trigger:
  - platform: template
    value_template: "{{ state_attr('input_datetime.depuradora_programa_tarde', 'timestamp') | int  | timestamp_custom('%H:%M', False) == states('sensor.time')   }}"
  condition: []
  action:
  - data:
      value: "{{ states('input_number.depuradora_minutos_tarde') | int }}"
    entity_id: input_number.depuradora_minutos
    service: input_number.set_value
  mode: single

Thank you for you time, I am new in Home assistant and in this community, and this is my first post (first of a lot of I hope).

Change data: to data_template:

Works Perfecty, thank you so much

1 Like