-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathnpf2.yaml
119 lines (119 loc) · 3.11 KB
/
npf2.yaml
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
type: custom:apexcharts-card
now:
show: true
label: now
graph_span: 8d
experimental:
color_threshold: true
apex_config:
grid:
show: true
borderColor: dimgray
strokeDashArray: 4
chart:
height: 384px
legend:
showForSingleSeries: false
show: false
plotOptions:
bar:
borderRadius: 0
yaxis:
decimalsInFloat: 1
forceNiceScale: true
xaxis:
type: datetime
labels:
datetimeFormatter:
minute: HH:mm
day: ddd
all_series_config:
curve: stepline
show:
offset_in_name: true
header:
title: Nordpool ennuste c/kWh
show: true
show_states: true
colorize_states: true
span:
start: day
series:
- entity: sensor.nordpool_kwh_fi_eur_3_10_0
type: column
float_precision: 3
stroke_width: 0
opacity: 0.33
fill_raw: 'null'
unit: ¢/kWh
name: Nordpool ¢/kWh
show:
in_header: false
legend_value: false
extremas: false
data_generator: |
return [...entity.attributes.raw_today.map((start, index) => {
return [new Date(start["start"]).getTime(), entity.attributes.raw_today[index]["value"]*125.5];
}),
...entity.attributes.raw_tomorrow.map((entry) => {
return [new Date(entry.start).getTime(), entry.value*125.5];
}),
// Add a new entry for the day after tomorrow with a zero value
[new Date(new Date().setDate(new Date().getDate() + 2)).setHours(0, 0, 0, 0), 0]
].filter(([timestamp, _]) => {
const now = new Date();
const endOfDayAfterTomorrow = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 3);
endOfDayAfterTomorrow.setHours(0, 0, 0, 0); // Set to the beginning of two days after today
return timestamp < endOfDayAfterTomorrow.getTime();
});
color: '#aaaaaa'
color_threshold:
- value: 0
color: lime
- value: 5
color: green
- value: 10
color: orange
- value: 15
color: red
- value: 20
color: darkred
- value: 30
color: purple
- entity: sensor.nordpool_kwh_fi_eur_3_10_0
type: line
float_precision: 3
stroke_width: 2
opacity: 1
unit: ¢/kWh
name: Nordpool ¢/kWh Prediction
color_threshold:
- value: 0
color: dodgerblue
opacity: 0.6
- value: 5
color: dodgerblue
opacity: 0.8
- value: 10
color: skyblue
opacity: 0.8
- value: 15
color: red
opacity: 0.8
- value: 20
color: darkred
opacity: 0.8
- value: 30
color: purple
opacity: 0.8
show:
in_header: false
legend_value: false
extremas: false
data_generator: |
const processData = async () => {
const response = await fetch('https://raw.githubusercontent.com/vividfog/nordpool-predict-fi/main/deploy/prediction.json');
const predictionData = await response.json();
return predictionData.map(([timestamp, value]) => [parseInt(timestamp), value]);
};
return processData();