From 00a9eceea8eb02334b502099b1b74affc2645d12 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Tue, 5 Dec 2023 13:54:37 +0100 Subject: [PATCH] additional queries --- queries/hottis.sql | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/queries/hottis.sql b/queries/hottis.sql index 7c16602..7021bd7 100644 --- a/queries/hottis.sql +++ b/queries/hottis.sql @@ -23,3 +23,17 @@ create or replace view power_v as where application = 'Power' and attributes->>'Status' = 'Ok'; +create or replace view temperature_heating_v as + select time, + cast(values->'Value'->>'value' as float) as temperature, + device + from measurements + where application = 'Temperature Heating'; + +create or replace view gas_v as + select time, + cast(values->'Volume'->>'value' as float) as volume, + device + from measurements + where application = 'Gas' and + attributes->>'Status' = 'Ok';