A long time ago I found a post for created sensors from daily to yearly, history, costs and more data for creating your own energy cards.
I can not find the original maker or posts anymore (for the credits).
But HA has changed a lot and I did learn a bit haha, so i decided to rewrite the sensors and put it in a package, also created extra sensors for energy production.
I would like to share the Package so others can use it if they like (without the forum and sharing i never came as far as i am now with HA).
## Gemiddelde over een maand ##
# Gemiddeld Energy Day
- name: "Average Energy Day"
unique_id: "average_energy_day"
unit_of_measurement: "kWh"
device_class: energy
state_class: total
state: >
{% set a = states('sensor.last_month_energy') | float %}
{{ (a / 30.41) | round(1) }}
availability: "{{ has_value('sensor.last_month_energy') }}"
# Gemiddeld Energy Return Day
- name: "Average Energy Day Returned"
unique_id: "average_energy_day_returned"
unit_of_measurement: "kWh"
device_class: energy
state_class: total
state: >
{% set a = states('sensor.last_month_energy_returned') | float %}
{{ (a / 30.41) | round(1) }}
availability: "{{ has_value('sensor.last_month_energy_returned') }}"
# Gemiddeld Gas Day
- name: "Average Gas Day"
unique_id: "average_gas_day"
unit_of_measurement: "m³"
device_class: gas
state_class: total
state: >
{% set a = states('sensor.last_month_gas') | float %}
{{ (a / 30.41) | round(1) }}
availability: "{{ has_value('sensor.last_month_gas') }}"
## CACULATIONS - kWh to Watt ##
# Current Energy kWh to Watts
- name: "Electricity Meter Energieverbruik (W)"
unique_id: "electricity_meter_energieverbruik_w"
unit_of_measurement: "W"
device_class: power
state_class: measurement
state: "{{ ( states('sensor.electricity_meter_energieverbruik') | float(0) * 1000 ) | round(0) }}"
availability: "{{ has_value('sensor.electricity_meter_energieverbruik') }}"
## Kosten gabaseerd op Levercancier Prijzen ##
## Energie ##
# Vandaag Energie Kosten
- name: "Today Energy Price"
unique_id: "today_energy_price"
unit_of_measurement: "EUR"
device_class: monetary
state_class: total
state: >
{% set a = states('sensor.daily_energy') | float %}
{% set b = states('input_number.energy_all_in_enkeltarief_stroom') | float %}
{% set c = states('input_number.energy_netbeheerkosten_stroom') | float / 365 %}
{% set d = states('input_number.energy_vaste_leveringskosten_stroom') | float / 365 %}
{% set e = states('input_number.energy_vermindering_energiebelasting_stroom') | float / 365 %}
{{ ((((a * b) + c) + d) + e) | round(2) }}
availability: "{{ has_value('sensor.daily_energy') and has_value('input_number.energy_all_in_enkeltarief_stroom') and has_value('input_number.energy_netbeheerkosten_stroom') and
has_value('input_number.energy_vaste_leveringskosten_stroom') and has_value('input_number.energy_vermindering_energiebelasting_stroom') }}"
# Gisteren Energie Kosten
- name: "Yesterday Energy Price"
unique_id: "yesterday_energy_price"
unit_of_measurement: "EUR"
device_class: monetary
state_class: total
state: >
{% set a = states('sensor.yesterday_energy') | float %}
{% set b = states('input_number.energy_all_in_enkeltarief_stroom') | float %}
{% set c = states('input_number.energy_netbeheerkosten_stroom') | float / 365 %}
{% set d = states('input_number.energy_vaste_leveringskosten_stroom') | float / 365 %}
{% set e = states('input_number.energy_vermindering_energiebelasting_stroom') | float / 365 %}
{{ ((((a * b) + c) + d) + e) | round(2) }}
availability: "{{ has_value('sensor.yesterday_energy') and has_value('input_number.energy_all_in_enkeltarief_stroom') and has_value('input_number.energy_netbeheerkosten_stroom') and
has_value('input_number.energy_vaste_leveringskosten_stroom') and has_value('input_number.energy_vermindering_energiebelasting_stroom') }}"
# Deze Week Energie Kosten
- name: "Week Energy Price"
unique_id: "week_energy_price"
unit_of_measurement: "EUR"
device_class: monetary
state_class: total
state: >
{% set a = states('sensor.weekly_energy') | float %}
{% set b = states('input_number.energy_all_in_enkeltarief_stroom') | float %}
{% set c = states('input_number.energy_netbeheerkosten_stroom') | float / 52 %}
{% set d = states('input_number.energy_vaste_leveringskosten_stroom') | float / 52 %}
{% set e = states('input_number.energy_vermindering_energiebelasting_stroom') | float / 52 %}
{{ ((((a * b) + c) + d) + e) | round(2) }}
availability: "{{ has_value('sensor.weekly_energy') and has_value('input_number.energy_all_in_enkeltarief_stroom') and has_value('input_number.energy_netbeheerkosten_stroom') and
has_value('input_number.energy_vaste_leveringskosten_stroom') and has_value('input_number.energy_vermindering_energiebelasting_stroom') }}"
# Vorige Week Energie Kosten
- name: "Last Week Energy Price"
unique_id: "last_week_energy_price"
unit_of_measurement: "EUR"
device_class: monetary
state_class: total
state: >
{% set a = states('sensor.last_week_energy') | float %}
{% set b = states('input_number.energy_all_in_enkeltarief_stroom') | float %}
{% set c = states('input_number.energy_netbeheerkosten_stroom') | float / 52 %}
{% set d = states('input_number.energy_vaste_leveringskosten_stroom') | float / 52 %}
{% set e = states('input_number.energy_vermindering_energiebelasting_stroom') | float / 52 %}
{{ ((((a * b) + c) + d) + e) | round(2) }}
availability: "{{ has_value('sensor.last_week_energy') and has_value('input_number.energy_all_in_enkeltarief_stroom') and has_value('input_number.energy_netbeheerkosten_stroom') and
has_value('input_number.energy_vaste_leveringskosten_stroom') and has_value('input_number.energy_vermindering_energiebelasting_stroom') }}"
# Deze Maand Energie Kosten
- name: "Month Energy Price"
unique_id: "month_energy_price"
unit_of_measurement: "EUR"
device_class: monetary
state_class: total
state: >
{% set a = states('sensor.monthly_energy') | float %}
{% set b = states('input_number.energy_all_in_enkeltarief_stroom') | float %}
{% set c = states('input_number.energy_netbeheerkosten_stroom') | float / 12 %}
{% set d = states('input_number.energy_vaste_leveringskosten_stroom') | float / 12 %}
{% set e = states('input_number.energy_vermindering_energiebelasting_stroom') | float / 12 %}
{{ ((((a * b) + c) + d) + e) | round(2) }}
availability: "{{ has_value('sensor.monthly_energy') and has_value('input_number.energy_all_in_enkeltarief_stroom') and has_value('input_number.energy_netbeheerkosten_stroom') and
has_value('input_number.energy_vaste_leveringskosten_stroom') and has_value('input_number.energy_vermindering_energiebelasting_stroom') }}"
# Vorige Maand Energie Kosten
- name: "Last Month Energy Price"
unique_id: "last_month_energy_price"
unit_of_measurement: "EUR"
device_class: monetary
state_class: total
state: >
{% set a = states('sensor.last_month_energy') | float %}
{% set b = states('input_number.energy_all_in_enkeltarief_stroom') | float %}
{% set c = states('input_number.energy_netbeheerkosten_stroom') | float / 12 %}
{% set d = states('input_number.energy_vaste_leveringskosten_stroom') | float / 12 %}
{% set e = states('input_number.energy_vermindering_energiebelasting_stroom') | float / 12 %}
{{ ((((a * b) + c) + d) + e) | round(2) }}
availability: "{{ has_value('sensor.last_month_energy') and has_value('input_number.energy_all_in_enkeltarief_stroom') and has_value('input_number.energy_netbeheerkosten_stroom') and
has_value('input_number.energy_vaste_leveringskosten_stroom') and has_value('input_number.energy_vermindering_energiebelasting_stroom') }}"
# Dit Jaar Energie Kosten
- name: "Year Energy Price"
unique_id: "year_energy_price"
unit_of_measurement: "EUR"
device_class: monetary
state_class: total
state: >
{% set a = states('sensor.yearly_energy') | float %}
{% set b = states('input_number.energy_all_in_enkeltarief_stroom') | float %}
{% set c = states('input_number.energy_netbeheerkosten_stroom') | float %}
{% set d = states('input_number.energy_vaste_leveringskosten_stroom') | float %}
{% set e = states('input_number.energy_vermindering_energiebelasting_stroom') | float %}
{{ ((((a * b) + c) + d) + e) | round(2) }}
availability: "{{ has_value('sensor.yearly_energy') and has_value('input_number.energy_all_in_enkeltarief_stroom') and has_value('input_number.energy_netbeheerkosten_stroom') and
has_value('input_number.energy_vaste_leveringskosten_stroom') and has_value('input_number.energy_vermindering_energiebelasting_stroom') }}"
# Vorig Jaar Energie Kosten
- name: "Last Year Energy Price"
unique_id: "last_year_energy_price"
unit_of_measurement: "EUR"
device_class: monetary
state_class: total
state: >
{% set a = states('sensor.last_year_energy') | float %}
{% set b = states('input_number.energy_all_in_enkeltarief_stroom') | float %}
{% set c = states('input_number.energy_netbeheerkosten_stroom') | float %}
{% set d = states('input_number.energy_vaste_leveringskosten_stroom') | float %}
{% set e = states('input_number.energy_vermindering_energiebelasting_stroom') | float %}
{{ ((((a * b) + c) + d) + e) | round(2) }}
availability: "{{ has_value('sensor.last_year_energy') and has_value('input_number.energy_all_in_enkeltarief_stroom') and has_value('input_number.energy_netbeheerkosten_stroom') and
has_value('input_number.energy_vaste_leveringskosten_stroom') and has_value('input_number.energy_vermindering_energiebelasting_stroom') }}"
## Gas ##
# Vandaag Gas Kosten
- name: "Today Gas Price"
unique_id: "today_gas_price"
unit_of_measurement: "EUR"
device_class: monetary
state_class: total
state: >
{% set a = states('sensor.daily_gas') | float %}
{% set b = states('input_number.energy_all_in_enkeltarief_gas') | float %}
{% set c = states('input_number.energy_netbeheerkosten_gas') | float / 365 %}
{% set d = states('input_number.energy_vaste_leveringskosten_gas') | float / 365 %}
{{ (((a * b) + c) + d) | round(2) }}
availability: "{{ has_value('sensor.daily_gas') and has_value('input_number.energy_all_in_enkeltarief_gas') and has_value('input_number.energy_netbeheerkosten_gas') and
has_value('input_number.energy_vaste_leveringskosten_gas') }}"
# Gisteren Gas Kosten
- name: "Yesterday Gas Price"
unique_id: "yesterday_gas_price"
unit_of_measurement: "EUR"
device_class: monetary
state_class: total
state: >
{% set a = states('sensor.yesterday_gas') | float %}
{% set b = states('input_number.energy_all_in_enkeltarief_gas') | float %}
{% set c = states('input_number.energy_netbeheerkosten_gas') | float / 365 %}
{% set d = states('input_number.energy_vaste_leveringskosten_gas') | float / 365 %}
{{ (((a * b) + c) + d) | round(2) }}
availability: "{{ has_value('sensor.yesterday_gas') and has_value('input_number.energy_all_in_enkeltarief_gas') and has_value('input_number.energy_netbeheerkosten_gas') and
has_value('input_number.energy_vaste_leveringskosten_gas') }}"
# Deze Week Gas Kosten
- name: "Week Gas Price"
unique_id: "week_gas_price"
unit_of_measurement: "EUR"
device_class: monetary
state_class: total
state: >
{% set a = states('sensor.weekly_gas') | float %}
{% set b = states('input_number.energy_all_in_enkeltarief_gas') | float %}
{% set c = states('input_number.energy_netbeheerkosten_gas') | float / 52 %}
{% set d = states('input_number.energy_vaste_leveringskosten_gas') | float / 52 %}
{{ (((a * b) + c) + d) | round(2) }}
availability: "{{ has_value('sensor.weekly_gas') and has_value('input_number.energy_all_in_enkeltarief_gas') and has_value('input_number.energy_netbeheerkosten_gas') and
has_value('input_number.energy_vaste_leveringskosten_gas') }}"
# Vorige Week Gas Kosten
- name: "Last Week Gas Price"
unique_id: "last_week_gas_price"
unit_of_measurement: "EUR"
device_class: monetary
state_class: total
state: >
{% set a = states('sensor.last_week_gas') | float %}
{% set b = states('input_number.energy_all_in_enkeltarief_gas') | float %}
{% set c = states('input_number.energy_netbeheerkosten_gas') | float / 52 %}
{% set d = states('input_number.energy_vaste_leveringskosten_gas') | float / 52 %}
{{ (((a * b) + c) + d) | round(2) }}
availability: "{{ has_value('sensor.last_week_gas') and has_value('input_number.energy_all_in_enkeltarief_gas') and has_value('input_number.energy_netbeheerkosten_gas') and
has_value('input_number.energy_vaste_leveringskosten_gas') }}"
# Deze Maand Gas Kosten
- name: "Month Gas Price"
unique_id: "month_gas_price"
unit_of_measurement: "EUR"
device_class: monetary
state_class: total
state: >
{% set a = states('sensor.monthly_gas') | float %}
{% set b = states('input_number.energy_all_in_enkeltarief_gas') | float %}
{% set c = states('input_number.energy_netbeheerkosten_gas') | float / 12 %}
{% set d = states('input_number.energy_vaste_leveringskosten_gas') | float / 12 %}
{{ (((a * b) + c) + d) | round(2) }}
availability: "{{ has_value('sensor.monthly_gas') and has_value('input_number.energy_all_in_enkeltarief_gas') and has_value('input_number.energy_netbeheerkosten_gas') and
has_value('input_number.energy_vaste_leveringskosten_gas') }}"
# Vorige Maand Gas Kosten
- name: "Last Month Gas Price"
unique_id: "last_month_gas_price"
unit_of_measurement: "EUR"
device_class: monetary
state_class: total
state: >
{% set a = states('sensor.last_month_gas') | float %}
{% set b = states('input_number.energy_all_in_enkeltarief_gas') | float %}
{% set c = states('input_number.energy_netbeheerkosten_gas') | float / 12 %}
{% set d = states('input_number.energy_vaste_leveringskosten_gas') | float / 12 %}
{{ (((a * b) + c) + d) | round(2) }}
availability: "{{ has_value('sensor.last_month_gas') and has_value('input_number.energy_all_in_enkeltarief_gas') and has_value('input_number.energy_netbeheerkosten_gas') and
has_value('input_number.energy_vaste_leveringskosten_gas') }}"
# Dit Jaar Gas Kosten
- name: "Year Gas Price"
unique_id: "year_gas_price"
unit_of_measurement: "EUR"
device_class: monetary
state_class: total
state: >
{% set a = states('sensor.yearly_gas') | float %}
{% set b = states('input_number.energy_all_in_enkeltarief_gas') | float %}
{% set c = states('input_number.energy_netbeheerkosten_gas') | float %}
{% set d = states('input_number.energy_vaste_leveringskosten_gas') | float %}
{{ (((a * b) + c) + d) | round(2) }}
availability: "{{ has_value('sensor.yearly_gas') and has_value('input_number.energy_all_in_enkeltarief_gas') and has_value('input_number.energy_netbeheerkosten_gas') and
has_value('input_number.energy_vaste_leveringskosten_gas') }}"
# Vorig Jaar Gas Kosten
- name: "Last Year Gas Price"
unique_id: "last_year_gas_price"
unit_of_measurement: "EUR"
device_class: monetary
state_class: total
state: >
{% set a = states('sensor.last_year_gas') | float %}
{% set b = states('input_number.energy_all_in_enkeltarief_gas') | float %}
{% set c = states('input_number.energy_netbeheerkosten_gas') | float %}
{% set d = states('input_number.energy_vaste_leveringskosten_gas') | float %}
{{ (((a * b) + c) + d) | round(2) }}
availability: "{{ has_value('sensor.last_year_gas') and has_value('input_number.energy_all_in_enkeltarief_gas') and has_value('input_number.energy_netbeheerkosten_gas') and
has_value('input_number.energy_vaste_leveringskosten_gas') }}"
Can you tell me where in which dir all this must put in , with other words , what must we put in the Configuration.yaml and what elswhere ??
Have try the last weeks , boy no result
waiting your comment ,
Thanks in advance
With kind regards
Tolwan
Yes , now i have NO errors , Thanks .
I have to change my Helpers to your names , and then i hope it will work ,
Before i forget it , on which card did you view this …
So far so good , but what i don’t get is how i get following visible
I don’t know how this is working ,
- name: “Daily Energy”
unique_id: “daily_energy”
if i look on the card i see this
Zou je mijn laatste vraag nog willen beantwoorden , wil het graag werkend hebben
Moet ik helpers aanmaken of ??
Zou je me jou card willen sturen , dan kan ik em aanpassen , maar weet dat die dan moet werken
Alvast Bedankt
Tolwan
Is er iets wat wel werkt van de sensoren. Ik denk dat je een andere energy integratie gebruikt dan DSMR en dan moet je elke entiteit veranderen met de entiteiten die je wel hebt vanuit je integratie