martinarva/dynamic_energy_cost

Add support for Wh

janneho opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
I have a EV charger that reports energy in Wh.

Describe the solution you'd like
Use unit of measurement (kWh or Wh) in calculations. Now integration assumes that energy is in kWh.
Energy panel works fine with Wh.

I would recommend to make a Wh -> kWh template sensor
`template:

  • sensor:
    • name: "Energy Consumption kWh"
      unique_id: "energy_consumption_kwh"
      state: >-
      {% set wh = states('sensor.energy_consumption_wh') | float(0) %}
      {{ (wh / 1000) | round(2) }}
      unit_of_measurement: "kWh"
      state_class: measurement
      device_class: energy
      icon: mdi:lightning-bolt`