Energy sensor based on other sensor

Hi all,

If this has already been replied in other topics, sorry about that.

I currently have an EV charging station that is smart but I don’t have direct access to it through Home Assistant.
Nonetheless, I would like to have a sensor in Home Assistant that tracks the amount of energy used by the car.
Since I have a “total consumption” sensor provided by my electricity meter, I was wondering if I could trigger a second sensor that only starts counting if the first sensor value is above a certain amount (e.g. 11.2kw). If the sensor value is above the mentioned amount, always consider 11.2kw for the car charging sensor. If the first sensor value drops below that value, stop tracking the consumption in the second sensor. I know this can not be the best way to track the car charging consumption but I don’t have a lot of other options.

Thank you for your help.
Best regards,
Eduardo

Hi, create a template sensor that will hold the ev_power, then riemann helper for energy sensor that you can add in the energy dashboard

just roughly:

sensor:
  - name: "EV Power"
    unit_of_measurement: W
    device_class: power
    icon: mdi:car-battery
    state: >
      {% set total = states('sensor.total_consumption')| int(0) %}
      {% if (total > 11200 ) %}
        11200
      {% else %} 0
      {% endif %}

Thank you rekenarr.
I will test the sensors as soon as I charge the car again.
I let you know if it worked.