Here is a post I made a few years ago that I think explains the calculations pretty well. There is a lot of detail there, but if you just focus on the the way I calculate costs for the devices I grouped, it should essentially be the same process. Starts in section “Simplifying the energy calculations.”
Here’s some of the addition information from the post about adjusting for different rates.