Utility meter condition based on time/day (3 tariffs weekday, 2 tariffs weekend)

TOU meter here. 0.07 usd (2.1827thb) offpeak and 0.17usd (5.2674thb) peak.

Anyone has a example of their configuration for the tariffs?

Hi freezeke,
can you share with me you automation and tracking the costs for peak and off peak tariffs? I also have aeon HEM gen5.
thank you very much.
BR

Here you go

utility_meter:
  daily_energy:
    source: sensor.aeon_labs_zw095_home_energy_meter_gen5_energy
    cycle: daily
    tariffs:
      - peak
      - offpeak

  weekly_energy:
    source: sensor.aeon_labs_zw095_home_energy_meter_gen5_energy
    cycle: weekly
    tariffs:
      - peak
      - offpeak

  monthly_energy:
    source: sensor.aeon_labs_zw095_home_energy_meter_gen5_energy
    cycle: monthly
    tariffs:
      - peak
      - offpeak

  yearly_energy:
    source: sensor.aeon_labs_zw095_home_energy_meter_gen5_energy
    cycle: yearly
    tariffs:
      - peak
      - offpeak

The automation

#############################################################    
- alias: Change Utility Tariffs to offpeak on Weekends
  trigger:
  - platform: time
    at: '21:00:00'
  condition:
  - condition: time
    weekday:
    - fri
  action:
  - service: utility_meter.select_tariff
    data:
      entity_id:
      - utility_meter.hourly_energy
      - utility_meter.daily_energy
      - utility_meter.weekly_energy
      - utility_meter.monthly_energy
      - utility_meter.yearly_energy
      tariff: offpeak
  id: 4d522392fff440a5911f9bfa9f255db8
#############################################################  
- alias: Change Utility Tariffs to peak on Weekdays
  trigger:
  - platform: time
    at: 06:00:00
  condition:
  - condition: time
    weekday:
    - mon
    - tue
    - wed
    - thu
    - fri
  action:
  - service: utility_meter.select_tariff
    data:
      entity_id:
      - utility_meter.hourly_energy
      - utility_meter.daily_energy
      - utility_meter.weekly_energy
      - utility_meter.monthly_energy
      - utility_meter.yearly_energy
      tariff: peak
  id: 4d522392fff440a5911f9bfa9f255db8
#############################################################  
- alias: Change Utility Tariffs to offpeak on Weekdays
  trigger:
  - platform: time
    at: '21:00:00'
  condition:
  - condition: time
    weekday:
    - mon
    - tue
    - wed
    - thu
  action:
  - service: utility_meter.select_tariff
    data:
      entity_id:
      - utility_meter.hourly_energy
      - utility_meter.daily_energy
      - utility_meter.weekly_energy
      - utility_meter.monthly_energy
      - utility_meter.yearly_energy
      tariff: offpeak
  id: 3a63c294841d470f94203cc23eca278d

And the templates for the math

  - platform: template
    sensors:

     cost_today:
       friendly_name: "Kosten vandaag"
       unit_of_measurement: '€'
       value_template: "{{ (states('sensor.daily_energy_peak') | float * 0.30 + states('sensor.daily_energy_offpeak') | float * 0.20) | round(2) }}"

     daily_kwh:
      friendly_name: "Daily kWh"
      unit_of_measurement: kWh
      value_template: "{{( states('sensor.daily_energy_offpeak')|float + states('sensor.daily_energy_peak')|float) | round(2) }}"  

     yesterday_kwh:
      friendly_name: Verbruik gisteren3
      unit_of_measurement: kWh
      value_template: "{{ (state_attr('sensor.daily_energy_offpeak','last_period')|float + state_attr('sensor.daily_energy_peak','last_period')|float )| round(2)}}" 

     total_cost_month:
       friendly_name: "Totale Kosten Maand"
       unit_of_measurement: '€'
       value_template: "{{ (states('sensor.monthly_energy_peak') | float * 0.30  + states('sensor.monthly_energy_offpeak') | float * 0.20) | round(2) }}"

     monthly_kwh:
       friendly_name: "monthly kwh"
       unit_of_measurement: kWh
       value_template: "{{ states('sensor.monthly_energy_peak')|float + states('sensor.monthly_energy_offpeak') |float }}"

Thank you very much freezeke. I will try it. Have a great day.
BR,

Hi freezeke,
I have put it into configuration and automation files, but I struggle to find out how to set up the tarrifs, counters and cost calculation. It looks like this now


counters

I ask you kindly for a little guidance (few screenshots if possible) when you have some free time :slight_smile:
thanks

Look like you don’t have the energy sensor in the utility meter’s source.
You need the one from your HEM.

Hi freezeke,
thank you for your responce. somehow yesterday I found out I had typo errors and it start working. But them I changed HEM name because they were too long and run into problems.


now I have entities which I do not know how to delete it. and in energy dashboard where sources are I have it from before

can you send we screenshot how you have configured grid consumption sources. here is mine

the counters that I copied from you are working now.

thank you for your help.
have a nice weekend
BR,

Hi All,

I followed the instructions only the measurement is a little bit strange…
Based on the current measurement i am a powerplant :stuck_out_tongue:

image

Now what i added in my configu…yaml is the following code:

utility_meter:
    daily_energy:
      source: sensor.power_usage
      cycle: daily
      tariffs:
        - peak
        - offpeak
    weekly_energy:
      source: sensor.power_usage
      cycle: weekly
      tariffs:
        - peak
        - offpeak
    monthly_energy:
      source: sensor.power_usage
      cycle: monthly
      tariffs:
        - peak
        - offpeak  

and

sensor:
  - platform: template
    sensors:
      cost_today:
        friendly_name: "Kosten vandaag"
        unit_of_measurement: '€'
        value_template: "{{ (states('sensor.daily_energy_peak') | float * 0.18 + states('sensor.daily_energy_offpeak') | float * 0.16) | round(2) }}"
      daily_kwh:
        friendly_name: "Daily kWh"
        unit_of_measurement: kWh
        value_template: "{{( states('sensor.daily_energy_offpeak')|float + states('sensor.daily_energy_peak')|float) | round(2) }}"  
      yesterday_kwh:
        friendly_name: Verbruik gisteren3
        unit_of_measurement: kWh
        value_template: "{{ (state_attr('sensor.daily_energy_offpeak','last_period')|float + state_attr('sensor.daily_energy_peak','last_period')|float )| round(2)}}" 
      total_cost_month:
        friendly_name: "Totale Kosten Maand"
        unit_of_measurement: '€'
        value_template: "{{ (states('sensor.monthly_energy_peak') | float * 0.18  + states('sensor.monthly_energy_offpeak') | float * 0.16) | round(2) }}"  
      monthly_kwh:
        friendly_name: "monthly kwh"
        unit_of_measurement: kWh
        value_template: "{{ states('sensor.monthly_energy_peak')|float + states('sensor.monthly_energy_offpeak') |float }}" 

Could anybody tell me where a went wrong?

Thank you

Is your sensor.power_usage reporting in Watt or kWh? I had the same issue, then I figured I added the wrong power entity.

Seems as though the utility service has changed. Does this still work for you?

@homelord

There was a change that created a new “select” option in your dashboard. The previous documentation referred to calling a service to change the tariff. That service no longer exists, but the select function is called by the service function, and a “tariff” that you named is selected. The Service that you call is “Select: select”

Here is some of my yaml:

Blockquote
- service: select.select_option
data:
option: Summer Tier 1 June-September
target:
entity_id: select.daily_energy
Blockquote

Also, you now need to reference the new utility meter entity “select.daily_energy”

Hope this helps you.