-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathinstall.py
executable file
·65 lines (47 loc) · 1.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
#
# Copyright (c) 2020-2024 Rich Bell <[email protected]>
#
# See the file LICENSE.txt for your full rights.
#
""" Installer for MTTQSubscribe driver and service. """
from io import StringIO
import configobj
from weecfg.extension import ExtensionInstaller
VERSION = '3.0.1-rc01'
MQTTSUBSCRIBE_CONFIG = """
[MQTTSubscribeDriver]
# This section is for the MQTTSubscribe driver.
# The driver to use.
# Only used by the driver.
driver = user.MQTTSubscribe
# Controls if validation errors raise an exception (stopping WeeWX from starting) or only logged.
# Default is false
stop_on_validation_errors = true
[MQTTSubscribeService]
# This section is for the MQTTSubscribe service.
# Turn the service on and off.
# Default is: true
# Only used by the service.
enable = false
# Controls if validation errors raise an exception (stopping WeeWX from starting) or only logged.
# Default is false
stop_on_validation_errors = true
"""
def loader():
""" Load and return the extension installer. """
return MQTTSubscribeServiceInstaller()
class MQTTSubscribeServiceInstaller(ExtensionInstaller):
""" The extension installer. """
def __init__(self):
install_dict = {
'version': VERSION,
'name': 'MQTTSubscribe',
'description': 'Source WeeWX data from MQTT.',
'author': "Rich Bell",
'author_email': "[email protected]",
'files': [('bin/user', ['bin/user/MQTTSubscribe.py'])]
}
MQTTSubscribe_dict = configobj.ConfigObj(StringIO(MQTTSUBSCRIBE_CONFIG)) # pylint: disable = invalid-name
install_dict['config'] = MQTTSubscribe_dict
install_dict['data_services'] = 'user.MQTTSubscribe.MQTTSubscribeService'
super().__init__(install_dict)