Skip to content

Commit

Permalink
issue jscontroller 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
misanorot committed Oct 29, 2023
1 parent 7b5624c commit 8e69e94
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1964,20 +1964,16 @@ class Alarm extends utils.Adapter {


getAstro() {
try {
this.getForeignObject('system.config', 'state', (err, obj) => {
if (obj && obj.common && obj.common.longitude && obj.common.latitude) {
const longitude = obj.common.longitude;
const latitude = obj.common.latitude;
this.log.debug(`longitude: ${longitude} | latitude: ${latitude}`);
this.setSun(longitude, latitude);
} else {
this.log.error('System location settings cannot be called up. Please check configuration!');
}
});
} catch (err) {
this.log.warn('System location settings cannot be called up. Please check configuration!');
}
this.getForeignObject('system.config', (err, obj) => {
if (obj && obj.common && obj.common.longitude && obj.common.latitude) {
const longitude = obj.common.longitude;
const latitude = obj.common.latitude;
this.log.debug(`longitude: ${longitude} | latitude: ${latitude}`);
this.setSun(longitude, latitude);
} else {
this.log.error('System location settings cannot be called up. Please check configuration!');
}
});
}

async setSun(longitude, latitude) {
Expand Down

0 comments on commit 8e69e94

Please sign in to comment.