Data for reports
The views and tables to use in the SQL queries of reports.
Esta página aún no está traducida. Estás leyendo el original.
En esta página
Reports read the PostgreSQL database of the platform. These views and tables hold what you usually need. Times are in UTC.
view_sensor
One row for each sensor of each device, with its last value.
| Column | Content |
|---|---|
device | The name of the device. |
sensor | The name of the sensor. |
label | Locality, device and sensor in one text. |
deviceid, sensorid | The ids of the device and the sensor. |
sn | The device identifier. |
locality | The place of the device. |
value | The last value, as text. |
dtvalue | The time of the last value. |
format, decimals | How the value is shown. |
isonline | true when the sensor is online. |
stats | The statistics the sensor keeps. |
view_device
One row for each device with name, sn, locality, lat, lng, reference, driver_name, isdisabled and isonline.
History tables
The statistics are in one table for each interval: tbl_data_minutely, tbl_data_hourly, tbl_data_daily, tbl_data_monthly and tbl_data_yearly. Each row is one interval of one sensor:
| Column | Content |
|---|---|
deviceid, sensorid | The device and the sensor. |
ts | The start of the interval. |
min, max | The lowest and the highest value in the interval. |
count | The number of values in the interval. |
Sensors with the timeline on also keep every value in tbl_data_timeline with ts, deviceid, sensorid and value.
Join the history with view_sensor to get readable names:
SELECT b.device, b.sensor, a.ts, a.min, a.max, a.count
FROM tbl_data_hourly a
INNER JOIN view_sensor b ON b.deviceid = a.deviceid AND b.sensorid = a.sensorid
ORDER BY a.ts DESCDriver storage
Drivers can keep their own tables in the storage schema. See Storage.