Create a card to show how many hours a sensor was ON

Hey Guys

very new to home assistant. I installed it a few months ago and have started to learn the ropes. I think I’m now ready to get into reporting of my data and see how my home is doing.

I honestly still don’t know YAML that well, but I can copy and paste stuff.

Here is what I’m trying to do.

I have alot of entities at home for fans lights etc. I’m basically trying to compare power usage and check how long an entity has been “ON” this week as compared to the last week for example.

For example Fan One has been on last week for 20 hours for example, so I want to know how many hours it’s been on this week.

I can click on the entity and check the history tab and I see on off etc and I can download the history and open it in excel as well. I just don’t know how to display that on a dashboard or anything like that.

I’ve read about creating a custom sensor using history stats, however I’m lost and don’t think I can get anywhere.

Hope someone can help!