Skip to content

Commit

Permalink
healthIntervall -> healthInterval
Browse files Browse the repository at this point in the history
  • Loading branch information
jpawlowski authored Jul 2, 2023
1 parent 7a09677 commit 54783a8
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let isConnect = false;
let lgtvobj, clientKey, volume, oldvolume;
let keyfile = 'lgtvkeyfile';
let renewTimeout = null;
let healthIntervall = null;
let healthInterval = null;
let curApp = '';

function startAdapter(options) {
Expand Down Expand Up @@ -486,9 +486,9 @@ function connect(cb) {
setTimeout(function () {
if (!curApp) {
// curApp is not set in meantime
if (healthIntervall && !adapter.config.healthIntervall) {
clearInterval(healthIntervall);
healthIntervall = false; // TV works fine, healthIntervall is not longer nessessary
if (healthInterval && !adapter.config.healthInterval) {
clearInterval(healthInterval);
healthInterval = false; // TV works fine, healthInterval is not longer nessessary
adapter.log.info(
'detect poweroff event, polling not longer nessesary. if you have problems, check settings',
);
Expand Down Expand Up @@ -547,7 +547,7 @@ function checkConnection(secondCheck) {
if (secondCheck) {
if (!isConnect) {
adapter.setStateChanged('info.connection', false, true);
healthIntervall && clearInterval(healthIntervall);
healthInterval && clearInterval(healthInterval);
checkCurApp(true);
}
} else {
Expand Down Expand Up @@ -584,10 +584,10 @@ function checkCurApp(powerOff) {
renewTimeout = setTimeout(() => {
lgtvobj.disconnect();
setTimeout(lgtvobj.connect, 500, hostUrl);
if (healthIntervall !== false) {
healthIntervall = setInterval(
if (healthInterval !== false) {
healthInterval = setInterval(
sendCommand,
adapter.config.healthIntervall || 60000,
adapter.config.healthInterval || 60000,
'ssap://com.webos.service.tv.time/getCurrentTime',
null,
(err, _val) => {
Expand All @@ -597,8 +597,8 @@ function checkCurApp(powerOff) {
);
}
}, 60000);
} //else if (healthIntervall)
//clearInterval(healthIntervall);
} //else if (healthInterval)
//clearInterval(healthInterval);
}
});
}
Expand Down Expand Up @@ -659,7 +659,7 @@ function main() {
const dir = path.join(utils.getAbsoluteDefaultDataDir(), adapter.namespace.replace('.', '_'));
keyfile = path.join(dir, keyfile);
adapter.log.debug('adapter.config = ' + JSON.stringify(adapter.config));
if (adapter.config.healthIntervall < 1) healthIntervall = false;
if (adapter.config.healthInterval < 1) healthInterval = false;
if (!fs.existsSync(dir)) fs.mkdirSync(dir);
fs.readFile(keyfile, (err, data) => {
if (!err) {
Expand Down

0 comments on commit 54783a8

Please sign in to comment.