From a21fae4f8a0cf68562178b25f1bce2c9d6d2efe2 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Wed, 4 Dec 2024 13:17:06 +0100 Subject: [PATCH] view --- queries/hottis.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/queries/hottis.sql b/queries/hottis.sql index 3c42c7b..80a2f98 100644 --- a/queries/hottis.sql +++ b/queries/hottis.sql @@ -118,3 +118,14 @@ create or replace view router_v as cast(values->'wan-out'->>'value' as int) as wanOutOctetsPerSeconds from measurements where application = 'SNMP' and device = '172.16.3.1'; + +create or replace view lora_sht21_v as + select time, + cast(values->'Humidity'->>'value' as float) as humidity, + cast(values->'Temperature'->>'value' as float) as temperature, + m.device as device, + d.attributes->>'Label' as label + from measurements m, devices d + where m.application = 'de-hottis-app01' and + m.attributes->>'DeviceType' = 'hottis-gy21' and + m.device = d.label;