KirboWnz

Sun elevation from TimescaleDB LTSS

Mar 16th, 2023 (edited)
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.   time_bucket_gapfill('10 minutes', "time") AS "time",
  3.   entity_id,
  4.   MAX (CAST (attributes -> 'elevation' AS FLOAT)) as "value"
  5. FROM ltss
  6. WHERE
  7.   $__timeFilter("time")
  8.   AND entity_id = 'sun.sun'
  9.   AND state NOT IN ('unknown', 'unavailable')
  10. GROUP BY time_bucket_gapfill('10 minutes', "time"), 2
  11. ORDER BY 1,2
Add Comment
Please, Sign In to add comment