Energy (Power) from volts X amps

Hi everyone
I am still really new but I have set up current and voltage measurements on my battery system and I would like to convert to power to display in the energy dashboard, I have a template that looks like this

  - platform: template
    sensors:

    batteryout:
        friendly_name: "Batteryout"
        unit_of_measurement: "kW"
      
        value_template: >-
          {% if states('sensor.currenttotal')|float <= 0 %}
           
            {{ (( states('sensor.currenttotal')|float * -1)*states('sensor.batteryvoltage')|float) }}
          {% else %}
            0
          {% endif %} 

Where sensor.currenttotal is calculated from several sources added up to give me my total current flowing in/out of my battery and sensor.batteryvoltage is my battery voltage.

And then I integrate the result with

- platform: integration
    source:  sensor.batteryout
    name: energy_batteryout
    unit_prefix: k
    round: 4
    method: left 

The numbers I get are correct but it gives me amp hours not Watts or k Watts. How do I tell it that the integration is power so it will show up in the energy dashboard ?
Thanks
Mark

2 Likes