Cant use template in for field of trigger automation

Hi
I get the error : Message malformed: expected float for dictionary value @ data[‘for’][‘minutes’]
when I use this template in an automation


trigger:
  - type: no_motion
    platform: device
    device_id: e0954ea41d7a6da69baeff2e9558ed13
    entity_id: binary_sensor.v4b01_motion
    domain: binary_sensor
    id: '1'
    for:
      hours: 0
      minutes: {{states('input_number.timeout_offices') |float }}
      seconds: 0

when I test this out it works perfectly and returns a float

Not sure this would work without putting ’ ’ around it or > infront of it '{{states('input_number.timeout_offices') |float }'

Does Minutes allow templates?

What does your template return in the template editor?

You created a Device Trigger and it does not support templating.

Change if to a State Trigger.

trigger:
  - platform: state
    entity_id: binary_sensor.v4b01_motion
    id: '1'
    to: 'off'
    for:
      minutes: "{{ states('input_number.timeout_offices') | int(0) }}"

Thanks this worked! Still something weird tho everytime I open the automation in the visual editor it changes the brackets to so I cant open the automation anymore :stuck_out_tongue: only in a text editor

'{{ states(' 'input_number.timeout_offices' ') | int(0) }}'