-
Notifications
You must be signed in to change notification settings - Fork 1
/
pre_install_services.html
427 lines (393 loc) · 18.2 KB
/
pre_install_services.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
<!DOCTYPE html>
<html>
<head>
<title>WeeWX Weather34 Pre-install Web Services Settings Page</title>
<style>
* {
box-sizing: border-box;
font: 18px Arial;
padding: 5px;
}
div {
padding: 2px;
background-color: #00A4B4;
overflow: hidden;
}
input[type=text], textarea, select {
font: 12px Arial;
width: 100%;
padding: 6px;
border: 2px solid #ccc;
border-radius: 4px;
}
input[type=select]{
font: 12px Arial;
width: 100%;
cursor: pointer;
padding: 6px;
border: 2px solid #ccc;
border-radius: 4px;
}
input[type=button]{
font: 12px Arial;
width: auto;
float: left;
cursor: pointer;
padding: 6px;
}
input[type=submit] {
background-color: #9ABA2F;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
float: left;
width: 100%;
}
input[type=submit_blue] {
background-color: blue;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
float: left;
width: 100%;
text-align: center;
}
label[for=text]{
font: 12px Arial;
text-align: right;
width: 100%;
float: left;
cursor: pointer;
padding: 6px;
}
.container {
border-radius: 5px;
border: 2px solid rgba(86,95,103,1);
background-color: #959595;
padding: 5px;
}
.col-25 {
float: left;
width: 25%;
margin-top: 6px;
}
.col-75 {
float: left;
width: 75%;
margin-top: 6px;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
/* Responsive layout - when the screen is less than 600px wide, make the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
.col-25, .col-75, input[type=submit] {
width: 100%;
margin-top: 0;
}
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}
</style>
</head>
<body>
<img src="www/img/icon-weewx.svg" alt="WeeWX" title="WeeWX" width="300px" height="120px class="center" ><img src="www/img/weather34logo.svg" width="120px" alt="https://weather34.com/homeweatherstation/" class="homeweatherstationlogo" >
<p>Weather34 for WeeWX. Pre-install settings page, generating services.txt prior to installation. The files will be automatically sent to your defaults Downloads folder. No data is retained on this server after the process is complete.</p>
<div class="container">
<div class="row">
<div class="col-25">
<label for="text">Latitude</label>
</div>
<div class="col-75">
<input type="text" id="txtLat" placeholder="Enter your Latitude">
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Longitude</label>
</div>
<div class="col-75">
<input type="text" id="txtLon" placeholder="Enter your Longitude">
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Language</label>
</div>
<div class="col-75">
<input type="text" id="txtLang" placeholder="Enter your Language">
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">AQI Key</label>
</div>
<div class="col-75">
<input type="text" id="txtAqkey" placeholder="Enter your AQI Key" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">DarkSky Key</label>
</div>
<div class="col-75">
<input type="text" id="txtDskey" placeholder="Enter your DarkSky Key" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">DarkSky Units</label>
</div>
<div class="col-75">
<select id="selDsunits">
<option selected value="">-- Choose the units --</option>
<option value="us">US</option>
<option value="si">SI Metric</option>
<option value="ca">Canada</option>
<option value="uk2">UK (Metric with mph and miles)</option>
<option value="auto">auto</option>
</select>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Weather Underground Key</label>
</div>
<div class="col-75">
<input type="text" id="txtWukey" placeholder="Enter your Weather Underground Key" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Weather Underground Units</label>
</div>
<div class="col-75">
<select id="selWuunits">
<option selected value="">-- Choose the units --</option>
<option value="e">Imperial</option>
<option value="m">Metric</option>
<option value="s">Scandinavia</option>
<option value="h">United Kingdom</option>
</select>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">METAR Key</label>
</div>
<div class="col-75">
<input type="text" id="txtMekey" placeholder="Enter your METAR Key" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">METAR Code</label>
</div>
<div class="col-75">
<input type="text" id="txtMecode" placeholder="Enter your METAR Code" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">PurpleAir ID</label>
</div>
<div class="col-75">
<input type="text" id="txtPuid" placeholder="Enter your PurpleAir ID" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Local Web Server IP Address</label>
</div>
<div class="col-75">
<input type="text" id="txtAlip" placeholder="Enter Local Web Server IP Address" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Meteoalarm Country</label>
</div>
<div class="col-75">
<input type="text" id="txtAlcountry" placeholder="Enter your Meteoalarm Country (European users only)" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Meteoalarm Region</label>
</div>
<div class="col-75">
<input type="text" id="txtAlregion" placeholder="Enter your Meteoalarm Region (European users only)" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Active Web Services Code String</label>
</div>
<div class="col-75">
<input type="text" id="txtServices" placeholder="Enter your Active Web Services Code String (Minimum requirement me.wu.eq.ki)" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Enable Cloud Cover</label>
</div>
<div class="col-75">
<select id="selCloud">
<option selected value="">-- Choose True or False --</option>
<option value="True">True</option>
<option value="False">False</option>
</select>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Land Mass</label>
</div>
<div class="col-75">
<select id="selContinent">
<option selected value="">-- Choose Land Mass --</option>
<option value="eu">Europe</option>
<option value="af">Africa, Middle East</option>
<option value="ana">North America</option>
<option value="ama">Central America</option>
<option value="asa">South America</option>
<option value="seasia">South East Asia</option>
<option value="oce">Oceania</option>
</select>
</div>
</div>
<div>
<input type="submit" id="bt" value="Create and Download services.txt" onclick="saveFile()" />
</div>
</div>
</body>
<script>
let saveFile = () => {
// Get the data from each element on the form.
const lat = document.getElementById('txtLat');
const lon = document.getElementById('txtLon');
const lang = document.getElementById('txtLang');
const continent = document.getElementById('selContinent');
const aq_apikey = document.getElementById('txtAqkey');
const ds_apikey = document.getElementById('txtDskey');
const ds_units = document.getElementById('selDsunits');
const wu_apikey = document.getElementById('txtWukey');
const wu_units = document.getElementById('selWuunits');
const me_apikey = document.getElementById('txtMekey');
const me_code = document.getElementById('txtMecode');
const pu_id = document.getElementById('txtPuid');
const al_ip = document.getElementById('txtAlip');
const al_country = document.getElementById('txtAlcountry');
const al_region = document.getElementById('txtAlregion');
const services = document.getElementById('txtServices');
const enable = document.getElementById('selCloud');
// This variable stores all the data.
let data =
'\r {' + ' \r\n ' +
'"##'+'Start of user fields' +'",'+ ' \r\n ' +
'"' + 'lat'+'"' + ':' +"'" + lat.value +"',"+ ' \r\n ' +
'"' + 'lon'+'"' + ':' +"'" +lon.value +"'," + ' \r\n ' +
'"' + 'lang'+'"' + ':' +"'" + lang.value +"'," + ' \r\n ' +
'"' + 'continent'+'"' + ':' +"'" + continent.value +"'," + ' \r\n ' +
'"' + 'aq_apikey'+'"' + ':' +"'" + aq_apikey.value +"'," + ' \r\n ' +
'"' + 'ds_apikey'+'"' + ':' +"'" + ds_apikey.value +"'," + ' \r\n ' +
'"' + 'ds_units'+'"' + ':' +"'" + ds_units.value +"'," + ' \r\n ' +
'"' + 'wu_apikey'+'"' + ':' +"'" + wu_apikey.value +"'," + ' \r\n ' +
'"' + 'wu_units'+'"' + ':' +"'" + wu_units.value +"'," + ' \r\n ' +
'"' + 'me_apikey'+'"' + ':' +"'" + me_apikey.value +"'," + ' \r\n ' +
'"' + 'me_code'+'"' + ':' +"'" + me_code.value +"'," + ' \r\n ' +
'"' + 'pu_id'+'"' + ':' +"'" + pu_id.value +"'," + ' \r\n ' +
'"' + 'al_ip'+'"' + ':' +"'" + al_ip.value +"'," + ' \r\n ' +
'"' + 'al_country'+'"' + ':' +"'" + al_country.value +"'," + ' \r\n ' +
'"' + 'al_region'+'"' + ':' +"'" + al_region.value +"'," + ' \r\n ' +
'"##'+'List of all user fields above to be replaced in strings below' +'",'+ ' \r\n ' +
'"sub_fields"'+':'+"'lat,lon,lang,continent,aq_apikey,ds_apikey,ds_units,wu_apikey,wu_units,me_apikey,me_code,pu_id,al_ip,al_country,al_region'," + ' \r\n ' +
'"config_entries3"'+':'+"'''="+ ' \r\n ' +
"'Weather34WebServices' "+':'+ ' \r\n ' +
'"# Air quality, your own latitude, longitude, token and interval in seconds are required\\n"' + ' \r\n ' +
'"# Dark Sky, your own latitude, longitude, API key, language, units and interval in seconds required\\n"' + ' \r\n ' +
'"# DarkSky Units key us = US Units, ca = METRIC Units, si = METRICWX Units, uk2 = UK(metric with mph) Units\\n"' + ' \r\n ' +
'"# Example https://api.forecast.io/forecast/yourtokenhere/51.94,-0.987?lang=en&units=uk2\\n"' + ' \r\n ' +
'"# Weather Underground, your own latitude, longitude, API key, language, units and interval in seconds required\\n"' + ' \r\n ' +
'"# Weather Underground Units key e = US, m = METRIC, s = SI(with m/s Scandinavia), h = UK(with mph)\\n"' + ' \r\n ' +
'"# Example https://api.weather.com/v3/wx/forecast/daily/5day?geocode=51.94,-0.987&language=en&format=json&units=h&apiKey=yourapikeyhere\\n"' + ' \r\n ' +
'"# Earthquake reports interval in seconds required\\n"' + ' \r\n ' +
'"# K-Index reports interval in seconds required\\n"' + ' \r\n ' +
'"# Metar reports airport code, API Key and interval in seconds required\\n"' + ' \r\n ' +
'"# Example https://api.checkwx.com/metar/EGTK/decoded\\n"' + ' \r\n ' +
'"# Example X-API-Key:yourapikeyhere\\n"' + ' \r\n ' +
'"# Purpleair reports device ID and interval in seconds required\\n"' + ' \r\n ' +
'"# Example https://www.purpleair.com/json?show=38365\\n"' + ' \r\n ' +
'"# Meteoalrm European weather warnings country code, region code and interval in seconds required\\n"' + ' \r\n ' +
'"# Example http://192.168.1.232/weewx/weather34/eualert.php?country=UK®ion=013\\n"' + ' \r\n ' +
'"# Select the services you require by creating a string of the services above\\n"' + ' \r\n ' +
'"# Example services = ds.me.eq.ki.wu.aq.al.ah.ao.aa.pu\\n"' + ' \r\n ' +
'"# Select your prefered time interval in seconds for each service\\n"' + ' \r\n ' +
'{' + ' \r\n ' +
" 'aq_url':'https://api.waqi.info/feed/geo:"+lat.value+';'+lon.value+'/?token='+aq_apikey.value+"'"+','+ ' \r\n ' +
" 'aq_interval':'3600'"+','+ ' \r\n ' +
" 'aq_filename':'/var/www/html/weewx/weather34/jsondata/aqi.txt'"+','+ ' \r\n ' +
" 'ds_url':'https://api.forecast.io/forecast/"+ds_apikey.value+'/'+lat.value+','+lon.value+'?lang='+lang.value+'&units'+'='+ds_units.value+"'"+','+ ' \r\n ' +
" 'ds_interval':'3600'"+','+ ' \r\n ' +
" 'ds_filename':'/var/www/html/weewx/weather34/jsondata/darksky.txt'"+','+ ' \r\n ' +
" 'wu_url':'https://api.weather.com/v3/wx/forecast/daily/5day?geocode="+lat.value+','+lon.value+'&language='+lang.value+'&format=json&units='+wu_units.value+'&apiKey='+wu_apikey.value+"'"+','+ ' \r\n ' +
" 'wu_interval':'3600'"+','+ ' \r\n ' +
" 'wu_filename':'/var/www/html/weewx/weather34/jsondata/wuforecast.txt'"+','+ ' \r\n ' +
" 'eq_url':'https://earthquake-report.com/feeds/recent-eq?json'"+','+ ' \r\n ' +
" 'eq_interval':'3600'"+','+ ' \r\n ' +
" 'eq_filename':'/var/www/html/weewx/weather34/jsondata/eqnotification.txt'"+','+ ' \r\n ' +
" 'ki_url':'https://services.swpc.noaa.gov/products/geospace/planetary-k-index-dst.json'"+','+ ' \r\n ' +
" 'ki_interval':'43200'"+','+ ' \r\n ' +
" 'ki_filename':'/var/www/html/weewx/weather34/jsondata/kindex.txt'"+','+ ' \r\n ' +
" 'me_url':'https://api.checkwx.com/metar/"+me_code.value+'/decoded'+"',"+ ' \r\n ' +
" 'me_header':'X-API-Key:"+me_apikey.value+"'"+','+ ' \r\n ' +
" 'me_interval':'3600'"+','+ ' \r\n ' +
" 'me_filename':'/var/www/html/weewx/weather34/jsondata/metar34.txt'"+','+ ' \r\n ' +
" 'pu_url':'https://www.purpleair.com/json?show="+pu_id.value+"'"+','+ ' \r\n ' +
" 'pu_interval':'3600'"+','+ ' \r\n ' +
" 'pu_filename':'/var/www/html/weewx/weather34/jsondata/purpleair.txt'"+','+ ' \r\n ' +
" 'al_url':'http://"+al_ip.value+'/weewx/weather34/eualert.php?country='+al_country.value+'®ion='+al_region.value+"'"+','+ ' \r\n ' +
" 'al_interval':'3600'"+','+ ' \r\n ' +
" 'al_filename':'/var/www/html/weewx/weather34/jsondata/meteoalarm.txt'"+','+ ' \r\n ' +
" 'services':'"+services.value+"'"+ ' \r\n ' +
" }'''"+','+ ' \r\n ' +
'"config_entries4"'+":'''="+ ' \r\n ' +
"'Weather34CloudCover' :"+ ' \r\n ' +
'"# Apply your own latitude and longitude and continent to the URLs in this section\\n"' + ' \r\n ' +
'{' + ' \r\n ' +
" 'enable':'"+enable.value+"'"+','+ ' \r\n ' +
" 'db_field':'signal8'"+','+ ' \r\n ' +
" 'cc_interval':'300'"+','+ ' \r\n ' +
" 'cc1_url':'https://api.sat24.com/crop?type=visual5hdcomplete&lat="+lat.value+'&lon='+lon.value+'&width=300&height=300&zoom=1.00&continent='+continent.value+"'"+','+ ' \r\n ' +
" 'cc1_filename':'/tmp/sat1.png'"+','+ ' \r\n ' +
" 'cc2_url':'https://api.sat24.com/crop?type=infraPolair&lat="+lat.value+'&lon='+lon.value+'&width=300&height=300&zoom=1.00&continent='+continent.value+"'"+','+ ' \r\n ' +
" 'cc2_filename':'/tmp/sat2.png'"+','+ ' \r\n ' +
" }'''"+','+ ' \r\n ' +
'}'
// Convert the text to BLOB.
const textToBLOB = new Blob([data], { type: 'text/plain' });
const sFileName = 'services.txt'; // The file to save the data.
let newLink = document.createElement("a");
newLink.download = sFileName;
if (window.webkitURL != null) {
newLink.href = window.webkitURL.createObjectURL(textToBLOB);
}
else {
newLink.href = window.URL.createObjectURL(textToBLOB);
newLink.style.display = "none";
document.body.appendChild(newLink);
}
newLink.click();
}
</script>
</html>