Energy, Gas and Water consumption overview

Thank you for this !!!
What is the difference between daily_power and daily_power_short ?
I thought the difference had something to do with the format of the numbers. But in my case they are the same.

Or my figures are not big enough yet :slight_smile:

Does anyone know a way to reset historical data?
For some reason my gas usage a month is sky high and i cannot find the reason for it so i want it to reset all data.
Changing prices etc works perfect except for some reason the result for a month and year are corrupt.

Thanks!
Let me know if you want the configuration of specific part, my configuration is pretty custom beacause the use of DSMR-reader, Node-RED and Inverter that not everyone is uses.

I have also seen this in my utility meters.
I think the reason for this is that not every sensor resets at or before 00:00 (what should be) but at 00:01 or later, the sensor then takes that value to the next day. Can’t prove it, it’s just a guess.

I am migrating all my utility meters and sensor with calculations to Node-RED. I think I have more control and easier to make.

'%.3f'% force is to use three decimal places

1 Like

I was mostly interested in how you made some sensors like total opgewekt / dagerecord opgewekt / stroomstoringen

I’m also using DSMR + Solaredge + own made ESP watermeter. Here my current view:

“Totaal opgewekt” is a SolarEdge sensor from the SolarEdge intergration its called by default sensor.solaredge_lifetime_energy

“Dag Record” sensor is a custom sensor made in Node-RED, if you ar using Node-RED than copy the code below en change entity names to yours.

[{"id":"c818ca4d.da0878","type":"simpletime","z":"41f0d543.7bc6ec","name":"","x":270,"y":1360,"wires":[["41c6c406.a71e0c"]]},{"id":"1d68fc7c.c5bd64","type":"ha-entity","z":"41f0d543.7bc6ec","name":"hoogst opgebracht dag","server":"308f7673.f6317a","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"stroom_dag_record"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"kWh"}],"state":"payload","stateType":"msg","attributes":[{"property":"datum","value":"datum","valueType":"msg"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"block","x":950,"y":1360,"wires":[["9014b07a.edc7e"]]},{"id":"d771eff1.aff16","type":"api-current-state","z":"41f0d543.7bc6ec","name":"stroom vandaag","server":"308f7673.f6317a","version":1,"outputs":2,"halt_if":"payload","halt_if_type":"msg","halt_if_compare":"lt","override_topic":false,"entity_id":"sensor.stroom_dag_record","state_type":"str","state_location":"stroom_dag_record","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":true,"x":560,"y":1360,"wires":[["11903638.27903a"],[]]},{"id":"41c6c406.a71e0c","type":"template","z":"41f0d543.7bc6ec","name":"datum","field":"datum","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{mydom}}-{{mymonth}}-{{myyear}}","output":"str","x":410,"y":1360,"wires":[["d771eff1.aff16"]]},{"id":"4b116d44.40d3c4","type":"server-state-changed","z":"41f0d543.7bc6ec","name":"stroom vandaag","server":"308f7673.f6317a","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.stroom_vandaag_wh_naar_kwh","entityidfiltertype":"exact","outputinitially":true,"state_type":"num","haltifstate":"","halt_if_type":"num","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":100,"y":1360,"wires":[["c818ca4d.da0878"]]},{"id":"9014b07a.edc7e","type":"template","z":"41f0d543.7bc6ec","name":"bericht","field":"bericht","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Er is vandaag {{datum}} {{payload}} kWh opgewekt, dit is een nieuw dagrecord.","output":"str","x":1130,"y":1360,"wires":[["4b61ab07.f4b074","d26852a9.d143b"]]},{"id":"d26852a9.d143b","type":"api-call-service","z":"41f0d543.7bc6ec","name":"In APP Notify","server":"308f7673.f6317a","version":1,"debugenabled":false,"service_domain":"persistent_notification","service":"create","entityId":"","data":"{\"message\":\"{{bericht}}\",\"title\":\"Energie\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1310,"y":1360,"wires":[[]]},{"id":"11903638.27903a","type":"stoptimer","z":"41f0d543.7bc6ec","duration":"18","units":"Minute","payloadtype":"num","payloadval":"0","name":"","x":740,"y":1360,"wires":[["1d68fc7c.c5bd64"],[]]},{"id":"308f7673.f6317a","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

“Stroomstoringen” is a DSMR-Reader sensor

My next project is also to measure water flow, but just have a simple analog water meter. Would you like to share your project in a new post how you did this? especially the hardware

My idea was to follow this step by step guide but maybe you have a better solution.

Thanks!

For the watersensor i can keep it short. Mainly i followed the same tutorial / reading out my watermeter with a print from Thingiverse to hold it in place. I used @cmartens his way of soldering the meter.

with the followeing ESP home code:


esphome:
  name: watermeter
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: "XYZ"
  password: !secret WIFI_Password
  fast_connect: true
  manual_ip:
    static_ip: 192.1.1.1
    gateway: 192.1.1.1
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Watermeter Fallback Hotspot"
    password: "password_here"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: !secret API_Password

ota:
  password: !secret OTA_Password
  
sensor:
  - platform: pulse_counter
    pin: 14
    name: "water_per_second"
    update_interval : 1s
    accuracy_decimals: 0
    unit_of_measurement: 'Liter'
    filters:
    - multiply: 0.016666667

More information here -> ESPHome Water meter: convert liter/min to liters per day

1 Like

Where do you put the sensor code, when I put the code in my sensor.yaml, I got all kind of errors… like : is an invalid option for [sensor.template].

That error can be caused by many things, we cannot help you based on this information. Which sensors? what is your code?

Did you made any progres in Node-RED or do you (or anyone else) know a way to start from scratch for this utility meter?

Nice idea! Was also playing around with this!

Some things which I’m facing is that my electricity usage is starting with a negative amount in euro since ‘input_number.vermindering_energiebelasting_stroom’ is a negative value.

More people are facing this?

@ lubbertkramer

How did you made your prognose?

Thanks!

Hi Coen,

before I mess up my config. Another 2 stupid questions here.

1.
Before every textblock you write “utility_meter”, “input_number”, are those “sections” in configuaration.yaml?

2.
The lovelace config, where do I need to placce that? in an entity car dof in the raw config? And for the laater, where :-)?

Ok, have some running :-)…

get this:

Searched for the
“vertical-stack-in-card” but cannot really find it… is it doable via HACS or is there an alternative?

vertical-stack-in-card is replaced for the stack-in-card, which also supports horizontal stacks by using mode: horizontal.

Thank you for your code Coen! Mine looks like this right now, still have a lot of work to do but we’re getting there :slight_smile:

1 Like

Hi Coen,

I have a question for you, in your latest update you have a card displaying info about your inverter and panels.

The SolarEdge integration created a sensor called Site Details. Which displays the following info in my setup:

Solar

Can you tell me how you managed to get all the info from that sensor in one card?

Info like panel temperature, number of optimizers etc. isn’t displayed, but I guess my inverter just doesnt share that info :frowning:
Using the API itself I can fetch this data using REST, did you configure some REST-based sensors in HA?

Looking forward to your reply :slight_smile:

Hi Noël, unfortunately I also have the same information as in your screenshot. apparently solaredge no longer sends that information in their API, at least with the solaredge integration. let me know if you have found a solution.

looks good! I have also tried horizontal stacks. It does indeed look better if you make three columns with gas, water and electricity, but run into too many problems on a mobile device. what does your page look like on a mobile device?

Well I now did it kinda the lazy way, just putting the info in a Markdown card. I think a solution is to write REST sensors. You can fetch the info from the API using:

https://monitoringapi.solaredge.com/site/YOUR_SITE_ID/inventory?api_key=YOUR_API_KEY

there should be a way to get a JSON output, haven’t figured out how to do that.

Thank you!, my mobile version looks like this now:

I’m using also the attribute state (last_period) the state is for like second on it’s previous value and afterwards reset to zero.

More people are facing this issue?

image

Guys, this is driving me crazy for today. I tried to setup but can’t get the sensors to work. They dont seem to start/be recognized. I did make some configurations because there are 2 tariffs. Everything to:

  • platform: template
    sensors:

does work perfect. Also the gauges dont work at the moment, that would be a future headache :slight_smile:

# UTILITY METER

utility_meter:
  hourly_energy:
    source: sensor.power_consumption
    cycle: hourly
    tariffs:
      - peak
      - offpeak
  hourly_gas:
    source: sensor.hourly_gas_consumption
    cycle: hourly
  daily_energy:
    source: sensor.power_consumption
    cycle: daily
    tariffs:
      - peak
      - offpeak
  daily_gas:
    source: sensor.hourly_gas_consumption
    cycle: daily
  weekly_energy:
    source: sensor.power_consumption
    cycle: weekly
    tariffs:
      - peak
      - offpeak
  weekly_gas:
    source: sensor.hourly_gas_consumption
    cycle: weekly
  monthly_energy:
    source: sensor.power_consumption
    cycle: monthly
    tariffs:
      - peak
      - offpeak
  monthly_gas:
    source: sensor.hourly_gas_consumption
    cycle: monthly
  yearly_energy:
    source: sensor.power_consumption
    cycle: yearly
    tariffs:
      - peak
      - offpeak
  yearly_gas:
    source: sensor.hourly_gas_consumption
    cycle: yearly
    
input_number:
# STROOM TARIEVEN
    piek_tarief_stroom:
      name: Piektarief Stroom
      initial: 0.23
      min: 0.000
      max: 0.500
      mode: box
      step: 0.001
      unit_of_measurement: 'EUR per kWh'
    dal_tarief_stroom:
      name: Daltarief Stroom
      initial: 0.213
      min: 0.000
      max: 0.500
      mode: box
      step: 0.001
      unit_of_measurement: 'EUR per kWh'      
    vaste_leveringskosten_stroom:
      name: Vaste leveringskosten Stroom
      initial: 71.39 
      min: 0.00
      max: 100.00
      mode: box
      step: 0.01
      unit_of_measurement: 'EUR per jaar'
    netbeheerkosten_stroom:
      name: Netbeheerkosten Stroom
      initial: 252.40
      min: 0.00
      max: 400.00
      mode: box
      step: 0.01
      unit_of_measurement: 'EUR per jaar'
    # GAS TARIEVEN
    all_in_enkeltarief_gas:
      name: All-in enkeltarief Gas
      initial: 0.725 
      min: 0.000
      max: 0.999
      mode: box
      step: 0.001
      unit_of_measurement: 'EUR per m3'
    vaste_leveringskosten_gas:
      name: Vaste leveringskosten Gas
      initial: 71.39
      min: 0.00
      max: 100.00
      mode: box
      step: 0.01
      unit_of_measurement: 'EUR per jaar'
    netbeheerkosten_gas:
      name: Netbeheerkosten Gas
      initial: 191.19
      min: 0.00
      max: 300.00 
      mode: box
      step: 0.01
      unit_of_measurement: 'EUR per jaar'      
      
sensor:
  - platform: dsmr
    port: /dev/ttyUSB0
    dsmr_version: 5

  - platform: template
    sensors:
        hourly_energy:
          friendly_name: Hourly energy
          unit_of_measurement: kWh
          value_template: "{{ states('sensor.hourly_energy_offpeak')|float + states('sensor.hourly_energy_peak')|float }}"
        daily_energy:
          friendly_name: Daily energy
          unit_of_measurement: kWh
          value_template: "{{ states('sensor.daily_energy_offpeak')|float + states('sensor.daily_energy_peak')|float }}"
        weekly_energy:
          friendly_name: Weekly energy
          unit_of_measurement: kWh
          value_template: "{{ states('sensor.weekly_energy_offpeak')|float + states('sensor.weekly_energy_peak')|float }}"
        monthly_energy:
          friendly_name: Monthly energy
          unit_of_measurement: kWh
          value_template: "{{ states('sensor.monthly_energy_offpeak')|float + states('sensor.monthly_energy_peak')|float }}"
        yearly_energy:
          friendly_name: Yearly energy
          unit_of_measurement: kWh
          value_template: "{{ states('sensor.yearly_energy_offpeak')|float + states('sensor.yearly_energy_peak')|float }}"
    # LAST PERIODS GAS
        yesterday_gas:
          friendly_name: Yesterday Gas
          unit_of_measurement: m3
          value_template: "{{ state_attr('sensor.daily_gas','last_period') }}"
        last_week_gas:
          friendly_name: last Week Gas
          unit_of_measurement: m3
          value_template: "{{ state_attr('sensor.weekly_gas','last_period') }}"
        last_month_gas:
          friendly_name: last Month Gas
          unit_of_measurement: m3
          value_template: "{{ state_attr('sensor.monthly_gas','last_period') }}"
        last_year_gas:
          friendly_name: last Year Gas
          unit_of_measurement: m3
          value_template: "{{ state_attr('sensor.yearly_gas','last_period') }}"
    # LAST PERIODS energy
        yesterday_energy:
          friendly_name: Yesterday energy
          unit_of_measurement: kWh
          value_template: "{{ state_attr('sensor.daily_energy_offpeak','last_period')|float + state_attr('sensor.daily_energy_peak','last_period')|float }}"       
        last_week_energy:
          friendly_name: Last Week energy
          unit_of_measurement: kWh
          value_template: "{{ state_attr('sensor.weekly_energy_offpeak','last_period')|float + state_attr('sensor.weekly_energy_peak','last_period')|float }}"        
        last_month_energy:
          friendly_name: Last Month energy
          unit_of_measurement: kWh
          value_template: "{{ state_attr('sensor.monthly_energy_offpeak','last_period')|float + state_attr('sensor.monthly_energy_peak','last_period')|float }}"       
        last_year_energy:
          friendly_name: Last Year energy
          unit_of_measurement: kWh
          value_template: "{{ state_attr('sensor.yearly_energy_offpeak','last_period')|float + state_attr('sensor.yearly_energy_peak','last_period')|float }}"
    # SHORT energy
        daily_energy_short:
          value_template: "{{ '%.3f'%(states('sensor.daily_energy') | float) | float }}"
          unit_of_measurement: 'kWh'

        yesterday_energy_short:
          value_template: "{{ '%.3f'%(states('sensor.yesterday_energy') | float) | float }}"
          unit_of_measurement: 'kWh'

        weekly_energy_short:
          value_template: "{{ '%.3f'%(states('sensor.weekly_energy') | float) | float }}"
          unit_of_measurement: 'kWh'

        last_week_energy_short:
          value_template: "{{ '%.3f'%(states('sensor.last_week_energy') | float) | float }}"
          unit_of_measurement: 'kWh'
        
        monthly_energy_short:
          value_template: "{{ '%.3f'%(states('sensor.monthly_energy') | float) | float }}"
          unit_of_measurement: 'kWh'

        last_month_energy_short:
          value_template: "{{ '%.3f'%(states('sensor.last_month_energy') | float) | float }}"
          unit_of_measurement: 'kWh'

        yearly_energy_short:
          value_template: "{{ '%.3f'%(states('sensor.yearly_energy') | float) | float }}"
          unit_of_measurement: 'kWh'

        last_year_energy_short:
          value_template: "{{ '%.3f'%(states('sensor.last_year_energy') | float) | float }}"
          unit_of_measurement: 'kWh'

    # CACULATIONS
        energy_kwh_to_watt:
          friendly_name: 'Actueel Watt'
          unit_of_measurement: 'Watt'
          value_template: "{{ (states.sensor.power_consumption.state | float * 1000) | round(0) }}"
    #Gemiddeld
        average_gas_day:
          unit_of_measurement: 'm3'
          value_template: >-
            {% set a = states('sensor.last_month_gas') | float %}
            {{ (a / 30.41) | round(3) }}
    #Gemiddeld
        average_energy_day:
          unit_of_measurement: 'kWh'
          value_template: >-
            {% set a = states('sensor.last_month_energy') | float %}
            {{ (a / 30.41) | round(3) }} 
    # INNOVA ENERGIE
    # PRICES GAS
        today_gas_price:
          unit_of_measurement: 'EUR'
          value_template: >-
            {% set a = states('sensor.daily_gas') | float %}
            {% set b = states('input_number.all_in_enkeltarief_gas') | float %}
            {% set c = states('input_number.netbeheerkosten_gas') | float / 365 %}
            {% set d = states('input_number.vaste_leveringskosten_gas') | float / 365 %}
            {{ (((a * b) + c) + d) | round(2) }}

        yesterday_gas_price:
          unit_of_measurement: 'EUR'
          value_template: >-
            {% set a = states('sensor.yesterday_gas') | float %}
            {% set b = states('input_number.all_in_enkeltarief_gas') | float %}
            {% set c = states('input_number.netbeheerkosten_gas') | float / 365 %}
            {% set d = states('input_number.vaste_leveringskosten_gas') | float / 365 %}
            {{ (((a * b) + c) + d) | round(2) }}

        week_gas_price:
          unit_of_measurement: 'EUR'
          value_template: >-
            {% set a = states('sensor.weekly_gas') | float %}
            {% set b = states('input_number.all_in_enkeltarief_gas') | float %}
            {% set c = states('input_number.netbeheerkosten_gas') | float / 52 %}
            {% set d = states('input_number.vaste_leveringskosten_gas') | float / 52 %}
            {{ (((a * b) + c) + d) | round(2) }}

        last_week_gas_price:
          unit_of_measurement: 'EUR'
          value_template: >-
            {% set a = states('sensor.last_week_gas') | float %}
            {% set b = states('input_number.all_in_enkeltarief_gas') | float %}
            {% set c = states('input_number.netbeheerkosten_gas') | float / 52 %}
            {% set d = states('input_number.vaste_leveringskosten_gas') | float / 52 %}
            {{ (((a * b) + c) + d) | round(2) }}

        month_gas_price:
          unit_of_measurement: 'EUR'
          value_template: >-
            {% set a = states('sensor.monthly_gas') | float %}
            {% set b = states('input_number.all_in_enkeltarief_gas') | float %}
            {% set c = states('input_number.netbeheerkosten_gas') | float / 12 %}
            {% set d = states('input_number.vaste_leveringskosten_gas') | float / 12 %}
            {{ (((a * b) + c) + d) | round(2) }}

        last_month_gas_price:
          unit_of_measurement: 'EUR'
          value_template: >-
            {% set a = states('sensor.last_month_gas') | float %}
            {% set b = states('input_number.all_in_enkeltarief_gas') | float %}
            {% set c = states('input_number.netbeheerkosten_gas') | float / 12 %}
            {% set d = states('input_number.vaste_leveringskosten_gas') | float / 12 %}
            {{ (((a * b) + c) + d) | round(2) }}

        year_gas_price:
          unit_of_measurement: 'EUR'
          value_template: >-
            {% set a = states('sensor.yearly_gas') | float %}
            {% set b = states('input_number.all_in_enkeltarief_gas') | float %}
            {% set c = states('input_number.netbeheerkosten_gas') | float %}
            {% set d = states('input_number.vaste_leveringskosten_gas') | float %}
            {{ (((a * b) + c) + d) | round(2) }}

        last_year_gas_price:
          unit_of_measurement: 'EUR'
          value_template: >-
            {% set a = states('sensor.last_year_gas') | float %}
            {% set b = states('input_number.all_in_enkeltarief_gas') | float %}
            {% set c = states('input_number.netbeheerkosten_gas') | float %}
            {% set d = states('input_number.vaste_leveringskosten_gas') | float %}
            {{ (((a * b) + c) + d) | round(2) }}
            
    # PRICES energy
        today_energy_price:
          unit_of_measurement: 'EUR'
          value_template: >-
            {% set a = states('sensor.daily_energy_peak') | float %}
            {% set b = states('sensor.daily_energy_offpeak') | float %}
            {% set c = states('input_number.piek_tarief_stroom') | float %}
            {% set d = states('input_number.dal_tarief_stroom') | float %}
            {% set e = states('input_number.netbeheerkosten_stroom') | float / 365 %}
            {% set f = states('input_number.vaste_leveringskosten_stroom') | float / 365 %}
            {{ ((((a * c) + (b * c) + e) + f)) | round(2) }}
            
        yesterday_energy_price:
          unit_of_measurement: 'EUR'
          value_template: >-
            {% set a = states('sensor.yesterday_energy_peak') | float %}
            {% set b = states('sensor.yesterday_energy_offpeak') | float %}
            {% set c = states('input_number.piek_tarief_stroom') | float %}
            {% set d = states('input_number.dal_tarief_stroom') | float %}
            {% set e = states('input_number.netbeheerkosten_stroom') | float / 365 %}
            {% set f = states('input_number.vaste_leveringskosten_stroom') | float / 365 %}
            {{ ((((a * c) + (b * c) + e) + f)) | round(2) }}  
            
        week_energy_price:
          unit_of_measurement: 'EUR'
          value_template: >-
            {% set a = states('sensor.weekly_energy_peak') | float %}
            {% set b = states('sensor.weekly_energy_offpeak') | float %}
            {% set c = states('input_number.piek_tarief_stroom') | float %}
            {% set d = states('input_number.dal_tarief_stroom') | float %}
            {% set e = states('input_number.netbeheerkosten_stroom') | float / 365 %}
            {% set f = states('input_number.vaste_leveringskosten_stroom') | float / 365 %}
            {{ ((((a * c) + (b * c) + e) + f)) | round(2) }} 
            
        last_week_energy_price:
          unit_of_measurement: 'EUR'
          value_template: >-
            {% set a = states('sensor.last_week_energy_peak') | float %}
            {% set b = states('sensor.last_week_energy_offpeak') | float %}
            {% set c = states('input_number.piek_tarief_stroom') | float %}
            {% set d = states('input_number.dal_tarief_stroom') | float %}
            {% set e = states('input_number.netbeheerkosten_stroom') | float / 365 %}
            {% set f = states('input_number.vaste_leveringskosten_stroom') | float / 365 %}
            {{ ((((a * c) + (b * c) + e) + f)) | round(2) }} 
            
        month_energy_price:
          unit_of_measurement: 'EUR'
          value_template: >-
            {% set a = states('sensor.monthly_energy_peak') | float %}
            {% set b = states('sensor.monthly_energy_offpeak') | float %}
            {% set c = states('input_number.piek_tarief_stroom') | float %}
            {% set d = states('input_number.dal_tarief_stroom') | float %}
            {% set e = states('input_number.netbeheerkosten_stroom') | float / 365 %}
            {% set f = states('input_number.vaste_leveringskosten_stroom') | float / 365 %}
            {{ ((((a * c) + (b * c) + e) + f)) | round(2) }}
            
        last_month_energy_price:
          unit_of_measurement: 'EUR'
          value_template: >-
            {% set a = states('sensor.last_month_energy_peak') | float %}
            {% set b = states('sensor.last_month_energy_offpeak') | float %}
            {% set c = states('input_number.piek_tarief_stroom') | float %}
            {% set d = states('input_number.dal_tarief_stroom') | float %}
            {% set e = states('input_number.netbeheerkosten_stroom') | float / 365 %}
            {% set f = states('input_number.vaste_leveringskosten_stroom') | float / 365 %}
            {{ ((((a * c) + (b * c) + e) + f)) | round(2) }}  
            
        year_energy_price:
          unit_of_measurement: 'EUR'
          value_template: >-
            {% set a = states('sensor.yearly_energy_peak') | float %}
            {% set b = states('sensor.yearly_energy_offpeak') | float %}
            {% set c = states('input_number.piek_tarief_stroom') | float %}
            {% set d = states('input_number.dal_tarief_stroom') | float %}
            {% set e = states('input_number.netbeheerkosten_stroom') | float / 365 %}
            {% set f = states('input_number.vaste_leveringskosten_stroom') | float / 365 %}
            {{ ((((a * c) + (b * c) + e) + f)) | round(2) }}

        last_year_energy_price:
          unit_of_measurement: 'EUR'
          value_template: >-
            {% set a = states('sensor.last_year_energy_peak') | float %}
            {% set b = states('sensor.last_year_energy_offpeak') | float %}
            {% set c = states('input_number.piek_tarief_stroom') | float %}
            {% set d = states('input_number.dal_tarief_stroom') | float %}
            {% set e = states('input_number.netbeheerkosten_stroom') | float / 365 %}
            {% set f = states('input_number.vaste_leveringskosten_stroom') | float / 365 %}
            {{ ((((a * c) + (b * c) + e) + f)) | round(2) }}

Can you maybe help :smile:

EDIT: Managed to fix this. My YAML code wasn’t right