Sensor template modern style

Hi all, I’m struggling with this template sensor… first time try to use this …
here the code:

template:
  - sensor:
    - name: piano_cottura_tot_1d
      state: >
        {{ ((states.sensor.piano_cottura_1_10_1d.state|float(default=0)) +
        (states.sensor.piano_cottura_2_11_1d.state|float(default=0)) +
        (states.sensor.piano_cottura_3_12_1d.state|float(default=0)))  | round(1, default=0) }}

when I try to reeboot I have this pop_up:

The system cannot restart because the configuration is not valid: Invalid config for [sensor]: required key not provided @ data['platform']. Got None. (See /config/configuration.yaml, line 39).

I know that is a stupid question but I lost 2 hours googleing around without any result.

Solved… tks anyway

I’m guessing you put it in your sensors.yaml file instead of configuration.yaml?

Exactly!
Now I use template.yaml and it works smoothly