2023-12-05 13:31:42 +01:00
|
|
|
create or replace view pv_power_v as
|
|
|
|
select time,
|
|
|
|
cast(values->'PowerActive'->>'value' as float) as power,
|
|
|
|
values->'Status'->>'status' as status,
|
|
|
|
device
|
|
|
|
from measurements
|
|
|
|
where application = 'PV';
|
|
|
|
|
|
|
|
create or replace view pv_total_import_v as
|
|
|
|
select time,
|
|
|
|
cast(values->'Power'->>'value' as float) as power,
|
|
|
|
device
|
|
|
|
from measurements
|
|
|
|
where application = 'Power' and
|
|
|
|
device = 'Total' and
|
|
|
|
attributes->>'Status' = 'Ok';
|
|
|
|
|
|
|
|
create or replace view power_v as
|
|
|
|
select time,
|
|
|
|
cast(values->'Power'->>'value' as float) as power,
|
|
|
|
device
|
|
|
|
from measurements
|
|
|
|
where application = 'Power' and
|
|
|
|
attributes->>'Status' = 'Ok';
|
|
|
|
|
2023-12-05 13:54:37 +01:00
|
|
|
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';
|
2023-12-07 15:14:22 +01:00
|
|
|
|
|
|
|
create or replace view temperature_v as
|
|
|
|
select time,
|
|
|
|
cast(values->'Value'->>'value' as float) as temperature,
|
|
|
|
device
|
|
|
|
from measurements
|
|
|
|
where application in ('Temperature Multisensor', 'Temperature Shelly Plus HT');
|
|
|
|
|
2024-01-03 20:57:26 +01:00
|
|
|
create or replace view temperature2_v as
|
|
|
|
select time,
|
|
|
|
cast(values->'Value'->>'value' as float) as temperature,
|
|
|
|
device
|
|
|
|
from measurements
|
|
|
|
where application = 'Temperature Wago';
|
|
|
|
|
2023-12-28 13:04:25 +01:00
|
|
|
create or replace view humidity_v as
|
|
|
|
select time,
|
|
|
|
cast(values->'Value'->>'value' as float) as humidity,
|
|
|
|
device
|
|
|
|
from measurements
|
|
|
|
where application in ('Humidity Multisensor');
|
|
|
|
|
2024-01-03 20:57:26 +01:00
|
|
|
create or replace view soil_v as
|
|
|
|
select time,
|
|
|
|
cast(values->'Water'->>'value' as float) as water,
|
|
|
|
cast(values->'Conductance'->>'value' as float) as conductance,
|
|
|
|
cast(values->'Temperature'->>'value' as float) as temperature,
|
|
|
|
device
|
|
|
|
from measurements
|
|
|
|
where application = 'de-hottis-app01' and attributes->>'DeviceType' = 'dragino-lse01';
|