Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduced logging #127

Merged
merged 4 commits into from
Aug 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 29 additions & 29 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,26 +310,26 @@ EvohomePlatform.prototype = {
}.bind(this)
)
.fail(function (err) {
that.log("Evohome failed:", err);
that.log.error("Evohome failed:", err);
callback([]);
});
}.bind(this)
)
.fail(function (err) {
that.log("Evohome failed:", err);
that.log.error("Evohome failed:", err);
callback([]);
});
}.bind(this)
)
.fail(function (err) {
that.log("Evohome Failed:", err);
that.log.error("Evohome Failed:", err);
callback([]);
});
}.bind(this)
)
.fail(function (err) {
// tell me if login did not work!
that.log("Error during Login:", err);
that.log.error("Error during Login:", err);
callback([]);
});
},
Expand All @@ -344,10 +344,10 @@ EvohomePlatform.prototype.renewSession = function () {
// renew session token
session.sessionId = "bearer " + json.access_token;
session.refreshToken = json.refresh_token;
that.log("Renewed Honeywell API authentication token!");
that.log.debug("Renewed Honeywell API authentication token!");
})
.fail(function (err) {
that.log("Renewing Honeywell API authentication token failed:", err);
that.log.error("Renewing Honeywell API authentication token failed:", err);
});
};

Expand Down Expand Up @@ -425,7 +425,7 @@ EvohomePlatform.prototype.periodicUpdate = function () {
oldCurrentTemp != newCurrentTemp &&
service
) {
this.log(
this.log.debug(
"Updating: " +
device.name +
" currentTempChange from: " +
Expand Down Expand Up @@ -604,17 +604,17 @@ EvohomePlatform.prototype.periodicUpdate = function () {
}.bind(this)
)
.fail(function (err) {
this.log("Evohome Failed:", err);
this.log.error("Evohome Failed:", err);
});
}.bind(this)
)
.fail(function (err) {
this.log("Evohome Failed:", err);
this.log.error("Evohome Failed:", err);
});
}.bind(this)
)
.fail(function (err) {
this.log("Evohome Failed:", err);
this.log.error("Evohome Failed:", err);
}.bind(this));

this.updating = false;
Expand Down Expand Up @@ -701,13 +701,13 @@ EvohomeThermostatAccessory.prototype = {
var currenttime = correctDate.toLocaleTimeString([], {
hour12: false,
});
that.log("The current time is", currenttime);
that.log.debug("The current time is", currenttime);
var proceed = true;
var nextScheduleTime = null;

for (var scheduleId in schedule) {
if (schedule[scheduleId].dayOfWeek == weekday[weekdayNumber]) {
that.log(
that.log.debug(
"Schedule points for today (" +
schedule[scheduleId].dayOfWeek +
")"
Expand All @@ -726,7 +726,7 @@ EvohomeThermostatAccessory.prototype = {
logline = logline + " -> next change";
}
}
that.log(logline);
that.log.debug(logline);
}
if (proceed == true) {
nextScheduleTime = "00:00:00";
Expand All @@ -744,16 +744,16 @@ EvohomeThermostatAccessory.prototype = {
session
.setHeatSetpoint(that.device.zoneID, value, nextScheduleTime)
.then(function (taskId) {
that.log("Successfully changed temperature!");
that.log(taskId);
that.log.debug("Successfully changed temperature!");
that.log.debug(taskId);
// returns taskId if successful
that.targetTemperateToSet = -1;
that.thermostat.setpointStatus.targetHeatTemperature = value;
// set target temperature here also to prevent from setting temperature two times
});
})
.fail(function (err) {
that.log("Evohome failed:", err);
that.log.error("Evohome failed:", err);
that.targetTemperateToSet = -1;
//callback(null, Number(0));
});
Expand All @@ -766,7 +766,7 @@ EvohomeThermostatAccessory.prototype = {
// need to refresh data if outdated!!
var currentTemperature = this.thermostat.temperatureStatus.temperature;
callback(null, Number(currentTemperature));
that.log(
that.log.debug(
"Current temperature of " + this.name + " is " + currentTemperature + "°"
);
},
Expand Down Expand Up @@ -794,7 +794,7 @@ EvohomeThermostatAccessory.prototype = {
getName: function (callback) {
var that = this;

that.log("requesting name of", this.name);
that.log.debug("requesting name of", this.name);

callback(this.name);
},
Expand All @@ -820,14 +820,14 @@ EvohomeThermostatAccessory.prototype = {

if (value == 0) {
// OFF
that.log("OFF selected, turning heating off");
that.log.debug("OFF selected, turning heating off");

// set temperature to 5 degrees permanently when heating is "off"
session
.setHeatSetpoint(that.device.zoneID, 5, null)
.then(function (taskId) {
that.log("Heating is set off for " + that.name + " (set to 5°)");
that.log(taskId);
that.log.debug(taskId);
// returns taskId if successful
that.thermostat.setpointStatus.targetHeatTemperature = 5;
// set target temperature here also to prevent from setting temperature two times
Expand All @@ -836,7 +836,7 @@ EvohomeThermostatAccessory.prototype = {
// HEAT or COOL
that.getTargetHeatingCooling(function (dummy, currentState) {
if (currentState == 0) {
that.log(
that.log.debug(
"HEAT or COOL selected, previous state OFF, cancelling override"
);

Expand All @@ -849,7 +849,7 @@ EvohomeThermostatAccessory.prototype = {
that.name +
" (set to follow schedule)"
);
that.log(taskId);
that.log.debug(taskId);
// returns taskId if successful
});
} else {
Expand All @@ -860,7 +860,7 @@ EvohomeThermostatAccessory.prototype = {
});
} else {
// AUTO
that.log("AUTO selected, cancelling overrides");
that.log.debug("AUTO selected, cancelling overrides");

// set thermostat to follow the schedule by passing 0 to the method
session
Expand All @@ -869,7 +869,7 @@ EvohomeThermostatAccessory.prototype = {
that.log(
"Cancelled override for " + that.name + " (set to follow schedule)"
);
that.log(taskId);
that.log.debug(taskId);
// returns taskId if successful
});
}
Expand Down Expand Up @@ -913,15 +913,15 @@ EvohomeThermostatAccessory.prototype = {
if ((this.model = "HeatingZone")) {
var targetTemperature = this.thermostat.setpointStatus
.targetHeatTemperature;
that.log(
that.log.debug(
"Target temperature for",
this.name,
"is",
targetTemperature + "°"
);
} else {
var targetTemperature = 0;
that.log(
that.log.debug(
"Will set target temperature for",
this.name,
"to " + targetTemperature + "°"
Expand Down Expand Up @@ -985,7 +985,7 @@ EvohomeThermostatAccessory.prototype = {

//var serial = 123456 + this.deviceID;
var strSerial = this.systemId + "-" + this.serial;
this.log("Serial: " + strSerial)
this.log.debug("Serial: " + strSerial)

informationService
.setCharacteristic(Characteristic.Identify, this.name)
Expand Down Expand Up @@ -1093,7 +1093,7 @@ function EvohomeSwitchAccessory(
EvohomeSwitchAccessory.prototype = {
getActive: function (callback) {
var that = this;
that.log("System mode " + that.systemMode + " is " + that.active);
that.log.debug("System mode " + that.systemMode + " is " + that.active);
callback(null, that.active);
},

Expand Down Expand Up @@ -1127,7 +1127,7 @@ EvohomeSwitchAccessory.prototype = {
}
})
.fail(function (err) {
that.log("Evohome failed:", err);
that.log.error("Evohome failed:", err);
callback(err);
});
},
Expand Down