-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.py
356 lines (331 loc) · 16.8 KB
/
install.py
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
# Copyright (c) 2021-2023 Rich Bell <[email protected]>
# See the file LICENSE.txt for your rights.
""" Installer for the jas skin. """
try:
# Python 2
from StringIO import StringIO
except ImportError:
# Python 3
from io import StringIO
import configobj
from weecfg.extension import ExtensionInstaller
VERSION = "1.2.0-rc01"
EXTENSION_CONFIG = """
[StdReport]
# jas (Just another Skin) is highly configurable. This is an example to get the skin up and running.
# For more information head over to, https://github.com/bellrichm/weewx-jas/wiki/Getting-Started
[[jas]]
skin = jas
HTML_ROOT = jas
enable = true
[[[Extras]]]
# controls logging in the browser console
# 1: debug/verbose and higher
# 2: info and higher
# 3: warn and higher (default)
# 4: error and higher
jas_debug_level = 3
# When True, the browser's preferred language setting is used to determine the language display settings.
# When False, the skin's lang setting is used.
# The default is False.
# For more information see, https://www.w3.org/International/questions/qa-lang-priorities#changing
# use_browser_language_preference = True
# display_aeris_observation = True
# This sets the 'page' that is first displayed.
# It should be one of the 'pages' in the [[[[pages]]]] section.
# If not set, the first/left most page is used.
# landing_page = last24hours
chart_modal = True
# The client id abd secret for Aeris APIs
client_id = REPLACE_ME
client_secret = REPLACE_ME
[[[[mqtt]]]]
enable = False
host = REPLACE_ME
port = REPLACE_ME
useSSL = false
username = REPLACE_ME
password = REPLACE_ME
[[[[[topics]]]]]
[[[[[[weather/loop]]]]]]
# Define an additional chart.
# Once a chart is defined, it can be added to pages.
# https://github.com/bellrichm/weewx-jas/wiki/Defining-New-Charts
[[[[chart_definitions]]]]
# The name of this chart is inTemp. It could be anything.
[[[[[inTemp]]]]]
# Options that are not used by eCharts are put under 'weewx' stanzas'
[[[[[[weewx]]]]]]
# Because we are defining the chart to be used only at this site,
# we can put text strings directly in weewx.conf
title = Inside Temperature
[[[[[[series]]]]]]
# Chart one observation, inTemp
[[[[[[[inTemp]]]]]]]
# The '$current' value of these observations will be displayed.
# If MQTT is enabled, these will be updated when a message is received.
# https://github.com/bellrichm/weewx-jas/wiki/Sections#the-current-section
[[[[current]]]]
# The header observation is outTemp
observation = outTemp
[[[[[observations]]]]]
[[[[[[heatindex]]]]]]
[[[[[[windchill]]]]]]
[[[[[[dewpoint]]]]]]
[[[[[[outHumidity]]]]]]
[[[[[[barometer]]]]]]
[[[[[[windSpeed]]]]]]
[[[[[[rain]]]]]]
mqtt = false
type = sum
[[[[[[rainRate]]]]]]
[[[[[[ET]]]]]]
mqtt = false
type = sum
[[[[[[UV]]]]]]
[[[[[[radiation]]]]]]
# The minimum and maximum values of these observations will be displayed.
# https://github.com/bellrichm/weewx-jas/wiki/Sections#the-minmax-section
[[[[minmax]]]]
[[[[[observations]]]]]
[[[[[[outTemp]]]]]]
[[[[[[heatindex]]]]]]
[[[[[[windchill]]]]]]
[[[[[[dewpoint]]]]]]
[[[[[[outHumidity]]]]]]
[[[[[[barometer]]]]]]
[[[[[[windSpeed]]]]]]
[[[[[[rainRate]]]]]]
[[[[[[UV]]]]]]
[[[[[[radiation]]]]]]
# For the selected date, values of these observations will be displayed.
# https://github.com/bellrichm/weewx-jas/wiki/Sections#the-thisdate-section
[[[[thisdate]]]]
[[[[[observations]]]]]
[[[[[[outTemp]]]]]]
[[[[[[heatindex]]]]]]
[[[[[[windchill]]]]]]
[[[[[[dewpoint]]]]]]
[[[[[[outHumidity]]]]]]
[[[[[[barometer]]]]]]
[[[[[[windSpeed]]]]]]
[[[[[[rain]]]]]]
type = sum
[[[[[[rainRate]]]]]]
[[[[[[UV]]]]]]
[[[[[[ET]]]]]]
type = sum
[[[[[[radiation]]]]]]
# The pages and the content on the pages to display.
# https://github.com/bellrichm/weewx-jas/wiki/Pages
# https://github.com/bellrichm/weewx-jas/wiki/Predefined-Charts
# https://github.com/bellrichm/weewx-jas/wiki/Sections
[[[[pages]]]]
[[[[[last24hours]]]]]
[[[[[[current]]]]]]
[[[[[[minmax]]]]]]
#[[[[[[forecast]]]]]]
# layout = row
[[[[[[outTemp]]]]]]
[[[[[[outHumidity]]]]]]
[[[[[[barometer]]]]]]
[[[[[[rain]]]]]]
[[[[[[wind]]]]]]
[[[[[[ET]]]]]]
[[[[[[UV]]]]]]
[[[[[[radiation]]]]]]
#[[[[[[radar]]]]]]
# Here is the user defined chart, inTemp.
#[[[[[[inTemp]]]]]]
[[[[[last7days]]]]]
[[[[[[minmax]]]]]]
[[[[[[outTemp]]]]]]
[[[[[[outHumidity]]]]]]
[[[[[[barometer]]]]]]
[[[[[[rain]]]]]]
[[[[[[wind]]]]]]
[[[[[[ET]]]]]]
[[[[[[UV]]]]]]
[[[[[[radiation]]]]]]
[[[[[last31days]]]]]
zoomControl = True
[[[[[[minmax]]]]]]
[[[[[[outTempMinMax]]]]]]
[[[[[[outHumidityMinMax]]]]]]
[[[[[[barometer]]]]]]
[[[[[[rain]]]]]]
[[[[[[wind]]]]]]
[[[[[[ET]]]]]]
[[[[[[UVMax]]]]]]
[[[[[[radiationMax]]]]]]
[[[[[last366days]]]]]
zoomControl = True
[[[[[[minmax]]]]]]
[[[[[[outTempMinMax]]]]]]
[[[[[[outHumidityMinMax]]]]]]
[[[[[[barometer]]]]]]
[[[[[[rain]]]]]]
[[[[[[wind]]]]]]
[[[[[[ET]]]]]]
[[[[[[UVMax]]]]]]
[[[[[[radiationMax]]]]]]
[[[[[yeartoyear]]]]]
[[[[[[outTempMax]]]]]]
[[[[[[outTempMin]]]]]]
[[[[[[windchillMin]]]]]]
[[[[[[heatindexMax]]]]]]
[[[[[[barometer]]]]]]
[[[[[[dewpointMax]]]]]]
[[[[[[dewpointMin]]]]]]
[[[[[[outHumidityMax]]]]]]
[[[[[[outHumidityMin]]]]]]
[[[[[[rainOnly]]]]]]
[[[[[[windGustOnly]]]]]]
[[[[[[ET]]]]]]
[[[[[[UVMax]]]]]]
[[[[[[radiationMax]]]]]]
[[[[[multiyear]]]]]
enable = false
[[[[[[outTempMinMax]]]]]]
[[[[[[barometer]]]]]]
[[[[[[outHumidityMinMax]]]]]]
[[[[[[rain]]]]]]
[[[[[[wind]]]]]]
[[[[[[ET]]]]]]
[[[[[[UVMax]]]]]]
[[[[[[radiationMax]]]]]]
[[[[[archive-year]]]]]
zoomControl = True
[[[[[[minmax]]]]]]
[[[[[[thisdate]]]]]]
[[[[[[outTempMinMax]]]]]]
[[[[[[outHumidityMinMax]]]]]]
[[[[[[barometer]]]]]]
[[[[[[rain]]]]]]
[[[[[[wind]]]]]]
[[[[[[ET]]]]]]
[[[[[[UVMax]]]]]]
[[[[[[radiationMax]]]]]]
[[[[[archive-month]]]]]
enable = false
zoomControl = True
[[[[[[minmax]]]]]]
[[[[[[thisdate]]]]]]
[[[[[[outTempMinMax]]]]]]
[[[[[[outHumidityMinMax]]]]]]
[[[[[[barometer]]]]]]
[[[[[[rain]]]]]]
[[[[[[wind]]]]]]
[[[[[[ET]]]]]]
[[[[[[UVMax]]]]]]
[[[[[[radiationMax]]]]]]
[[[[[about]]]]]
[[[[[[about]]]]]]
filename = sections/basic_about.inc
[[[[[debug]]]]]
enable = false
[[[[[[outTemp]]]]]]
series_type = mqtt
[[[[[[barometer]]]]]]
"""
EXTENSION_DICT = configobj.ConfigObj(StringIO(EXTENSION_CONFIG))
def loader():
""" Load and return the extension installer. """
return JASInstaller()
class JASInstaller(ExtensionInstaller):
""" The extension installer. """
def __init__(self):
super(JASInstaller, self).__init__(
version=VERSION,
name='jas',
description='Interactive charts using ECharts and Bootstrap.',
author="Rich Bell",
author_email="[email protected]",
config=EXTENSION_DICT,
files=[('bin/user', ['bin/user/jas.py']),
('skins/jas',
['skins/jas/icon/android-chrome-192x192.png',
'skins/jas/icon/android-chrome-512x512.png',
'skins/jas/icon/apple-touch-icon.png',
'skins/jas/icon/favicon.ico',
'skins/jas/icon/favicon-16x16.png',
'skins/jas/icon/favicon-32x32.png',
'skins/jas/jas.css.tmpl',
'skins/jas/user.css.tmpl'
]),
('skins/jas/pages', [
'skins/jas/pages/about.html.tmpl',
'skins/jas/pages/debug.html.tmpl',
'skins/jas/pages/day.html.tmpl',
'skins/jas/index.html.tmpl',
'skins/jas/pages/last7days.html.tmpl',
'skins/jas/pages/last24hours.html.tmpl',
'skins/jas/pages/last31days.html.tmpl',
'skins/jas/pages/last366days.html.tmpl',
'skins/jas/manifest.json.tmpl',
'skins/jas/pages/month.html.tmpl',
'skins/jas/skin.conf',
'skins/jas/pages/week.html.tmpl',
'skins/jas/pages/year.html.tmpl',
'skins/jas/pages/yesterday.html.tmpl',
'skins/jas/pages/yeartoyear.html.tmpl',
'skins/jas/pages/multiyear.html.tmpl',
'skins/jas/pages/%Y.html.tmpl',
'skins/jas/pages/%Y-%m.html.tmpl'
]),
('skins/jas/data', [
'skins/jas/data/debug.js.tmpl',
'skins/jas/data/day.js.tmpl',
'skins/jas/data/internationalization.js.tmpl',
'skins/jas/data/last7days.js.tmpl',
'skins/jas/data/last24hours.js.tmpl',
'skins/jas/data/last31days.js.tmpl',
'skins/jas/data/last366days.js.tmpl',
'skins/jas/data/month.js.tmpl',
'skins/jas/data/month%Y%m.js.tmpl',
'skins/jas/data/multiyear.js.tmpl',
'skins/jas/data/week.js.tmpl',
'skins/jas/data/year.js.tmpl',
'skins/jas/data/yeartoyear.js.tmpl',
'skins/jas/data/year%Y.js.tmpl',
'skins/jas/data/yesterday.js.tmpl',
]),
('skins/jas/generators', [
'skins/jas/generators/body.inc',
'skins/jas/generators/data.gen',
'skins/jas/generators/pages.gen',
]),
('skins/jas/javascript', [
'skins/jas/javascript/about.js.tmpl',
'skins/jas/javascript/day.js.tmpl',
'skins/jas/javascript/debug.js.tmpl',
'skins/jas/javascript/index.js.tmpl',
'skins/jas/javascript/last7days.js.tmpl',
'skins/jas/javascript/last24hours.js.tmpl',
'skins/jas/javascript/last31days.js.tmpl',
'skins/jas/javascript/last366days.js.tmpl',
'skins/jas/javascript/month.js.tmpl',
'skins/jas/javascript/mqtt.js.tmpl',
'skins/jas/javascript/week.js.tmpl',
'skins/jas/javascript/year.js.tmpl',
'skins/jas/javascript/yesterday.js.tmpl',
'skins/jas/javascript/yeartoyear.js.tmpl',
'skins/jas/javascript/multiyear.js.tmpl',
'skins/jas/javascript/%Y.js.tmpl',
'skins/jas/javascript/%Y-%m.js.tmpl'
]),
('skins/jas/lang', ['skins/jas/lang/en.conf']),
('skins/jas/sections', [
'skins/jas/sections/basic_about.inc',
'skins/jas/sections/chart.inc',
'skins/jas/sections/current.inc',
'skins/jas/sections/current_modal.inc',
'skins/jas/sections/debug.inc',
'skins/jas/sections/forecast.inc',
'skins/jas/sections/minmax.inc',
'skins/jas/sections/radar.inc',
'skins/jas/sections/thisdate.inc',
'skins/jas/sections/zoomControl.inc'
])
]
)