Template sensor not showing up

I’ve added

template: !include_dir_list templates/

to my configuration.yaml
Under templates directory created a new file: switcherEnergy.yaml with the following code:

sensor:
  - name: switcher_energy
    source: sensor.switcher_touch_bbfe_power
    unit_prefix: k
    unit_time: h
    round: 3
    method: left

The sensor is not showing up after restarting…
What am I missing??

Thanks…

Almost everything… :upside_down_face:
The only configuration key that you have used that is valid for a Template sensor is “name”.

Really?? :slight_smile:
I’ve just copied this one:
https://community.home-assistant.io/t/how-to-create-an-entity-which-measures-energy-in-kwh-based-on-an-existing-sensor-that-reports-power-in-w/478210/3?u=nron

That is not a Template sensor, it is a Riemann Sum Integral sensor, but you’re missing the platform information. Like many other sensors, Riemann sum sensors cannot be configured under the “template” top-level key, it should be configured under “sensor”.

installed it and it worked! thanks.