How to make counter graphs

I’m trying to make a box that will show how long in sum for last 24h “Status” was “ON” or “OFF”.
Status is either 1 or 0 for on and off, so I need to summarize how long for last 24h it was in which status. Can you please advice how to do that? Thanks!