Hi I am trying for the life of me to get my grid meter to track my spend with my (time of use)TOU spend.
I have got my individual items to work like my car and my AC unit. But my total ussage is eluding me.
I think the issue is that my meter is in WH and not KWH and when create sensor it runs away. Taking WH and thinking they are KWH.
Here is my configuration.yaml items
utility_meter:
grid_energy_used_monthly:
source: sensor.xcel_grid_energy_used_fixed # this should be your kWh integration sensor
cycle: monthly
Templates
- name: "TOU Electricity Rate"
unit_of_measurement: "$/kWh"
device_class: monetary
state_class: measurement
state: >
{% set now = now() %}
{% set hour = now.hour %}
{% set month = now.month %}
{% set is_summer = 6 <= month <= 9 %} {# June 1 to Sept 30 #}
{% if 13 <= hour < 15 %}
{{ 0.14332 if is_summer else 0.10460 }} {# Mid-peak #}
{% elif 15 <= hour < 19 %}
{{ 0.20915 if is_summer else 0.13171 }} {# On-peak #}
{% else %}
0.07749 {# Off-peak (same year-round) #}
{% endif %}
- name: "Total Grid Cost (TOU)"
unit_of_measurement: "$"
device_class: monetary
state_class: total
state: >
{% set wh = states('sensor.grid_energy_used_monthly') | float(0) %}
{% set kwh = wh / 1000 %}
{% set rate = states('sensor.tou_electricity_rate') | float(0) %}
{{ (kwh * rate) | round(2) }}
- name: "Xcel Grid Energy Used Fixed"
unit_of_measurement: kWh
device_class: energy
state_class: total
state: >
{% set val = states('sensor.xcel_grid_energy_used') %}
{% if val not in ['unknown', 'unavailable', None] %}
{{ val | float }}
{% else %}
0
{% endif %}
- platform: integration
source: sensor.xcel_itron_5_current_summation_delivered_value
name: Xcel Grid Energy Used
unit_prefix: k
round: 2
method: trapezoidal