I have Ameren:
This is what the rates say
You’ll pay a discounted rate on the energy you use between 9 p.m. and 9 a.m.
And you’ll be charged a slightly higher rate between the hours of 9 a.m. to 9 p.m.
For: Winter: October through May: All rates are per kWh
1st 750 kWh on-peak: 8.92¢ (9 a.m. to 9 p.m. Sun-Sat)
Over 750 kWh on-peak: 6.03¢ (9 a.m. to 9 p.m. Sun-Sat)
1st 750 kWh off-peak: 8.67¢ (9 p.m. to 9 a.m. Sun-Sat)
Over 750 kWh off-peak: 5.78¢ (9 p.m. to 9 a.m. Sun-Sat)
Summer: June through September: All rates are per kWh
On-peak 12.88¢ (9 a.m. to 9 p.m. Sun-Sat)
Off-peak 12.63¢ (9 p.m. to 9 a.m. Sun-Sat)
There are other ways to do this just showing what I did.
Find the part on your bill that has your rates this is your cost per kWh
you just want the rates you might need to look at a number of bills to get your summer and winter rates.
on your bill you will have a few rates:
all you want is the cost per Kwh
Summer Total Energy Charge: 0.12630000
Winter Elec Energy Chg 0-750: 0.08670000
Winter Elec Energy Chg >750: 0.05780000
On-Pk Energy Adjustment: 0.00258332
Customer Charges:
Fuel Adjustment Charge: 0.00623631
Energy Efficiency Investment Charge: 0.00366500
Renewable Energy Adjustment: 0.00035000
Now we need helpers:
I put numbers on my helpers to keep them sorted in the order I want.
Make input helpers with 6 dec places.
These are your input sensors, you can change them so the are not hard-coded.
Ameren010 Summer Total Energy Charge
Ameren020 Winter Elec Energy Chg 0-750
Ameren030 Winter Elec Energy Chg > 750
Ameren040 On-Pk Energy Adjustment
Ameren050 Fuel Adjustment Charge
Ameren060 Energy Efficiency Investment Charge
Ameren070 Renewable Energy Adjustment
Now for some math combine your imput sensors:
add a new helpers that combine the state of several sensors using SUM
Ameren210 Winter peak
Sum
Ameren020 Winter Elec Energy Chg 0-750
Ameren040 On-Pk Energy Adjustment
Ameren050 Fuel Adjustment Charge
Ameren060 Energy Efficiency Investment Charge
Ameren070 Renewable Energy Adjustment
Ameren220 Winter non-peak
Sum
Ameren020 Winter Elec Energy Chg 0-750
Ameren050 Fuel Adjustment Charge
Ameren060 Energy Efficiency Investment Charge
Ameren070 Renewable Energy Adjustment
Ameren230 Winter peak > 750
Sum
Ameren020 Winter Elec Energy Chg 0-750
Ameren030 Winter Elec Energy Chg >750
Ameren040 On-Pk Energy Adjustment
Ameren050 Fuel Adjustment Charge
Ameren060 Energy Efficiency Investment Charge
Ameren070 Renewable Energy Adjustment
Ameren240 Winter non-peak > 750
Ameren020 Winter Elec Energy Chg 0-750
Ameren030 Winter Elec Energy Chg >750
Ameren050 Fuel Adjustment Charge
Ameren060 Energy Efficiency Investment Charge
Ameren070 Renewable Energy Adjustment
Ameren310 Summer peak
Ameren010 Summer Total Energy Charge
Ameren040 On-Pk Energy Adjustment
Ameren050 Fuel Adjustment Charge
Ameren060 Energy Efficiency Investment Charge
Ameren070 Renewable Energy Adjustment
Ameren320 Summer non-peak
Ameren010 Summer Total Energy Charge
Ameren050 Fuel Adjustment Charge
Ameren060 Energy Efficiency Investment Charge
Ameren070 Renewable Energy Adjustment
Ameren330 Summer peak > 750
Ameren010 Summer Total Energy Charge
Ameren040 On-Pk Energy Adjustment
Ameren050 Fuel Adjustment Charge
Ameren060 Energy Efficiency Investment Charge
Ameren070 Renewable Energy Adjustment
Ameren340 Summer non-peak > 750
Ameren010 Summer Total Energy Charge
Ameren050 Fuel Adjustment Charge
Ameren060 Energy Efficiency Investment Charge
Ameren070 Renewable Energy Adjustment
Ameren710 Peak start
9:00 AM
Ameren720 peak end
9:00 PM
*Create a utility sensor that resets each month
using the sensor reading the total energy from Ameren and reset each month
you need this to check if the KWH used is greater that 750
I put a “s” at the end of Month, but I was to lazy to redo my code to remove the “s” as I would have had to delete the utility meter sensor. the sensor needs to start on the first of the month to track usage so if you get it wrong will need to wait for a new billing cycle to start over.
Ameren Energy Used this Months
Now for your YAML code
The sensor: ameren810_current kwh_rate
will have your current cost per kWh
I used a lot of if/elif to make coding simple, and made it a sensor so no automation or scripts.
- sensor:
- name: "Ameren810 Current kWh Rate"
unique_id: ameren810_current kwh_rate
unit_of_measurement: "USD/kWh"
state: >
{% set n1 = now() %}
{% set n2 = (now().month) %}
{% set summer = [ 11, 12, 1, 2, 3, 4, 5] %}
{% set winter = [ 6, 7, 8, 9] %}
{% if ((n2 in summer))
and (states('sensor.ameren_energy_used_this_months')) | int > 750
and today_at( states('input_datetime.ameren710_peak_start'))
< n1 < today_at( states('input_datetime.ameren720_peak_end'))
%}
{{ float(states('sensor.ameren330_summer_peak_750')) }}
{% elif ((n2 in summer))
and (states('sensor.ameren_energy_used_this_months')) | int < 751
%}
{{ float(states('sensor.ameren310_summer_peak')) }}
{% elif ((n2 in summer))
and (states('sensor.ameren_energy_used_this_months')) | int > 750
%}
{{ float(states('sensor.ameren340_summer_non_peak_750')) }}
{% elif ((n2 in summer))
and (states('sensor.ameren_energy_used_this_months')) | int < 751
%}
{{ float(states('sensor.ameren320_summer_non_peak')) }}
{% elif ((n2 in winter))
and (states('sensor.ameren_energy_used_this_months')) | int > 750
and today_at( states('input_datetime.ameren710_peak_start'))
< n1 < today_at( states('input_datetime.ameren720_peak_end'))
%}
{{ float(states('sensor.ameren230_winter_peak_750')) }}
{% elif ((n2 in winter))
and (states('sensor.ameren_energy_used_this_months')) | int < 751
%}
{{ float(states('sensor.ameren210_winter_peak')) }}
{% elif ((n2 in winter))
and (states('sensor.ameren_energy_used_this_months')) | int > 750
%}
{{ float(states('sensor.ameren240_winter_non_peak_750')) }}
{% elif ((n2 in winter))
and (states('sensor.ameren_energy_used_this_months')) | int < 751
%}
{{ float(states('sensor.ameren220_winter_non_peak')) }}
{% endif %}
Now you can use the “Ameren810 Current kWh Rate” for any place you need current cost like.
go to setting > dashboards > energy
Under Electricity grid you can now edit you Grid Consumption sensor and check use an entity with
current price then use “Ameren810 Current kWh Rate”