Template state error

Hi.
I use an input number to save a float value as a global variable (something HA is still lacking :face_with_raised_eyebrow:) but I am getting an error in the logs:

TypeError: float() argument must be a string or a real number, not ‘TemplateState’

In my configuration.yaml, the input number is used as:

value_template: “{{ (states.input_number.week_total) | float | round(2) }}”

I understand there is a compatibility problem here, but how do I solve it?
Should the state be saved e.g. to a string variable before converting to a float, and if so, how do I do it in the config file?

Many thanks in advance for any assistance :wink:

value_template: "{{ states('input_number.week_total') | float(0) | round(2) }}"

Ahhh, yes!
Many thanks :slight_smile: