Added TLS support

This commit is contained in:
Serge Wagener committed 2022-02-10 14:46:12 +01:00
1 parent 0167799c54
commit b2a287934c
3 files changed
+61 -27

No files matched your search

+5 -1
View File
@@ -54,7 +54,11 @@ export class SmartHomeNGPlatform implements StaticPlatformPlugin {
public readonly api: API,
) {
log.debug('Using config file', api.user.configPath());
this.shng = new SmartHomeNG(this, 'ws://smarthome.iot.wagener.family:2424/');
const host = this.config.host ? this.config.host : 'smarthome.local';
const port = this.config.port ? this.config.port : '2424';
const protocol = this.config.tls ? 'wss' : 'ws';
const url = protocol + '://' + host + ':' + port + '/';
this.shng = new SmartHomeNG(this, url);
this.api.on('didFinishLaunching', () => {
log.debug('Executed didFinishLaunching callback');