-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.py
70 lines (59 loc) · 2.18 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
# Copyright (c) 2023-2024 Rich Bell <[email protected]>
# See the file LICENSE.txt for your rights.
""" Installer for the AQI XType. """
from io import StringIO
import configobj
from weecfg.extension import ExtensionInstaller
VERSION = "1.2.0-rc02"
EXTENSION_CONFIG = """
[StdReport]
[[Defaults]]
[[[Labels]]]
[[[[Generic]]]]
pm2_5_aqi = AQI
pm2_5_aqi_nowcast = AQI (Nowcast)
[StdWXCalculate]
[[Calculations]]
pm2_5_aqi = prefer_hardware
# Since this requires a database look up, by default do not populate loop packets
pm2_5_aqi_nowcast = prefer_hardware, archive
[aqitype]
# The name of AQI field.
# Create a section for each field to be calculated.
[[pm2_5_aqi]]
# The name of the WeeWX observation to be used in the calculation.
input = pm2_5
# The name of the algorithm.
# Supported values: EPAAQI, NOWCAST
algorithm = EPAAQI
# If the algorithm supports different pollutants(pm 2.5, pm 10, etc)
# Supported values: pm2_5, pm10
type = pm2_5
[[pm2_5_aqi_nowcast]]
# The name of the WeeWX observation to be used in the calculation.
input = pm2_5
# The name of the algorithm.
# Supported values: EPAAQI, NOWCAST
algorithm = NOWCAST
# If the algorithm supports different pollutants(pm 2.5, pm 10, etc)
# Supported values: pm2_5, pm10
type = pm2_5
"""
EXTENSION_DICT = configobj.ConfigObj(StringIO(EXTENSION_CONFIG))
def loader():
""" Load and return the extension installer. """
return AQITypeInstaller()
class AQITypeInstaller(ExtensionInstaller):
""" The extension installer. """
def __init__(self):
super(AQITypeInstaller, self).__init__(
version=VERSION,
name='AQITYPE',
description='Dynamically compute AQI via WeeWX Xtype.',
author="Rich Bell",
author_email="[email protected]",
xtype_services='user.aqitype.AQITypeManager',
config=EXTENSION_DICT,
files=[('bin/user', ['bin/user/aqitype.py']),
]
)