Skip to content

Commit

Permalink
Additional debug infomation
Browse files Browse the repository at this point in the history
  • Loading branch information
lprhodes committed Mar 28, 2018
1 parent a39d16b commit 427f4a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
12 changes: 9 additions & 3 deletions accessories/aircon.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,12 +563,18 @@ class AirConAccessory extends BroadlinkRMAccessory {
onMQTTMessage (identifier, message) {
const { debug, log, name } = this;

super.onMQTTMessage(identifier, message);
if (identifier !== 'unknown' && identifier !== 'temperature') {
log(`\x1b[31m[ERROR] \x1b[0m${name} onMQTTMessage (mqtt message received with unexpected identifier: ${identifier}, ${message.toString()})`);

return;
}

if (identifier !== 'unknown' && identifier !== 'temperature') return;
super.onMQTTMessage(identifier, message);

let temperature = this.mqttValues[identifier];

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

try {
const temperatureJSON = JSON.parse(temperature);

Expand All @@ -583,7 +589,7 @@ class AirConAccessory extends BroadlinkRMAccessory {
return;
}

if (debug) log(`\x1b[33m[DEBUG]\x1b[0m ${name} onMQTTMessage (raw value: ${temperature.trim()})`);
if (debug) log(`\x1b[33m[DEBUG]\x1b[0m ${name} onMQTTMessage (raw value 2: ${temperature.trim()})`);

temperature = parseFloat(temperature);

Expand Down
7 changes: 4 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1725,10 +1725,11 @@ home-or-tmp@^2.0.0:
os-homedir "^1.0.0"
os-tmpdir "^1.0.1"

homebridge-platform-helper@1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/homebridge-platform-helper/-/homebridge-platform-helper-1.0.8.tgz#42aa99d1d7a9e613614115a1855fde48ff320dcf"
homebridge-platform-helper@1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/homebridge-platform-helper/-/homebridge-platform-helper-1.1.0.tgz#ad2d4a93468adf9b0cdb5e4328c055219f5b686f"
dependencies:
mqtt "^2.17.0"
node-persist "^2.0.10"
semver "^5.3.0"
uuid "^3.2.1"
Expand Down

0 comments on commit 427f4a8

Please sign in to comment.