HomeWizard Energy (Wi-Fi P1 meter, kWh meter, Energy Socket and Water Meter)

This is my Mobile View at the moment.

3 Likes

Nice one, did u managed to make the sum of the T1 & T2 meter? And in what way are u able to count ‘per dag’ & ‘per week’?

Thanks for sharing!

You need to create utility meters:
You can also create yearly in a easy way if you want just change the cycle to yearly

##############################
## Utility Meter            ##
##############################

utility_meter:
  energy_import_t2_dagelijks:
    source: sensor.p1_meter_total_power_import_t2
    cycle: daily

  energy_import_t1_dagelijks:
    source: sensor.p1_meter_total_power_import_t1
    cycle: daily
    
  energy_import_t2_wekelijks:
    source: sensor.p1_meter_total_power_import_t2
    cycle: weekly

  energy_import_t1_wekelijks:
    source: sensor.p1_meter_total_power_import_t1
    cycle: weekly   

  energy_import_t2_maandelijks:
    source: sensor.p1_meter_total_power_import_t2
    cycle: monthly

  energy_import_t1_maandelijks:
    source: sensor.p1_meter_total_power_import_t1
    cycle: monthly   


#  energy_export_t2_dagelijks:
#    source: sensor.p1_meter_total_power_export_t2_kwh
#    cycle: daily

#  energy_export_t1_dagelijks:
#    source: sensor.p1_meter_total_power_export_t1_kwh
#    cycle: daily

  energy_gas_dagelijks:
    source: sensor.p1_meter_total_gas
    cycle: daily
    
  energy_gas_wekelijks:
    source: sensor.p1_meter_total_gas
    cycle: weekly
    
  energy_gas_maandelijks:
    source: sensor.p1_meter_total_gas
    cycle: monthly

And a couple of sensors:

sensor:
##############################################
##                 ELEKTRA                  ##
##############################################

  - platform: template
    sensors:
      energy_import_t2_dagelijks_eur:
        friendly_name: 'Dagelijkse kosten nomaal tarief (T2)'
        value_template: "{{ (states('sensor.energy_import_t2_dagelijks')|float * states('input_number.t2_energy_cost')|float)|round(2) }}"
        unit_of_measurement: "€"
  
  - platform: template
    sensors:
      energy_import_t2_wekelijks_eur:
        friendly_name: 'Wekelijkse kosten nomaal tarief (T2)'
        value_template: "{{ (states('sensor.energy_import_t2_wekelijks')|float * states('input_number.t2_energy_cost')|float)|round(2) }}"
        unit_of_measurement: "€"

  - platform: template
    sensors:
      energy_import_t2_maandelijks_eur:
        friendly_name: 'Maandelijkse kosten nomaal tarief (T2)'
        value_template: "{{ (states('sensor.energy_import_t2_maandelijks')|float * states('input_number.t2_energy_cost')|float)|round(2) }}"
        unit_of_measurement: "€"
        
##############################################  
  
  - platform: template
    sensors:
      energy_import_t1_dagelijks_eur:
        friendly_name: 'Dagelijkse kosten dal tarief (T1)'
        value_template: "{{ (states('sensor.energy_import_t1_dagelijks')|float * states('input_number.t1_energy_cost')|float)|round(2) }}"
        unit_of_measurement: "€"

  - platform: template
    sensors:
      energy_import_t1_wekelijks_eur:
        friendly_name: 'Wekelijkse kosten dal tarief (T1)'
        value_template: "{{ (states('sensor.energy_import_t1_wekelijks')|float * states('input_number.t1_energy_cost')|float)|round(2) }}"
        unit_of_measurement: "€"

  - platform: template
    sensors:
      energy_import_t1_maandelijks_eur:
        friendly_name: 'Maandelijkse kosten dal tarief (T1)'
        value_template: "{{ (states('sensor.energy_import_t1_maandelijks')|float * states('input_number.t1_energy_cost')|float)|round(2) }}"
        unit_of_measurement: "€"
        
##############################################  		

  - platform: template
    sensors:
      energy_import_total_dagelijks_eur:
        friendly_name: 'Dagelijkse kosten dal + normaal'
        value_template: "{{ (states('sensor.energy_import_t2_dagelijks_eur')|float + states('sensor.energy_import_t1_dagelijks_eur')|float)|round(2) }}"
        unit_of_measurement: "€"

  - platform: template
    sensors:
      energy_import_total_wekelijks_eur:
        friendly_name: 'Wekelijkse kosten dal + normaal'
        value_template: "{{ (states('sensor.energy_import_t2_wekelijks_eur')|float + states('sensor.energy_import_t1_wekelijks_eur')|float)|round(2) }}"
        unit_of_measurement: "€"

  - platform: template
    sensors:
      energy_import_total_maandelijks_eur:
        friendly_name: 'Maandelijkse kosten dal + normaal'
        value_template: "{{ (states('sensor.energy_import_t2_maandelijks_eur')|float + states('sensor.energy_import_t1_maandelijks_eur')|float)|round(2) }}"
        unit_of_measurement: "€"

############################################## 

  - platform: template
    sensors:
      energy_import_total_dagelijks_kwh:
        friendly_name: 'kWh vandaag dal + normaal'
        value_template: "{{ (states('sensor.energy_import_t1_dagelijks')|float + states('sensor.energy_import_t2_dagelijks')|float)|round(2) }}"
        unit_of_measurement: "kWh"


  - platform: template
    sensors:
      energy_import_total_wekelijks_kwh:
        friendly_name: 'kWh wekelijks dal + normaal'
        value_template: "{{ (states('sensor.energy_import_t1_wekelijks')|float + states('sensor.energy_import_t2_wekelijks')|float)|round(2) }}"
        unit_of_measurement: "kWh"

  - platform: template
    sensors:
      energy_import_total_maandelijks_kwh:
        friendly_name: 'kWh maandelijks dal + normaal'
        value_template: "{{ (states('sensor.energy_import_t1_maandelijks')|float + states('sensor.energy_import_t2_maandelijks')|float)|round(2) }}"
        unit_of_measurement: "kWh"
 
 ############################################## 
 ##                    GAS                   ##
 ##############################################
 
  - platform: template
    sensors:
      energy_gas_daily_eur:
        friendly_name: 'Dagelijkse kosten gas'
        value_template: "{{ (states('sensor.energy_gas_dagelijks')|float * states('input_number.gas_energy_cost')|float)|round(2) }}"
        unit_of_measurement: "€"
  
  - platform: template
    sensors:
      energy_gas_weekly_eur:
        friendly_name: 'Wekelijkse kosten gas'
        value_template: "{{ (states('sensor.energy_gas_wekelijks')|float * states('input_number.gas_energy_cost')|float)|round(2) }}"
        unit_of_measurement: "€"
        
  - platform: template
    sensors:
      energy_gas_monthly_eur:
        friendly_name: 'Maandelijkse kosten gas'
        value_template: "{{ (states('sensor.energy_gas_maandelijks')|float * states('input_number.gas_energy_cost')|float)|round(2) }}"
        unit_of_measurement: "€"   

 ############################################## 
 ##   Totale netto kosten (Gas + electra)    ##
 ##############################################
 
  - platform: template
    sensors:
      energy_gas_en_elektriciteit_dagelijks_eur:
        friendly_name: 'Totale netto dag kosten energie'
        value_template: "{{ (states('sensor.energy_gas_daily_eur')|float + states('sensor.energy_import_total_dagelijks_eur')|float)|round(2) }}"
        unit_of_measurement: "€"

  - platform: template
    sensors:
      energy_gas_en_elektriciteit_wekelijks_eur:
        friendly_name: 'Totale netto week kosten energie'
        value_template: "{{ (states('sensor.energy_gas_weekly_eur')|float + states('sensor.energy_import_total_wekelijks_eur')|float)|round(2) }}"
        unit_of_measurement: "€"

  - platform: template
    sensors:
      energy_gas_en_elektriciteit_maandelijks_eur:
        friendly_name: 'Totale netto maand kosten energie'
        value_template: "{{ (states('sensor.energy_gas_monthly_eur')|float + states('sensor.energy_import_total_maandelijks_eur')|float)|round(2) }}"
        unit_of_measurement: "€"
3 Likes

Thanks for the info. Dashboard made with Grafana?

Nope only mini graph cards in a stack

Repreducing the graphs from the P1 Energy Meter app in HA.
Still a work in prgress.

Energy_Meter

5 Likes

Guess you’re using: apexcharts-card looks smooth…

Yes, great custom card, lots of options and many new lately …

Total_Costs

Can you share that one, so I can also play with it…

sure, here it is:

type: 'custom:apexcharts-card'
graph_span: 7d
span:
  end: day
header:
  show: true
  title: Totale energie kosten per dag in €
apex_config:
  chart:
    type: area
    height: 315
  stroke:
    show: true
    width: 1
    curve: smooth
  legend:
    show: true
  dataLabels:
    enabled: true
  fill:
    type: gradient
    gradient:
      shadeIntensity: 0.1
      opacityFrom: 0.25
      opacityTo: 1
      inverseColors: true
      stops:
        - 0
        - 90
        - 100
series:
  - color: 'rgb(138,43,226)'
    entity: sensor.energy_gas_en_elektriciteit_eur
    type: column
    group_by:
      func: max
      duration: 24h
1 Like

based on the work of @hreedijk, I did also a rebuild of the graphs, still work in progress…

5 Likes

very nice !

1 Like

Can you share your code please. It looks really nice

1 Like

Yes, code is not really clean as it’s work in progress as I’m testing with the settings and those are numerous.

First one:

type: 'custom:apexcharts-card'
graph_span: 1h
cache: true
apex_config:
  plotOptions:
    bar:
      columnWidth: 10%
  legend:
    showForSingleSeries: false
  fill:
    type: solid
    opacity: 0.2
  stroke:
    width: 1
  chart:
    height: 250px
    zoom:
      enabled: true
    toolbar:
      show: false
      tools:
        zoom: false
        zoomin: false
        zoomout: false
        pan: false
        reset: true
  xaxis:
    labels:
      format: 'HH:mm'
header:
  show: true
  show_states: true
  colorize_states: true
series:
  - entity: sensor.p1_meter_active_power
    type: area
    name: Huidig Stroom Verbruik
    curve: stepline
    group_by:
      func: raw
      duration: 1m

Second one:

type: 'custom:apexcharts-card'
graph_span: 7d
update_interval: 5m
cache: true
span:
  end: day
  offset: '-1sec'
header:
  show: true
  title: Gas en Stroom verbruik per dag
apex_config:
  xaxis:
    labels:
      format: dd-MM
      show: true
      showAlways: true
  yaxis:
    forceNiceScale: false
    decimalsInFloat: 0
    min: 0
  chart:
    type: area
    height: 300
  stroke:
    show: true
    width: 1
  legend:
    show: true
  dataLabels:
    enabled: false
    distributed: true
  fill:
    type: gradient
    gradient:
      shadeIntensity: 0.1
      opacityFrom: 0.25
      opacityTo: 1
      inverseColors: true
      stops:
        - 0
        - 90
        - 100
series:
  - entity: sensor.energy_import_total_dagelijks_kwh
    type: column
    name: Stroom
    float_precision: 2
    group_by:
      func: max
      duration: 23h59m59s
  - entity: sensor.energy_gas_dagelijks
    name: Gas
    type: column
    float_precision: 2
    group_by:
      func: max
      duration: 23h59m59s

Tirth one:

type: 'custom:apexcharts-card'
graph_span: 7d
update_interval: 5m
cache: true
span:
  end: day
  offset: '-1sec'
header:
  show: true
  title: Totale energie kosten per dag in €
apex_config:
  xaxis:
    labels:
      format: dd-MM
      show: true
      showAlways: true
  yaxis:
    forceNiceScale: false
    decimalsInFloat: 0
  chart:
    type: area
    height: 300
  stroke:
    show: true
    width: 1
  legend:
    show: true
  dataLabels:
    enabled: false
    distributed: true
  fill:
    type: gradient
    gradient:
      shadeIntensity: 0.1
      opacityFrom: 0.25
      opacityTo: 1
      inverseColors: true
      stops:
        - 0
        - 90
        - 100
series:
  - entity: sensor.energy_import_total_dagelijks_eur
    type: column
    name: Stroom
    float_precision: 2
    group_by:
      func: max
      duration: 24h
  - entity: sensor.energy_gas_daily_eur
    name: Gas
    float_precision: 2
    type: column
    group_by:
      func: max
      duration: 24h
  - color: 'rgb(128,128,128)'
    entity: sensor.energy_gas_en_elektriciteit_dagelijks_eur
    type: column
    name: Totaal
    float_precision: 2
    group_by:
      func: max
      duration: 23h59m59s
3 Likes

Thank you!

Nice,

How would you do the third one for:
a graph showing monthly usage for gas, elec consumed and elec produced?

And per year?

good question, lacking history so makes it a bit difficult to get some figures for that, but should be possible. will see if I can make something of it…

Hi everyone, how do you get the gas reading?
This is my meter:

you can use utility meter for that to get history
I’m also wondering ifs its possible to show in 1 column the total of electricity but seeing the difference between day and nighttarif, you know what i mean?
So the column is showing the total but you can distinguish

Hi
I’m using ur code for actueel verbruik

However, my bar isnt moving… for electricity and its in kw instead of W, how do i get it in W ?
I added the same for the production of my sonar panel, but today its 0 and the bar is halfway, how can that be?

Heres my code

type: custom:stack-in-card
            mode: horizontal
            cards:
              - type: gauge
                entity: sensor.dsmr_reading_electricity_currently_delivered
                max: 5000
                name: Verbruik electriciteit
                min: -5000
                severity:
                  green: 600
                  yellow: 2000
                  red: 3000
              - type: gauge
                entity: sensor.dsmr_reading_electricity_currently_returned
                max: 5000
                name: Opbrengst zonnepanelen
                min: -5000
                severity:
                  green: 600
                  yellow: 2000
                  red: 3000