How to view how long a light has been on in a day

Hello; does anyone have any good grafana dash’s that will allow me to see how long my lights have been left on for the day?

I am trying discrete addin but wondering if there is a better way?

Do you have any solution yet? I Also want to achieve this with an influxdb data source

Are you just looking for a simple number telling you “lights were on for 6
hours yesterday” etc, or do you want a graph showing you when they were on and
when they were off throughout the day?

What data do you have in your data store? Is it “the current state of the
lights”, so every minute (or however often you sample) you get an “on” or an
“off” value, or do you just get a state change every time they get turned on or
turned off?


I would like to have a bar diagram. Where for each day it’s shown how long the light was on.

My data saves the state of the light by every state change not with a particular sample rate. The data source is influxdb. I tried “elapsed” there, but that did not get the results i wanted

I’m also looking for same solution(HA+InfluxDB+Grafana). Such a common requirement, this should have a more simpler solution. Anyone got lucky generating this ?