Energy dashboard and customized sensor

Hy guys, I’m going through hard times trying to create a custom sensor to add in my energy dashboard. I had read documentations, tutorials but nothing, yaml and home assistant and all the documentation are too hard for me. So I’m asking for help.
I had bought Meross smart plugs and they work localy but are not visible in energy dashboard. So I thought to create a custom sensor with a template to take the data from the real sensor and inject them into the dashboard. I had add those lines in Dev > template and those works and get all the data. I had inserted in my configuration.yaml, restarted my Pi but the dashboard don’t show the sensor.

template:
  - sensor:
      - name: FakeSensor Energy
        state: "{{ (states('sensor.meross_power_w_main_channel'))}}"
        unit_of_measurement: kWh
        device_class: energy
        state_class: total_increasing

I had read that someone had to add “last_reset” attribute to the config file but I get and errore if I add it.
Can someone please tell me what I’m doing wrong?