It’s made of two parts (inspired what I’ve seen above, but added my own touch to it). I hope you can read through the Dutch parts.
- A generic input numbers yaml to contains the price ceiling per utility and month;
- Price ceiling yaml that uses utility meters I already had for my DSMR reader, creating sensors that now apply to the ceiling.
- Lastly, this is all being showcased on the dedicated dashboard. I use mini-graph from HACS to generate the charts.
1. Generic input numbers file
#PC stands for price ceiling
# Electricity
pc_kwh_year:
min: 0
max: 2900
initial: 2900
pc_kwh_jan:
min: 0
max: 340
initial: 340
pc_kwh_feb:
min: 0
max: 280
initial: 280
pc_kwh_mar:
min: 0
max: 268
initial: 268
pc_kwh_apr:
min: 0
max: 204
initial: 204
pc_kwh_may:
min: 0
max: 181
initial: 181
pc_kwh_jun:
min: 0
max: 159
initial: 159
pc_kwh_jul:
min: 0
max: 161
initial: 161
pc_kwh_aug:
min: 0
max: 176
initial: 176
pc_kwh_sep:
min: 0
max: 199
initial: 199
pc_kwh_oct:
min: 0
max: 267
initial: 267
pc_kwh_nov:
min: 0
max: 306
initial: 306
pc_kwh_dec:
min: 0
max: 356
initial: 356
# Gas
pc_m3_year:
min: 0
max: 1200
initial: 1200
pc_m3_jan:
min: 0
max: 221
initial: 221
pc_m3_feb:
min: 0
max: 188
initial: 188
pc_m3_mar:
min: 0
max: 159
initial: 159
pc_m3_apr:
min: 0
max: 86
initial: 86
pc_m3_may:
min: 0
max: 35
initial: 35
pc_m3_jun:
min: 0
max: 19
initial: 19
pc_m3_jul:
min: 0
max: 17
initial: 17
pc_m3_aug:
min: 0
max: 17
initial: 17
pc_m3_sep:
min: 0
max: 24
initial: 24
pc_m3_oct:
min: 0
max: 81
initial: 81
pc_m3_nov:
min: 0
max: 147
initial: 147
pc_m3_dec:
min: 0
max: 206
initial: 206
2. Template sensor (modern style)
- sensor:
# Main meta settings
- name: "Electriciteit (kWh) plafond per jaar"
unique_id: a_pc_kwh_per_year
state: >
{{ states('input_number.pc_kwh_year') | float(0) }}
- name: Gas (m³) plafond per jaar
unique_id: a_pc_m3_per_year
state: >
{{ states('input_number.pc_m3_year') | float(0) }}
# Current kWh for the month
- name: Electriciteit (kWh) plafond huidige maand
unique_id: kwh_ceiling_month
state: >-
{% if now().month == 1 %} {{ state_attr('input_number.pc_kwh_jan', 'max') }} {% endif %}
{% if now().month == 2 %} {{ state_attr('input_number.pc_kwh_feb', 'max') }} {% endif %}
{% if now().month == 3 %} {{ state_attr('input_number.pc_kwh_mar', 'max') }} {% endif %}
{% if now().month == 4 %} {{ state_attr('input_number.pc_kwh_apr', 'max') }} {% endif %}
{% if now().month == 5 %} {{ state_attr('input_number.pc_kwh_may', 'max') }} {% endif %}
{% if now().month == 6 %} {{ state_attr('input_number.pc_kwh_jun', 'max') }} {% endif %}
{% if now().month == 7 %} {{ state_attr('input_number.pc_kwh_jul', 'max') }} {% endif %}
{% if now().month == 8 %} {{ state_attr('input_number.pc_kwh_aug', 'max') }} {% endif %}
{% if now().month == 9 %} {{ state_attr('input_number.pc_kwh_sep', 'max') }} {% endif %}
{% if now().month == 10 %} {{ state_attr('input_number.pc_kwh_oct', 'max') }} {% endif %}
{% if now().month == 11 %} {{ state_attr('input_number.pc_kwh_nov', 'max') }} {% endif %}
{% if now().month == 12 %} {{ state_attr('input_number.pc_kwh_dec', 'max') }} {% endif %}
# Current m3 for the month
- name: Gas (m)³ plafond huidige maand
unique_id: m3_ceiling_month
state: >-
{% if now().month == 1 %} {{ state_attr('input_number.pc_m3_jan', 'max') }} {% endif %}
{% if now().month == 2 %} {{ state_attr('input_number.pc_m3_feb', 'max') }} {% endif %}
{% if now().month == 3 %} {{ state_attr('input_number.pc_m3_mar', 'max') }} {% endif %}
{% if now().month == 4 %} {{ state_attr('input_number.pc_m3_apr', 'max') }} {% endif %}
{% if now().month == 5 %} {{ state_attr('input_number.pc_m3_may', 'max') }} {% endif %}
{% if now().month == 6 %} {{ state_attr('input_number.pc_m3_jun', 'max') }} {% endif %}
{% if now().month == 7 %} {{ state_attr('input_number.pc_m3_jul', 'max') }} {% endif %}
{% if now().month == 8 %} {{ state_attr('input_number.pc_m3_aug', 'max') }} {% endif %}
{% if now().month == 9 %} {{ state_attr('input_number.pc_m3_sep', 'max') }} {% endif %}
{% if now().month == 10 %} {{ state_attr('input_number.pc_m3_oct', 'max') }} {% endif %}
{% if now().month == 11 %} {{ state_attr('input_number.pc_m3_nov', 'max') }} {% endif %}
{% if now().month == 12 %} {{ state_attr('input_number.pc_m3_dec', 'max') }} {% endif %}
# Calculate the consumptions
- name: Resterend electriciteit (kWh) plafond huidige maand
unique_id: kwh_ceiling_month_left
state_class: measurement
state: >
{{ states('sensor.electriciteit_kwh_plafond_huidige_maand') | float(0) - (states('sensor.energy_usage_peak_monthly') | float(0) + states('sensor.energy_usage_offpeak_monthly') | float(0)) | round(2, default=0) }}
- name: Resterend electriciteit (kWh) plafond huidige maand percentage
unique_id: kwh_ceiling_month_left_percentage
state_class: measurement
state: >
{{ ((states('sensor.resterend_electriciteit_kwh_plafond_huidige_maand') |float(0) / states('sensor.electriciteit_kwh_plafond_huidige_maand') | float(0)) * 100 ) | round(2) }}
- name: Resterend electriciteit (kWh) plafond jaar
unique_id: kwh_ceiling_year_left
state_class: measurement
state: >
{{ states('sensor.electriciteit_kwh_per_jaar') | float(0) - (states('sensor.energy_usage_peak_yearly') | float(0) + states('sensor.energy_usage_offpeak_yearly') | float(0)) | round(2, default=0) }}
- name: Resterend electriciteit (kWh) plafond huidig jaar percentage
unique_id: kwh_ceiling_year_left_percentage
state_class: measurement
state: >
{{ ((states('sensor.resterend_electriciteit_kwh_plafond_jaar') | float(0) / states('sensor.electriciteit_kwh_per_jaar') | float(0)) * 100 ) | round(2) }}
- name: Resterend gas (m³) plafond huidige maand
unique_id: m3_ceiling_month_left
state_class: measurement
state: >
{{ states('sensor.gas_m_3_plafond_huidige_maand') | float(0) - states('sensor.energy_usage_gas_monthly') | float(0) | round(2) }}
- name: Resterend gas (m³) plafond huidige maand percentage
unique_id: m3_ceiling_month_left_percentage
state_class: measurement
state: >
{{ ((states('sensor.resterend_gas_m3_plafond_huidige_maand') | float(0) / states('sensor.gas_m_3_plafond_huidige_maand') | float(0)) * 100 ) | round(2) }}
- name: Resterend gas (m³) plafond jaar
unique_id: m3_ceiling_year_left
state_class: measurement
state: >
{{ states('sensor.gas_m3_per_jaar') | float(0) - states('sensor.energy_usage_gas_yearly') | float(0) | round(2) }}
- name: Resterend gas (m³) plafond huidig jaar percentage
unique_id: m3_ceiling_year_left_percentage
state_class: measurement
state: >
{{ ((states('sensor.resterend_gas_m3_plafond_jaar') |float(0) / states('sensor.gas_m3_per_jaar') | float(0)) * 100 ) | round(2) }}
3. Dashboard yaml
- theme: minimalist-desktop
title: Energie
path: energie
badges: []
cards:
- type: vertical-stack
title: Gas m3 prijsplafond
cards:
- type: horizontal-stack
cards:
- type: vertical-stack
title: Maandelijks
cards:
- type: custom:mushroom-entity-card
entity: sensor.resterend_gas_m3_plafond_huidige_maand_percentage
icon_type: none
name: Percentage
fill_container: false
- type: custom:mushroom-entity-card
entity: sensor.resterend_gas_m3_plafond_huidige_maand
icon: mdi:window-maximize
icon_color: red
icon_type: none
name: Resterend m³
- type: custom:mushroom-entity-card
entity: sensor.gas_m_3_plafond_huidige_maand
icon: mdi:window-maximize
icon_color: pink
fill_container: false
icon_type: none
name: Plafond
- type: custom:mushroom-entity-card
entity: sensor.energy_usage_gas_monthly
icon_type: none
name: Verbruik m3
- type: vertical-stack
title: Jaarlijks
cards:
- type: custom:mushroom-entity-card
entity: sensor.resterend_gas_m3_plafond_huidig_jaar_percentage
icon_type: none
name: Percentage
fill_container: false
- type: custom:mushroom-entity-card
entity: sensor.resterend_gas_m3_plafond_jaar
icon: mdi:window-maximize
icon_color: red
icon_type: none
name: Resterend m³
- type: custom:mushroom-entity-card
entity: sensor.gas_m3_per_jaar
icon: mdi:window-maximize
icon_color: pink
fill_container: false
icon_type: none
name: Plafond
- type: custom:mushroom-entity-card
entity: sensor.energy_usage_gas_yearly
icon_type: none
name: Verbruik m3
- type: custom:mini-graph-card
entities:
- entity: sensor.gas_m_3_plafond_huidige_maand
aggregate_func: max
name: Plafond
color: red
- entity: sensor.energy_usage_gas_monthly
name: Verbruik
- entity: sensor.resterend_gas_m3_plafond_huidige_maand
name: Resterend
color: green
name: m3 huidige maand
hours_to_show: 730
group_by: date
hour24: true
- type: vertical-stack
title: Electriciteit kWh prijsplafond
cards:
- type: horizontal-stack
cards:
- type: vertical-stack
title: Maandelijks
cards:
- type: custom:mushroom-entity-card
entity: >-
sensor.resterend_electriciteit_kwh_plafond_huidige_maand_percentage
icon_type: none
name: Percentage
- type: custom:mushroom-entity-card
entity: sensor.resterend_electriciteit_kwh_plafond_huidige_maand
icon: mdi:window-maximize
icon_color: red
icon_type: none
name: Resterend kWh
- type: custom:mushroom-entity-card
entity: sensor.electriciteit_kwh_plafond_huidige_maand
icon: mdi:window-maximize
icon_type: none
name: Plafond
- type: custom:mushroom-entity-card
entity: sensor.energy_usage_peak_monthly
icon_type: none
name: Normaal
- type: custom:mushroom-entity-card
entity: sensor.energy_usage_offpeak_monthly
icon_type: none
name: Dal
- type: vertical-stack
title: Jaarlijks
cards:
- type: custom:mushroom-entity-card
entity: >-
sensor.resterend_electriciteit_kwh_plafond_huidig_jaar_percentage
icon_type: none
name: Percentage
- type: custom:mushroom-entity-card
entity: sensor.resterend_electriciteit_kwh_plafond_jaar
icon: mdi:window-maximize
icon_color: red
icon_type: none
name: Resterend kWh
- type: custom:mushroom-entity-card
entity: sensor.electriciteit_kwh_per_jaar
icon: mdi:window-maximize
icon_color: pink
icon_type: none
name: Plafond
- type: custom:mushroom-entity-card
entity: sensor.energy_usage_peak_yearly
icon_type: none
name: Normaal
- type: custom:mushroom-entity-card
entity: sensor.energy_usage_offpeak_yearly
icon_type: none
name: Dal
- type: custom:mini-graph-card
entities:
- entity: sensor.electriciteit_kwh_plafond_huidige_maand
aggregate_func: max
name: Plafond
color: red
- entity: sensor.energy_usage_peak_monthly
name: Normaal
- entity: sensor.energy_usage_offpeak_monthly
name: Dal
- entity: sensor.resterend_electriciteit_kwh_plafond_huidige_maand
name: Resterend
color: green
name: kWh huidige maand
hours_to_show: 730
group_by: date
hour24: true
Later on I might add some trending functionality, like: with the average consumption of the month, will you top over the ceiling or stay right under (on yearly, quarterly basis as well), how much extra is being topped over and pre-calculate the total utility costs per month (including service costs, etc.).
I like to build it, yet I also wish to be able to check my utility company whereas this is a special circumstance with risks for errors.
I hope this can help some other users setting up their environment and be able to monitor their price ceiling. Enjoy!