Hello, I store sensor values of binary sensor (detects when sun directly shines on the sensor) in Influx database. Would someone know how to sum all times over some period when the sensor is in ON state? In my case it would show how long per day the sun shines on the sensor.
I found advice here Help with total time state = "on" influxdb and I know about History Stats, but I really hate to restart whole HA because of adding sensor. Restart wipes cached states and I have to wait whole day until sleeping sensors update state again. I would prefer to use SQL statement in Influx.