-
Notifications
You must be signed in to change notification settings - Fork 4
Sensor Dashboard
hassping edited this page Nov 27, 2020
·
6 revisions
-
First set up a connection to Keepy DB. This option is under Settings > Data Sources.
-
Create a new Dashboard, and add a new panel to it. Go to Manage and click New Dashboard.
-
Select Keepy as your Data source for the new Panel and use the query editor to adjust the SQL sentence.
-
You can adjust the following queries to build new panels for your sensors. Keep in mind the JSON Structure. Here some usefull tools:
SELECT tt.id as time_sec,tt.metric,
CAST(tt.value AS DECIMAL(10,2)) as value
FROM (SELECT
CONVERT((json_extract(message,'$.timestamp')), UNSIGNED INTEGER ) as id,
(json_extract(message,'$.iot2tangle[2].data[0].SoilHumidity')) as value,
"Percentage" as metric
FROM messages) tt
WHERE tt.id > 1605812340
ORDER BY tt.id ASC
SELECT tt.id as time_sec,tt.metric,
CAST(tt.value AS DECIMAL(10,2)) as value
FROM (SELECT
CONVERT((json_extract(message,'$.timestamp')), UNSIGNED INTEGER ) as id,
(json_extract(message,'$.iot2tangle[1].data[1].Humidity')) as value,
"Percentage" as metric
FROM messages) tt
WHERE tt.id > 1605193200
ORDER BY tt.id ASC
SELECT tt.id as time_sec,tt.metric,
CAST(tt.value AS DECIMAL(10,2)) as value
FROM (SELECT
CONVERT((json_extract(message,'$.timestamp')), UNSIGNED INTEGER ) as id,
(json_extract(message,'$.iot2tangle[1].data[0].Temperature')) as value,
"Celcius" as metric
FROM messages) tt
WHERE tt.id > 1605193200
ORDER BY tt.id ASC
SELECT tt.id as time_sec,tt.metric,
CAST(tt.value AS DECIMAL(10,2)) as value
FROM (SELECT
CONVERT((json_extract(message,'$.timestamp')), UNSIGNED INTEGER ) as id,
(json_extract(message,'$.iot2tangle[3].data[0].WaterPump')) as value,
"Status" as metric
FROM messages) tt
WHERE tt.id > 1606330740
ORDER BY tt.id ASC
SELECT tt.id as time_sec,tt.metric,
CAST(tt.value AS DECIMAL(10,2)) as value
FROM (SELECT
CONVERT((json_extract(message,'$.timestamp')), UNSIGNED INTEGER ) as id,
(json_extract(message,'$.iot2tangle[1].data[2].Pressure')) as value,
"Psi" as metric
FROM messages) tt
WHERE tt.id > 1605193200
ORDER BY tt.id ASC
The Dashboards will look as follow: