added s_all to display count (and bettery) for all sensors
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 1 Jul 2023 16:30:30 +0000 (18:30 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 1 Jul 2023 16:30:30 +0000 (18:30 +0200)
views.sql

index 0c63c8e..311565c 100644 (file)
--- a/views.sql
+++ b/views.sql
@@ -1,3 +1,16 @@
+drop view s_all;
+create view s_all as
+select time AT TIME ZONE 'UTC-2' as time,
+       addr,
+       (json->'sensor_type')::int  as sensor_type,
+       (json->'sensor_name')::text as sensor_name,
+       (json->>'battery')::float as bettery,
+       (json->>'battery_percent')::float as battery_percent,
+       (json->'counter')::int as counter
+from eg5120
+;
+grant select on s_all to gread ;
+
 -- 1 Temperature/Humidity
 drop view s_1;
 create view s_1 as