With a little bit of planning when setting up the various sensors to be used in energy consumption tracking in Home Assistant, the Energy Dashboard can be a great tool.
Depending on where you live and what sensors you have available, the way to a good solution will vary, and might involve some shortcuts taken and concessions made. Here are my thoughts around tracking electrical power consumption, and some of the things I want to accomplish:.
- Record as exactly as possible the power consumption and cost for the whole house.
- Keep historical data.
- I started using the Energy Dashboard with the Shelly ES, by entering under “Grid consumption” the CT-clamp channel sensor that I had put on the power cable coming from my junction box situated on the sidewalk in front of my house. When I changed over from CT-clamps to Linky I removed the Shelly ES sensor and replaced it with the Linky sensor. By doing this I lost all historical data, and I now use template sensors for all Grid consumption entries to avoid this from happening again in the future.
- Visual aide with colors on the dashboard.
- E.G. change the theme to show the respective consumption numbers under the correct day-color if I ever change to the Tempo subscription plan.
- Simulate cost of a subscription plan called EDF Tempo.
- My current subscription called “Base” is for a flat rate 24 hours a day, 365 days a year. One interesting plan called “Tempo” has varying prices based on “color” and time of the day. I want to use the Energy Dashboard to simulate cost if I were to change over to this subscription plan. I will also add Template sensors for the 6 different consumption sensors that will be added if I change to EDF Tempo. I believe doing it this way will improve on the historical view and flexibility.
- Record power consumption for rooms and appliances.
- I believe one becomes more conscious of energy saving if hard numbers show details of power consumption of the various appliances in daily use. Even though the tracking device itself consumes power, I believe the potential savings rapidly makes up for this. I use 3 different tools for this:
- CT-clamps for circuits (e.g. for 1 room, 1 appliance like cooking plates or all lights on one floor).
- Smart-plugs for 1 appliance (e.g. Microwave, TV or Freezer).
- Smart-switches that reports consumption (e.g. Shelly Dimmer or Shelly 4pm).
- I believe one becomes more conscious of energy saving if hard numbers show details of power consumption of the various appliances in daily use. Even though the tracking device itself consumes power, I believe the potential savings rapidly makes up for this. I use 3 different tools for this:
I did the following to set up my Energy Dashboard:
Configure prices:
Follow instructions here.
Or add this integration.
The numbers are hard-coded in the integration. Better to use the first solution so that you can make sure yourself prices are changed at the correct moment.
Define sensor to find number of days in month.
{% if now().month in [1,3,5,7,8,10,12] %}
31
{% elif now().month in [4,6,9,11] %}
30
{% elif now().month == 2 and ((now().year-2000) % 4 > 0) %}
28
{% elif now().month == 2 and ((now().year-2000) % 4 == 0) %}
29
{% endif %}
Price actual subscription:
Daily Price:
{{ states('sensor.current_electricity_subscription_fee_edb_base') | float / states('sensor.days_in_current_month') | float }}
Dummy sensor for 0 kWh consumption.
Price at any given time according to active subscription selected (Tempo in my case):
{% if(states('input_select.edf_abonnement') == "EDF Base") %}
{{ states('input_number.tarif_edf_base') }}
{% elif(states('input_select.edf_abonnement') == "EDF HC" and states('binary_sensor.rte_tempo_heures_creuses') == "off") %}
{{ states('input_number.tarif_edf_base_hp') }}
{% elif(states('input_select.edf_abonnement') == "EDF HC" and states('binary_sensor.rte_tempo_heures_creuses') == "on") %}
{{ states('input_number.tarif_edf_base_hc') }}
{% elif(states('input_select.edf_abonnement') == "EDF Tempo" and states('binary_sensor.rte_tempo_heures_creuses') == "off" and states('sensor.rte_tempo_couleur_actuelle') == "Bleu") %}
{{ states('input_number.tarif_edf_tempo_bleu_hp') }}
{% elif(states('input_select.edf_abonnement') == "EDF Tempo" and states('binary_sensor.rte_tempo_heures_creuses') == "on" and states('sensor.rte_tempo_couleur_actuelle') == "Bleu") %}
{{ states('input_number.tarif_edf_tempo_bleu_hc') }}
{% elif(states('input_select.edf_abonnement') == "EDF Tempo" and states('binary_sensor.rte_tempo_heures_creuses') == "off" and states('sensor.rte_tempo_couleur_actuelle') == "Blanc") %}
{{ states('input_number.tarif_edf_tempo_blanc_hp') }}
{% elif(states('input_select.edf_abonnement') == "EDF Tempo" and states('binary_sensor.rte_tempo_heures_creuses') == "on" and states('sensor.rte_tempo_couleur_actuelle') == "Blanc") %}
{{ states('input_number.tarif_edf_tempo_blanc_hc') }}
{% elif(states('input_select.edf_abonnement') == "EDF Tempo" and states('binary_sensor.rte_tempo_heures_creuses') == "off" and states('sensor.rte_tempo_couleur_actuelle') == "Rouge") %}
{{ states('input_number.tarif_edf_tempo_rouge_hp') }}
{% elif(states('input_select.edf_abonnement') == "EDF Tempo" and states('binary_sensor.rte_tempo_heures_creuses') == "on" and states('sensor.rte_tempo_couleur_actuelle') == "Rouge") %}
{{ states('input_number.tarif_edf_tempo_rouge_hc') }}
{% endif %}
Create 2 sensors that will hold running cost of subscription (actual and new). I use the integration Variables+History.
Increase value every midnight:
YAML:
alias: Update electricity subscription fees
description: ""
mode: single
triggers:
- at: "00:00:01"
trigger: time
conditions: []
actions:
- action: variable.update_sensor
target:
entity_id: sensor.abo_base_total_dummy
data:
replace_attributes: false
value: "{{ states('sensor.abo_base_total') }}"
- action: variable.update_sensor
target:
entity_id: sensor.abo_current_total_dummy
data:
replace_attributes: false
value: "{{ states('sensor.abo_current_total') }}"
- delay:
hours: 0
minutes: 0
seconds: 3
milliseconds: 0
- action: variable.update_sensor
target:
entity_id: sensor.abo_base_total
data:
replace_attributes: false
value: >-
{{ states('sensor.abo_base_total_dummy') | float +
states('sensor.daily_cost_edf_base_subscription') | float }}
- action: variable.update_sensor
target:
entity_id: sensor.abo_current_total
data:
replace_attributes: false
value: >-
{{ states('sensor.abo_current_total_dummy') | float +
states('sensor.daily_cost_current_subscription') | float }}
Screenshot:
Install the Integration RTE Tempo.
Define Template sensors for the various consumption sensors. I have defined for:
- My current plan
- Subscription fee.
- 6 different cost alternatives
- Simulation Tempo to be defined under Gas consumption
- Price at any given time.
- Subscription fee EDF Tempo
Add current plan, subscription fee and the 6 cost alternatives (if you think you might change to EDF Tempo in the future) to the Energy Dashboard.
Change your theme. Mine looks like this:
Tempo Énergie:
energy-grid-consumption-color-0: "#24026D"
energy-grid-consumption-color-1: "#04CA28"
energy-grid-consumption-color-2: "#5F87C7"
energy-grid-consumption-color-3: "#1057C8"
energy-grid-consumption-color-4: "#E8E8E8"
energy-grid-consumption-color-5: "#BFBFBF"
energy-grid-consumption-color-6: "#E89E8E"
energy-grid-consumption-color-7: "#FE0312"
If you want to simulate EDF Tempo, under gas consumption, add:
Current consummation. Use Price at any given time template sensor.
EDF Tempo subscription (use same method as for Base subscription.
On my mobile phone it looks like this: