-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgrafana.txt
49 lines (46 loc) · 968 Bytes
/
grafana.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Power Metric A:
>>>>>
SELECT
UNIX_TIMESTAMP(timestamp) as time_sec,
power as value,
'Power' as metric
FROM sensorvalues
WHERE $__timeFilter(timestamp)
AND sensorid = 5
ORDER BY timestamp ASC
<<<<<
Power Metric B:
>>>>>
SELECT
UNIX_TIMESTAMP(timestamp) as time_sec,
(power / 1000) * 29.33 as value,
'cost in cent/hour' as metric
FROM sensorvalues
WHERE $__timeFilter(timestamp)
AND sensorid = 5
ORDER BY timestamp ASC
<<<<<
Consumption per Month Metric A:
>>>>>
select
timestamp as time,
sum(kwh_since_last_send) as value,
'kwh used' as metric
from sensorvalues
where timestamp >= $__timeFrom()
and sensorid = 5
group by year(timestamp), month(timestamp)
order by id asc
<<<<<
Consumption per Month Metric B:
>>>>>
select
timestamp as time,
(sum(kwh_since_last_send) * 0.30) as value,
'cost in eur' as metric
from sensorvalues
where timestamp >= $__timeFrom()
and sensorid = 5
group by year(timestamp), month(timestamp)
order by id asc
<<<<<