Check actual state

check out this thread, it may give you some ideas Dashboard pie chart to show Raspberry pi GPIO history