Repository navigation
Expand file tree
/
Copy pathapp.js
More file actions
59 lines (43 loc) · 1.49 KB
/
Copy pathapp.js
File metadata and controls
59 lines (43 loc) · 1.49 KB
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
/* eslint-disable global-require */
'use strict';
const Homey = require('homey');
const { httpGet } = require('./lib/proto');
class HomeshController extends Homey.App {
/**
* onInit is called when the app is initialized.
*/
async onInit() {
this.log('HomeshController App has been initialized');
// eslint-disable-next-line node/no-unsupported-features/node-builtins
//if (process.env.DEBUG === '1') require('inspector').open(9223, '0.0.0.0', true);
if (process.env.DEBUG === '1' || false) {
try {
require('inspector').waitForDebugger();
}
catch (error) {
require('inspector').open(9204, '0.0.0.0', true);
}
}
this.ip = (await this.homey.cloud.getLocalAddress()).split(':')[0];
this.microWebServerFtpPort = await this.homey.settings.get('microWebServerFtpPort');
if(!this.microWebServerFtpPort) {
this.microWebServerFtpPort = 5081;
this.homey.settings.set('microWebServerFtpPort', this.microWebServerFtpPort);
}
this.homey.settings.on('set', async (key)=> {
switch (key) {
case 'microWebServerFtpPort':
this.microWebServerFtpPort = await this.homey.settings.get('microWebServerFtpPort');
this.emit('microWebServerFtpPort', this.microWebServerFtpPort);
break;
}
if(key==='microWebServerFtpPort') {
let a = 1;
}
});
}
// async onUninit() {
// if(this.client) this.client.close();
// }
}
module.exports = HomeshController;