If you are only looking to calculate / aggregate the time that something is ON or OFF, then this should help.
Hello, thanks for the link. Yes, you are right, I would like to record the time my device is switched on during the day and then display that in Grafana. But I have to be honest that my English is now too bad, which is why I unfortunately use Google Translate here. I looked at the link you posted, but I have to be honest and say that I don’t really understand it. It is clear to me that a forum is not there to present a user with the finished solution on a silver platter. But you can also see how long I’ve been struggling with the problem, which is why I wanted to ask you politely if you could post the correct code for me so that I could finally close this topic. Of course, I will continue to engage with Grafana. Kind regards, Andy