Skip to content

Commit

Permalink
Improved debug message output
Browse files Browse the repository at this point in the history
  • Loading branch information
lprhodes committed Mar 22, 2018
1 parent 99df36e commit 18303be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions accessories/aircon.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ class AirConAccessory extends BroadlinkRMAccessory {
const { config, debug, host, log, name } = this;
const { temperatureFilePath } = config;

if (debug) log(`${name} updateTemperatureFromFile reading file: ${temperatureFilePath}`);
if (debug) log(`\x1b[33m[DEBUG]\x1b[0m ${name} updateTemperatureFromFile reading file: ${temperatureFilePath}`);

fs.readFile(temperatureFilePath, 'utf8', (err, temperature) => {

Expand All @@ -428,11 +428,11 @@ class AirConAccessory extends BroadlinkRMAccessory {
return;
}

if (debug) log(`${name} updateTemperatureFromFile (file content: ${temperature.trim()})`);
if (debug) log(`\x1b[33m[DEBUG]\x1b[0m ${name} updateTemperatureFromFile (file content: ${temperature.trim()})`);

temperature = parseFloat(temperature);

if (debug) log(`${name} updateTemperatureFromFile (parsed temperature: ${temperature})`);
if (debug) log(`\x1b[33m[DEBUG]\x1b[0m ${name} updateTemperatureFromFile (parsed temperature: ${temperature})`);

this.onTemperature(temperature);
});
Expand Down
4 changes: 2 additions & 2 deletions helpers/sendData.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ module.exports = ({ host, hexData, log, name, debug }) => {

// Check for pronto code
if (hexData.substring(0, 4) === '0000') {
if (debug) log(`${name} sendHex (Converting Pronto code "${hexData}" to Broadlink code)`);
if (debug) log(`\x1b[33m[DEBUG]\x1b[0m ${name} sendHex (Converting Pronto code "${hexData}" to Broadlink code)`);
hexData = convertProntoCode(hexData)
if (debug) log(`${name} sendHex (Pronto code successfuly converted: "${hexData}")`);
if (debug) log(`\x1b[33m[DEBUG]\x1b[0m ${name} sendHex (Pronto code successfuly converted: "${hexData}")`);

if (!hexData) return log(`\x1b[31m[ERROR] \x1b[0m${name} sendData (A Pronto code was detected however its conversion to a Broadlink code failed.)`);

Expand Down

0 comments on commit 18303be

Please sign in to comment.