diff --git a/main.js b/main.js index 5428caa..44c15ca 100644 --- a/main.js +++ b/main.js @@ -297,5 +297,28 @@ function main() { }); + // try to load certificates + if (adapter.config.secure) { + // Load certificates + // Load certificates + adapter.getCertificates(function (err, certificates, leConfig) { + adapter.config.certificates = certificates; + adapter.config.leConfig = leConfig; + initWebServer(adapter.config); + }); + } else { + initWebServer(adapter.config); + } + + // Convert port to number + adapter.config.interval = parseInt(adapter.config.interval, 10); + + // If interval and URl are set => poll it every X milliseconds + if (adapter.config.interval && adapter.config.pollURL) { + // initial poll + pollData(); + // poll every x milliseconds + timer = setInterval(pollData, adapter.config.interval); + } }