I’ll try to be as detailed as possible here with my current set up. This is assuming you already have your meter sensors set up as described earlier in this thread. I have 2 set up: 1 for instantaneous usage and 1 for total kWh usage.
Set up Time of Use Helpers
I am billed for on, off, and mid peak usage.
Go to Settings > Devices & Services > Helpers and select Create Helper. Then select Utility Meter.
First helper will be what I called Xcel Meter. For the sensor, you want to select the total kWh usage sensor. I’m billed monthly on the 16th so for the reset cycle I select monthly and for offset days I use 16. For supported tarrifs, since I have 3 I typed in On Peak, Off Peak, and Mid Peak. HA will create new helpers for these 3 tarrifs. I turned periodic resetting off since this value is always increasing and I left Delta Values off since mine are absolute values. Once you create that helper, HA will create select helper and 3 sensor time of use helpers.
The next helper is total power consumption and it’s set up exactly like the one above except leave tarriffs blank.
Since the on peak and mid peak rates differ in summer and winter, I had to add 2 input_number helpers that will be used to set the rate depending on the time of the year. I set the minimum to whatever the lowest possible rate for that time of use is and the maximum to the highest possible cost. Unit of measurement is USD/kWh and for step size I used 0.00001. I show the Node Red flow I used later to set this number automatically.
At this point you should have a select helper, 3 time of use helpers (or whatever number you set up), a total power consumption helper, and 2 time of use rate number helpers.
Set up Energy Meter
Reboot HA before starting if the sensors arent showing up.
Go to your energy dashboard and under Grid consumption select Add Consumption. You’ll have to do this for each time of use helper. So for me, I added 3: on peak, off peak, and mid peak.
My off peak rate is the same all year so for that one I just entered in the static price that I got my Xcel’s rate schedule.
For on peak and mid peak, those rates are different in summer and winter so for those 2 I selected to use an entity with current price and for the entity I selected the number helper I created for each.
Automations
Before I create the automations to set which time of use to use, I need to set up 2 other automations for holidays. For this one, I looked in Xcel’s rate schedule and found which holidays they observe and on those days we will be using off peak pricing no matter what day of the week it is. So create an Holiday input boolean helper first. Then for the 1st automation (I called it Turn Holiday On), I want to create one that will turn that input boolen on if it is a holiday. Trigger is fixed time at 0:00:00. There are 10 holidays so for Conditions I used an Or condition and set up template conditions for each holiday. For example, New Years Day:
- condition: template
value_template: >
{% set n = now() %}
{{ n.year == 2023 and n.month == 1 and n.day == 1 }}
And the Action is to use Input boolean: Turn On service with the input_boolean.holidays as the target.
Then I created a Turn off Holiday automation that is the same as the turn on automation except that the Conditions are a Not condition.
Now I create 3 automations that will set the select sensor to either on, off, or mid peak depending on the time of day.
Off peak is set up with a fixed time trigger at 7pm. For the action, Service is set to Select: Select; target is set to select.xcel_meter; and Option is set to Off Peak.
Mid peak is set up with a fixed time trigger at 1pm but it has an And condition and they are that the holiday input boolean is off and a time condition with only weekdays selected. In other words, the automation will only set select.xcel_meter to mid peak if it’s not a holiday and it is Monday - Friday. All other times, this automation will not run.
On peak is set up the same as mid peak except the trigger time is 3pm.
So for automations we have this:
Node Red
I mentioned earlier that on and mid peak pricing changes depending on the time of the year. To handle this, I set up a Node Red flow that will set the input_number entity to the correct price. That looks like this:
Big Timer for winter TOU is set to include special day Oct 1st. That’s when Xcel changes to Winter prices. And summer TOU is set to include special day June 1st.
The call service is set up like this:
At this point, everything is pretty much automated. The TOU will automatically change at the correct time of day and remain on off peak pricing during weekends and holidays.
But I wanted to be able to display the current day energy cost and monthly energy cost. To do that, you have to create a few more helpers. You’ll need monthly and daily utility meter helpers for each TOU. These are set up much like the total consumption helper we created earlier except for the input sensor you’ll want to select sensor.xcel_meter_mid_peak_cost (may differ depending on your naming convention). But these are sensors that HA automatically created when you set up the Energy dashboard. These are set up with periodic reseting turned on. For the monthly ones you’ll use the same offset days as the previous ones you created and tarriffs will be left blank. For the daily ones, the reset cycle will be set to daily and offset is zero.
Now that we have daily and monthly sensors set up for each TOU, we can create template sensors to calculate total monthly costs. And for these I’m just going to copy/paste from my sensors.yaml file. It’s pretty self explanatory. Monthly energy cost is just adding up the 3 monthly helpers we just created. Same with daily energy costs. The GRSA E, EGCRR, and electric adjustments and fees that are defined in the Xcel Rate Schedule and are based on monthly kWh usage. For those I’m using the total power consumption sensor that we created that keeps track of monthly kWh usage and I’m multiplying that by the rate from the rate schedule. Billed electric costs is summing all of those plus the fixed base rate of $7.94.
#Template sensor to get monthly energy cost
edgewood_total_energy_cost:
unique_id: edgewood_total_energy_cost
friendly_name: "Edgewood Total Energy Cost"
value_template: "{{ (states('sensor.monthly_on_peak_cost') | float + states('sensor.monthly_mid_peak_cost') | float + states('sensor.monthly_off_peak_cost') | float) | round(2) }}"
unit_of_measurement: "$"
#Template sensor to get daily energy cost
edgewood_daily_energy_cost:
unique_id: edgewood_daily_energy_cost
friendly_name: "Edgewood Daily Energy Cost"
value_template: "{{ (states('sensor.daily_on_peak_cost') | float + states('sensor.daily_mid_peak_cost') | float + states('sensor.daily_off_peak_cost') | float) | round(2) }}"
unit_of_measurement: "$"
#Template sensor for GRSA E
edgewood_grsa_e_cost:
unique_id: edgewood_grsa_e_cost
friendly_name: "GRSA E Cost"
value_template: "{{ ((states('sensor.total_power_consumption') | float * 0.01271) | float) | round(2) }}"
unit_of_measurement: "$"
#Template sensor for EGCRR
edgewood_egcrr_cost:
unique_id: edgewood_egcrr_cost
friendly_name: "EGCRR Cost"
value_template: "{{ ((states('sensor.total_power_consumption') | float * 0.002390) | float) | round(2) }}"
unit_of_measurement: "$"
#Template sensor for Electric Adjustments
edgewood_elec_adj_cost:
unique_id: edgewood_elec_adj_cost
friendly_name: "Electric Adjustment Cost"
value_template: "{{ ((states('sensor.edgewood_total_energy_cost') | float * 0.5222) | float) | round(2) }}"
unit_of_measurement: "$"
#Template sensor for Billed Electric Cost
edgewood_billed_elec_cost:
unique_id: edgewood_billed_elec_cost
friendly_name: "Billed Electric Cost"
value_template: "{{ (states('sensor.edgewood_total_energy_cost') | float + states('sensor.edgewood_egcrr_cost') | float + states('sensor.edgewood_grsa_e_cost') | float + states('sensor.edgewood_elec_adj_cost') | float + 7.94 | float) | round(2) }}"
unit_of_measurement: "$"
I think I covered everything. I did this over a couple days so it’s possible I got something out of order as I was typing it out now but it should be close enough to get you going.