Hello! My apologies, I do not mean to hijack your post, but I am trying to do something extremely similar, and the "start here" seems to imply trying to avoid creating duplicates.
I'm very new to HA and sometimes the basics still escape me.
My utility rates are defined as follows:
Demand Charge: $3.15/kW during peak hours
Peak hours occur Monday through Friday from 7 to 10 a.m. and 5 to 8 p.m. There are no demand charges on weekends or major federal holidays, including New Year’s Day, Memorial Day, Independence Day, Labor Day, Thanksgiving, and Christmas. In the event that the holiday occurs on Sunday, there are no demand charges on the following Monday.
Energy Charge:
$0.0552 per kWh (for the first 600 kWh per month)
$0.0660 per kWh (for 601-3,500 kWh per month)
$0.1002 per kWh (for 3,501 and over kWh per month)
Basic Charge (single-phase service): $24.31 per month (not sure how to, or if it's even possible to include this)
This is where I am so far, but I don’t know enough about this and I think the formatting, and probably variables are off. I'm also interested in finding a way to define holidays without having to manually update static dates in the template.... would it be possible to reference some sort of calendar object?
if date =['2024-11-28', '2024-12-25', '2025-01-01', '2025-05-26', '2025-07-04', '2025-09-01', '2025-11-27', '2025-12-25']
total <601
price =0.0552
or total >=601
and total <=3500
price =0.0660
or total <3501
price 0.1002
elseif now().weekday >=0
and now().weekday <5
and now().hour >=7
and now().hour <10
price=3.15
elseif now().weekday >=0
and now().weekday <5
and now().hour >=17
and now().hour <20
price=3.15
else total <601
price =0.0552
or total >=601
and total <=3500
price =0.0660
or total <3501
price 0.1002