Input number helper value not correctly being represented in template string

I have an input number slider control which is used to control the default number of minutes a device stays on for. This worked perfectly until the most recent core upgrade.

The input slider is setup as a Helper as follows:

The template string I am using in the automation to automatically turn off the device is as follows:

minutes: ‘{{ states(’‘input_number.pump_time_control’’) | int }}’

When viewing the automation trace the delay is reported as 1200 even though the input slider has been set to 20 minutes. I have divided the int by 60 however this results in the automation switching the device off after 20 seconds. I have also tried changing

minutes: ‘{{ states(’‘input_number.pump_time_control’’) | int }}’
seconds: ‘{{ states(’‘input_number.pump_time_control’’) | int }}’

however this also results in the device being switched off after 20 seconds. Any help would be gratefully appreciated.

1200 seconds is 20 minutes, delay is represented in seconds in a trace… so what’s the problem?

The problem is with the reported value of 1200 the delay now runs well past 20 minutes. Prior to the upgrade it would always run to 20 minutes.

Are you sure about that? I’m using templated delays everywhere, no issues. Can you post the full automation. Also make sure you format it correctly. Your original post does not have the correct format. Use 3 backticks before and after the code to format. Backtick is shared with tilda on your keyboard.

I’m trying again as we speak. In the meantime here’s the full automation:

alias: System - Pump Timer
description: >-
  - platform: state
    entity_id: switch.esphome_device_33_relay
    to: 'on'
  - condition: state
    entity_id: input_boolean.pump_enabled
    state: 'on'
  - delay:
      minutes: '{{ states(''input_number.pump_time_control'') | int }}'
  - service: switch.turn_off
    data: {}
      entity_id: switch.esphome_device_33_relay
      device_id: 2720afb317a1be5468cdf3028887f281
mode: single

Does the relay turn on/off alot?

Also, screenshot the trace variables that show the delay

No - Typically two or three times a day.

Ok - stop press - I think the answer here is the OP being a total tool.

@petro thanks for your help on this, having tried the automation again several times it now seems to be working perfectly without any changes what so ever. Very strange and I have no explanation except maybe a system restart has sorted it?