# Cost per kw/h sensors

I have a bunch of Xiaomi Zigbee smart plugs that also monitor power consumption. I would like to be able to calculate what each plug consumes in kw/h per day and per month and then also find out what each one is costing me for those periods. I am getting pretty high power bills and I want some insights into where I can be making savings and which plan will best suit our consumption habits.

I currently have a flat rate for all my consumption but I wish to compare this against a tariff type model where they have peak, shoulder and off peak times and see if it would save us any money or cost more to change over to this plan type.

I need help creating the sensors that would give me a view of the daily and monthly usage and then cost per those periods.

What I have done for this is use the History Statistics sensor. Use this sensor to calculate how many hours your smart plugs have been on for the day or month. Then using a template sensor multiply the # of hours by the power consumption of the device (watts) and divide by 1000 to get kw/h. If you want the \$ cost, multiply the kw/h by the cost you pay for each kw/h.

Example of calculation:
Lamp has two lightbulbs (70w bulbs). It’s been on for 5.5 hours today. You pay \$.10 per kw/h.
(5.5h * (70w * 2 bulbs))/1000 = .77 kw/h * \$.10 = \$.077 cost.

I’m not sure of the best way to calculate the tariff model… Someone smarter than me will have to help you with that