From 830596f211adc69a57041bc3987b6774e4b0b8af Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Mon, 11 Nov 2024 12:45:47 +0100 Subject: [PATCH] saerbeck query --- queries/saerbeck.sql | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/queries/saerbeck.sql b/queries/saerbeck.sql index 8bf6ad2..e9d05ab 100644 --- a/queries/saerbeck.sql +++ b/queries/saerbeck.sql @@ -10,14 +10,34 @@ create or replace view badesee_temperature_v as where application = 'de-hottis-saerbeck-monitoring' and device = 'eui-a84041318187ec13'; -create or replace view cubecell_threeway_temperature_v as +create or replace view cubecell_threeway_temperature2_v as select time, - cast(values->'Temperature1'->>'value' as float) as Temp1, - cast(values->'Temperature2'->>'value' as float) as Temp2, - cast(values->'Temperature3'->>'value' as float) as Temp3, - device + cast(values->'Temperature2'->>'value' as float) as value, + values->'Temperature2'->>'label' as label from measurements where application = 'de-hottis-saerbeck-monitoring' and device = 'eui-70b3d57ed0068fa4'; +create or replace view cubecell_threeway_temperature1_v as + select time, + cast(values->'Temperature1'->>'value' as float) as value, + values->'Temperature1'->>'label' as label + from measurements + where application = 'de-hottis-saerbeck-monitoring' and + device = 'eui-70b3d57ed0068fa4'; +create or replace view cubecell_threeway_temperature3_v as + select time, + cast(values->'Temperature3'->>'value' as float) as value, + values->'Temperature3'->>'label' as label + from measurements + where application = 'de-hottis-saerbeck-monitoring' and + device = 'eui-70b3d57ed0068fa4'; + +create or replace view cubecell_threeway_battery_v as + select time, + cast(values->'Battery'->>'value' as float) as value, + values->'Battery'->>'label' as label + from measurements + where application = 'de-hottis-saerbeck-monitoring' and + device = 'eui-70b3d57ed0068fa4';