Time of use pricing


highest KWH used in a 1 hour time period during peak pricing and multiplies that by a set rate. As an example if for July our highest use during peak was 4KW

I appreciate the openness of a forum. I live in Ohio and looked through my July history. My highest KWh is 6.4kWh. Goes to show how I regret not updating some efficiency as early as I could’ve. Having a stay at home wife and a large Family operating in the home during all hours of the day is probably a factor. I bet our front door opens 200x per day… No exaggeration.


Here’s the PG&E (utility) TOU grid for an EV-A Residential Whole House Service Electric Vehicles rate schedule, overlaid with with points for every hour for 2/3 of a year. Features of TOU schedule:

  • 6 different rates for generation and distribution based on season and TOD
  • 2 schedule variants - one for weekdays and one for holidays/weekends (HOWE = TRUE)
  • Winter HOWE (in blue) looks a little less dense than Summer HOWE because this is only 2/3 of the way through the year.

As I mentioned, my first step in computing TOU costs is decorating each hour with it’s TOU rate, for subsequent calculations. I had to do this chart just to make sure my logic for TOU determination was working correctly.

I think just getting this right and showing outputs and doing export in terms of the different TOU rate schedules would be huge. We know the aggregated prices for each of these.


Here’s the R code to add PG&E EV-A TOU tags to your Sense 1 hour export data. 6 things to notice:

  • This script reads in two files directly out of Sense export, one from 2017 and one from 2018 and binds them together.
  • My DateTime is synced to “US/Pacific” - you need to change if you are in a different timezone.
  • I do a data completeness check to look for any missing hours from the Sense export. I have 7 full hour dropouts over the year from Aug 17 to Aug 18. Look in MissingSenseHours, after running, if you want to see if you are missing any.
  • The script also reads file that fills in missing days - not really needed. You can remove.
  • I also use a special .csv side file that includes vacation days for PG&E TOU purposes. I’ll provide in .csv Excel format in the next forum response.
  • If everything works, you should get a graph similar to the one above that shows your TOU hours are distributed correctly.

UPDATE: The R code is directly downloadable. Fire up in R Studio, configure in the needed packages, and let it rip on your Sense output data.

SenseAudit.R (5.1 KB)


Here’s the associated PG&E Holidays file. Download it, read it into Excel, then save as a .csv. Then it’s ready for action.

UPDATE: Sense forums now allow you to post .csv files ! No renaming needed.

pgeholidays.csv (1.8 KB)


no matter what the Sense people come up with it will never be perfect for everyone but many months have passed and still not improvements to the cost per hour function. The new trending to goals function is a great idea but kind of useless since the cost per hour isn’t available to change in the app.



i wish the energy monitor could do something similar to this. Here in Florida duke energy
(our only energy supplier) charges us for one price for the first 1000 kw and another price for
the kw used after.


Duke Energy here too. Would like to see this as well along with their strange billing cycles.


@kevin1 Thank you so much for sharing your files. I updated those to work with Duke Energy here in NC TOU settings. This is a cross post to my question from here: What's new in Web App v4
I noticed that the R script in my case was accumulating all data from the csv file that I exported as I got values that are quite high. I added a filter step to just get mains and solar and this looks now more reasonable.

How did you solve that problem?




In my TOU R script posted here:
I decided to do the TOU cost calculations for all devices on an hourly basis, but then separate out by device Name, as well as BillingMonth and TOU Period when it comes time to aggregate.

# Aggregate data by billing month
SenseBill <- aggregate(cbind(kWh, Cost) ~ BillMonth + BillTo + Name + TOUPeriod, data=SenseDaily, FUN=sum)

When it came to aggregating kWh to do the Tiering calculation, I used:

data = SenseBill[SenseBill$Name %in% Totals,] where Totals is c(“Total Usage”, “Solar Production”).

to filter out just the mains and solar, in this step:

# Aggregate all Total Usage and Solar Production regardless of TOU to get monthly usage for tiered costing
NetBillkWh <- aggregate(kWh ~ BillMonth + BillTo, data = SenseBill[SenseBill$Name %in% Totals,], FUN=sum )

I should also note that with PG&E, Tiered pricing and TOU pricing are mutually exclusive. Tiered pricing is the default, but typically more expensive for big users of electricity (folks with EVs and AC).


Allow me to briefly intrude. Many of you in this thread may find interest in the new Data Analysis category: New Category: Data Analysis


Thanks Kevin,

I just recently got a Testa and I have 3 AC units for my house, so I am looking to analyze the data that Sense got me since beginning of the year to see if TOU pricing is better for me or not with the current usage pattern.

I really appreciate the R scripts you provided already.

FYI, another little thing I added is the monthly base price to get comparison with the real bill.


That’s great to hear… Love the Tesla. Love the enhanced R scripts. When you get it working, you can pay it forward by putting your Duke Energy script out in Data Analysis area. Good luck and I’ll be interested to see if TOU is right for you.



Add me to the list of those waiting patiently on TOU options. The pricing options as they are currently offered are just useless to me even if I take an average across the bill and program it in that way. It’s useless because with 2EV’s in our house, although we usually try to charge them during off peak (for obvious reasons) there are times where we may choose to charge during our mid or even on-peak periods. 15 or 20+KW used during an on peak period is a big enough bell curve to totally destroy an averaging assumptions.


Yup, want this feature.


I definitely need this as well.


i don’t know about everyone in other states, but under PG&E in my part of California, we have peak use and off peak use times. and costs vary based on the time of day.
2pm-8pm = $0.36Kw
8pm-2pm = $0.24Kw

it would be nice to be able to do that in sense to get an accurate reading of daily/monthly costs.


They’re working on it! APS here in AZ is ridiculously complicated.


That’s crazy expensive power even at off-peak times!


Really need this feature.

We have an “Electric Vehicle” rate with both time of day & calendar dimensions.
11p-7a every day is super off peak
2p-7p M-F from June 1 to Sept 30 is peak (except holidays)
7a-11p is off peak other than when overridden by peak


Right again, @NJHaley. We are hoping to get this into the app soon. Thanks for your patience!