Need some help migrating a template sensor

Hi
I am having difficulties understanding the terminology of esphome template sensor.
i have this one and i am trying to move it from my hass sensors to the node itself.

this sensor takes the estimated advertized power usage and combine it with the uptime sensor to give me an estimation of the power used.

- platform: template
  sensors:
    shabat_plate_kwh:
      friendly_name: 'Shabat Plate Power consumption'
      entity_id: sensor.shabat_plate_power_time
      # Multiply total time 'on' by the 400w advertized power consumption of the plate
      value_template: "{{ states('sensor.shabat_plate_power_time')|float * 400 * 0.001 }} kW/h"
      device_class: power