-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconfig.js
63 lines (62 loc) · 2.58 KB
/
config.js
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
const pkg = require('./package.json');
module.exports = require('yargs')
.env('HM2MQTT')
.usage(pkg.name + ' ' + pkg.version + '\n' + pkg.description + '\n\nUsage: $0 [options]')
.describe('verbosity', 'possible values: "error", "warn", "info", "debug"')
.describe('name', 'instance name. used as mqtt client id and as prefix for connected topic')
.describe('mqtt-url', 'mqtt broker url. See https://github.com/mqttjs/MQTT.js#connect-using-a-url')
.describe('ping-interval', 'Send a Ping if no event occured in the last interval. Re-Init on next interval')
.describe('disable-rega', 'Don\'t sync names from ReGa')
.describe('json-name-table', 'A JSON file that maps device and channel addresses to names')
.describe('duty-cycle-poll-interval', 'Interval in seconds to poll duty cycle from rf interfaces. Set to `0` to disable')
.describe('rega-poll-interval', 'Interval in seconds to poll variables from Rega. Set to 0 to disable polling')
.describe('rega-poll-trigger', 'A virtual button that triggers a variable poll. Example: BidCoS-RF:50.PRESS_SHORT')
.describe('listen-address', 'Address the RPC servers bind to')
.describe('init-address', 'Address used in the RPC init. Normally there is no need to set this')
.describe('help', 'show help')
.describe('publish-metadata', '')
.describe('publish-counters', '')
.describe('mqtt-retain', 'enable/disable retain flag for mqtt messages')
.describe('insecure', 'allow tls connections with invalid certificates')
.boolean('insecure')
.alias({
a: 'ccu-address',
b: 'binrpc-listen-port',
d: 'disable-rega',
h: 'help',
i: 'ping-interval',
j: 'json-name-table',
l: 'listen-port',
m: 'mqtt-url',
n: 'name',
q: 'hmip-reconnect-interval',
r: 'listen-address',
s: 'init-address',
v: 'verbosity'
})
.boolean('mqtt-retain')
.boolean('publish-counters')
.boolean('publish-metadata')
.default({
'disable-rega': false,
'mqtt-url': 'mqtt://127.0.0.1',
name: 'hm',
verbosity: 'info',
'listen-address': require('./firstip.js'),
'listen-port': 2126,
'binrpc-listen-port': 2127,
'ping-interval': 30,
'hmip-reconnect-interval': 600,
'duty-cycle-poll-interval': 180,
'rega-poll-interval': 0,
'rega-poll-trigger': '',
'publish-metadata': false,
'publish-counters': false,
'mqtt-retain': true
})
.demandOption([
'ccu-address'
])
.version()
.help('help')
.argv;