Skip to content

Commit

Permalink
fixing #66
Browse files Browse the repository at this point in the history
  • Loading branch information
baerengraben authored and baerengraben committed Jan 6, 2022
1 parent 32c9008 commit dd22118
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ function setCurrentHour(self){
self.log.debug('tried to update current_hour, but no forecast data is available for ' + path + '.0000.DD_DEG' + '. Try my luck on next hour...');
} else {
(function(next) {
self.log.debug('forecast data is available. State.val is: ' + state.val + ': So updating current_hour...read correspondenting hour forecast from ' +
self.log.debug('forecast data is available. ' + path + '.0000.DD_DEG is: ' + state.val + ': So updating current_hour...read correspondenting hour forecast from ' +
'swiss-weather-api.0.forecast.60minutes.day0.actual_hour and write it to swiss-weather-api.0.forecast.current_hour');

self.getState(path + '.' + hour + '00.cur_color.background_color', function (err, state) {
Expand Down Expand Up @@ -845,27 +845,39 @@ function setCurrentHour(self){
}
});
self.getState(path + '.' + hour + '00.FX_KMH', function (err, state) {
if (err){
self.log.error(path + '.' + hour + '00.FX_KMH' + ':' + 'This should not happen. Error is ' + err.message);
}
if ((typeof state !== "undefined") && (state !== null)) {
currentHourVariables.local_FX_KMH = state.val;
} else {
self.log.info(path + '.' + hour + '00.FX_KMH' + ':' + 'This should not happen. State is undefined or null. So in this run no data is copied for this value');
}
});
self.getState(path + '.' + hour + '00.ICON_URL_COLOR', function (err, state) {
if (err){
self.log.error(path + '.' + hour + '00.ICON_URL_COLOR' + ':' + 'This should not happen. Error is ' + err.message);
}
if ((typeof state !== "undefined") && (state !== null)) {
currentHourVariables.local_ICON_URL_COLOR = state.val;
} else {
self.log.info(path + '.' + hour + '00.ICON_URL_COLOR' + ':' + 'This should not happen. State is undefined or null. So in this run no data is copied for this value');
}
});
self.getState(path + '.' + hour + '00.ICON_URL_DARK', function (err, state) {
if (err){
self.log.error(path + '.' + hour + '00.ICON_URL_DARK' + ':' + 'This should not happen. Error is ' + err.message);
}
if ((typeof state !== "undefined") && (state !== null)) {
currentHourVariables.local_ICON_URL_DARK = state.val;
} else {
self.log.info(path + '.' + hour + '00.ICON_URL_DARK' + ':' + 'This should not happen. State is undefined or null. So in this run no data is copied for this value');
}
});
self.getState(path + '.' + hour + '00.ICON_URL_LIGHT', function (err, state) {
if (err){
self.log.error(path + '.' + hour + '00.ICON_URL_LIGHT' + ':' + 'This should not happen. Error is ' + err.message);
}
if ((typeof state !== "undefined") && (state !== null)) {
currentHourVariables.local_ICON_URL_LIGHT = state.val;
} else {
Expand Down Expand Up @@ -942,7 +954,7 @@ function setCurrentHour(self){
//first do updateVariables() and wait until its finished
const result= await updateVariables();
let updatePath = "forecast.current_hour";
self.log.debug('...and now add current_hour objects.');
self.log.debug('...and now add updated variables to current_hour objects.');


//*** Create current_hour object ***
Expand Down

0 comments on commit dd22118

Please sign in to comment.