How to store max value of a sensor?

I have a helper called washingmachine_maxpower with entity id : input_number.washingmachine_maxpower.

Washing machine is connnected to power with a fibaro zwave wll plug. The plug is rated for 2500 W max. It looks like the washing machine draws more than this in short moment, but the plug isnt’t warm or shuts down. I want to store max power drawn in a sensor so I can see how much the machine draws. I have made the following automation but it fails. Any ides how I can solve this?

- id: washingmachine_maxpower
  alias: 'Washing Macjine  - Max power'
  description: ''
   - above:  input_number.washingmachine_maxpower
     entity_id: sensor.fibaro_system_fgwpe_f_wall_plug_gen5_power
     platform: numeric_state
  - alias: ''
      entity_id: input_number.washingmachine_maxpower
      value: '{{ state_attr(''sensor.fibaro_system_fgwpe_f_wall_plug_gen5_power'') }}'
    service: input_number.set_value        

I get the following error:
Logger: homeassistant.config
First occurred: 13:29:01 (1 occurrences)
Last logged: 13:29:01

Invalid config for [automation]: expected float for dictionary value @ data[‘above’]. Got None. (See /config/configuration.yaml, line 13).

I think you might need to pipe the template value to a float as by default values in templates are read as strings (you can play around in Developer Tools - Template to get the syntax correct).

However … I think an automation is overkill for what you are trying to achieve, why not just use a Statistics sensor instead to record the max value:

Thanks. That solved my problem. There are so many things in HA that i struggle to get oversight over all of it. This ws a much more elegant solution.