Calculate Daily kWh Usage and Reset Daily

Hey everyone, I’m trying to figure out how to calculate the daily kWh usage from my power sensor and have it reset every day. I have a sensor that shows the current power usage in Watts, but I need to track the total energy consumed over the day and then reset it at midnight. Does anyone have a solution or example for this? I think it involves using a script or automation, but I’m not exactly sure how to set it up. Any help or guidance would be greatly appreciated! :raised_hands: