Nope. That’s not where you put it.
Put it in your configuration.yaml file. You should see a line that says sensor:
Put it all under it like this:
sensor:
- platform: template
sensors:
dsmr_in_watts:
friendly_name: "Current Power Usage"
unit_of_measurement: "W"
value_template: "{{ states('sensor.dsmr_reading_electricity_currently_delivered')|float * 1000 }}"
Unless your sensor line looks like this (which I think it does by default):
sensor: !include sensors.yaml
Then you actually have to put the template sensor in your sensors.yaml file - without the first line (sensors:) like this:
- platform: template
sensors:
dsmr_in_watts:
friendly_name: "Current Power Usage"
unit_of_measurement: "W"
value_template: "{{ states('sensor.dsmr_reading_electricity_currently_delivered')|float * 1000 }}"
After saving the sensors.yaml file restarting home assistant this will create a sensor called sensor.dsmr_in_watts that you can use in your gauge card.