Skip to content

Commit

Permalink
Merge branch 'patch-use-gh-actions' of github.com:jpawlowski/ioBroker…
Browse files Browse the repository at this point in the history
….lgtv into patch-use-gh-actions
  • Loading branch information
jpawlowski committed Jul 4, 2023
2 parents f2c711d + 54783a8 commit ba91075
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 ba91075

Please sign in to comment.