Set integer value to attributes of an entity

I want to set Dyson fan speed from an input number. To test this i used service from developer tools. And when I use a number, it works perfectly.

But when I use a template with input number (see below) I get an error.

dyson_speed: {{states.input_number.dyson_fan_speed.state | int }}

I tried with data_template

I have tested with a light brightness also. Setting brightness from a number, but I get the same error as before.

Can anyone point me where I am doing wrong?


{{ States(input_number.somesortofname) | int }}