Hi eveyone, this is my first topic.
I have a time serie of just integers of illumination (LUX) from sensor.
2022-01-12 07:37:00 8
2022-01-12 07:38:00 13
2022-01-12 07:39:01 14
2022-01-12 07:40:02 16
2022-01-12 07:41:03 25
2022-01-12 07:42:03 31
…
I would like to select the time interval between sunrise and sunset to show how many hours is the daylight
I’ve tryed with this: SELECT ELAPSED(“illuminance”, 1h) FROM “daylight” WHERE “illuminance” >= 10 AND time >= now() -120d.
Obviously not working!
thank you for your help.
Hi again, hope to animate discussion giving more detail about the specific question.
Luminosity sensor send simpel numeric data via MQTT to a Raspberry based InfluxDB instance. The Measurement look like:
time illuminance
where the green line show day and night, the yello one top values and cyan line the mean value.
We know days are shorter in winter and longerin summer (considering the total time of light), during spring the ammount of daytime increase and in autumn decrease.
Thefirst goal is to calculate the total time between last sunset and sunrise, ELAPSED() looks usefull but I do not figure out how to apply it.
After that I would like to plot a graph showing the daitime incrasing and decreasing…
May someone had same goal or can help me?
Hello @Francesco_Giunta,
What version of Flux are you using?
I think this would be possible with 2.x and Flux but I’m not sure about InfluxQL (might be possible for you to enable Flux in 1.8 but Flux is much more limited in 1.x).
Off the cuff, I would probably use the following functions in Flux:
Yes I’m using InfluxDB shell version: 1.8.10 and my queries are made in Grafana.
I can upgrade InfluxDB version to 2 and learn how to work throug Flux.