-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdutch-weather.html
110 lines (95 loc) · 3.05 KB
/
dutch-weather.html
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
<!-- Config node -->
<script type="text/x-red" data-template-name="dutch-weather-conf">
<div class="form-row">
<label for="node-config-input-lat"><i class="fa fa-map-marker"></i> Latitude</label>
<input type="text" id="node-config-input-lat">
</div>
<div class="form-row">
<label for="node-config-input-lng"><i class="fa fa-map-marker"></i> Longitude</label>
<input type="text" id="node-config-input-lng">
</div>
</script>
<script type="text/javascript">
function filterFloat(v) {
v = (/^(\-|\+)?([0-9]+(\.[0-9]+)?|Infinity)$/.test(v)) ? Number(v) : NaN;
return v;
}
RED.nodes.registerType('dutch-weather-conf',{
category: 'config',
defaults: {
lat: { value: 51.424080, required: true, validate: function (v) { return !isNaN(filterFloat(v)); } },
lng: { value: 5.442794, required: true, validate: function (v) { return !isNaN(filterFloat(v)); } }
},
color: '#D3D3D3',
icon: 'font-awesome/fa-map-marker',
label: function() {
return 'Dutch weather for ' + parseFloat(this.lat).toFixed(2) + ',' + parseFloat(this.lng).toFixed(2);
}
});
</script>
<!-- Rain state node -->
<script type="text/x-red" data-template-name="dutch-weather-rain-state">
<div class="form-row">
<label for="node-input-conf"><i class="fa fa-map-marker"></i> Location configuration</label>
<input type="text" id="node-input-conf">
</div>
<div class="form-row">
<input type="hidden" id="node-input-name">
</div>
<div class="form-row">
<input type="hidden" id="node-input-topic">
</div>
</script>
<script type="text/x-red" data-help-name="dutch-weather-rain-state">
<p>Provides information from the Dutch rain info provider Buienalarm at the interval defined in the configuration node.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('dutch-weather-rain-state', {
category: 'Dutch_Weather',
defaults: {
conf: { value: '', type: 'dutch-weather-conf', required: true },
name: { },
topic: { }
},
inputs: 1,
outputs: 1,
color: '#4CA3DD',
icon: 'font-awesome/fa-tint',
label: function() {
return 'Rain state';
}
})
</script>
<!-- Meteoplaza node -->
<script type="text/x-red" data-template-name="dutch-weather-meteoplaza">
<div class="form-row">
<label for="node-input-conf"><i class="fa fa-map-marker"></i> Location configuration</label>
<input type="text" id="node-input-conf">
</div>
<div class="form-row">
<input type="hidden" id="node-input-name">
</div>
<div class="form-row">
<input type="hidden" id="node-input-topic">
</div>
</script>
<script type="text/x-red" data-help-name="dutch-weather-meteoplaza">
<p>Provides information from the Dutch provider Meteoplaza at the interval defined in the configuration node.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('dutch-weather-meteoplaza', {
category: 'Dutch_Weather',
defaults: {
conf: { value: '', type: 'dutch-weather-conf', required: true },
name: { },
topic: { }
},
inputs: 1,
outputs: 1,
color: '#528B8B',
icon: 'font-awesome/fa-newspaper-o',
label: function() {
return 'Meteoplaza';
}
})
</script>