I hope someone can help me with the following query.
Every time I listen to a song it is registered as value 1, AND after every 30 seconds if I keep listening to the same song.
so for example if I listen to a song for 2 minutes, 5 values are recorded:
1 at the start, the second after 30 seconds, 1 after 1 minute, 1 after 1.30 and 1 after 2:00
now comes the problem; if I skip a song it is ALSO registered as value 1…
how can I make sure that I ONLY see the values ABOVE 2? so if i listen a song for at least 30 seconds?
then I don’t have the values of songs that I skipped. gives a better and fair overview.
from(bucket: "home_assistant")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "media_player.spotify_i")
|> filter(fn: (r) => r["domain"] == "media_player")
|> filter(fn: (r) => r["_field"] == "media_title_str")
|> filter(fn: (r) => r["friendly_name"] == "Spotify i")
|> filter(fn: (r) => r["entity_id"] == "spotify_i")
|> duplicate(column: "_value", as: "media_title_str")
|> group(columns: ["media_title_str"])
|> count()
|> group()
the output is:
thanks in advance!!!