Energy Template and daily Cost

I used the first template today to combine the three phases of my Shelly energy meter. now i have a total value. So far everything is good.

Now I would like to change this value from watts to kWh. Can someone give me a tip here.

I would then like to combine this value with my electricity price and see the daily cost. Unfortunately I found some examples in the forum, but I haven’t found a suitable one yet. Here is my current template.

  • platform: template
    sensors:
    gesamtverbrauch:
    friendly_name: ‘Gesamtverbrauch’
    unit_of_measurement: “kWh”
    value_template: “{{ (states(‘sensor.shelly_shem_3_d8bfc01a82c7_1_current_consumption’)|float + states(‘sensor.shelly_shem_3_d8bfc01a82c7_2_current_consumption’)|float + states(‘sensor.shelly_shem_3_d8bfc01a82c7_3_current_consumption’)|float)|round(3) }}”

Hi, the sensor you have created is just calculating the total current in Amps.

I think you need to check if your Shelly provides an entity for power (in W or kW) and then use the Utility Meter Integration to calculate kWh for the hour/day/month etc.

For the energy cost you need to define an input_number and set this to the energy cost in your currency/kWh. You then need another template sensor/s e.g. to multiple the hourly/daily/monthly energy from the Utility Meter by the input_number to give the cost for the ones you require.

Hi

thanks for the fast respond. I got it I think :slight_smile:

I’m trying to do the same.

Would you mind sharing what you did?

Thanks

i did this! and changed the entity to track total cost… the entity is working fine… grouping the cost daily, but in the energy dash, it is zeroed…

the input_number i created in the helper screen in config.
In cents.

Instaled (via HACS) numberbox-card for editing in lovelace:

the sensor for counting the cost:

- platform: template
    sensors:
      elsys_energy_cost_daily_1:
        friendly_name: 'Elsys Custo Diario 1'
        entity_id:
          - sensor.elsys_energy_kwh_daily_1
        value_template: "{{ (states('sensor.elsys_energy_kwh_daily_1')|float * (states('input_number.energia_custo_kwh_enel')|float/100) )  | round(3) }}"
        unit_of_measurement: "R$"

Restart HA.

Note the neew sensor working and updating cost:

Captura de Tela 2021-08-19 às 09.00.53

Than, the new sensor should be available to track de total cost:

But… ate the end, cost is zeroed in dash…

I also struggled with this problem for a long time … in the old updates it did not show anything, but there was no update of the amount, in the new one the warning ‘Unsupported unit of measure’ is now lit. Until I switched to english, the interface could not understand what the problem was … in me it was ‘RUB/кВтч’ (as in the description: ‘Следующие объекты не имеют значений в единицах измерения {currency}/кВтч или {currency}/Втч:’). After the transition, I saw that he needs your currency and in English ‘kWh’. As fixed - everything is ok.

cost_energy_tariff_peak:
name: Дневной тариф
min: 6
max: 10
step: 0.01
mode: box
unit_of_measurement: RUB/kWh

cost_energy_tariff_offpeak:
name: Ночной тариф
min: 2
max: 5
step: 0.01
mode: box
unit_of_measurement: RUB/kWh

And what should be the value unit_of_measurement for water?