homebridge-melcloud-control 3.9.2-beta.1 → 3.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "3.9.2-beta.1",
4
+ "version": "3.9.2",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/mqtt.js CHANGED
@@ -27,7 +27,7 @@ class Mqtt extends EventEmitter {
27
27
  this.mqttClient.on('message', (topic, message) => {
28
28
  try {
29
29
  const obj = JSON.parse(message.toString());
30
- const emitDebug = config.debug ? this.emit('debug', `MQTT Received topic: ${topic}, message: ${JSON.stringify(obj, null, 2)}`) : false;
30
+ if (config.debug) this.emit('debug', `MQTT Received topic: ${topic}, message: ${JSON.stringify(obj, null, 2)}`);
31
31
  const key = Object.keys(obj)[0];
32
32
  const value = Object.values(obj)[0];
33
33
  this.emit('set', key, value);
@@ -43,7 +43,7 @@ class Mqtt extends EventEmitter {
43
43
  const fullTopic = `${config.prefix}/${topic}`;
44
44
  const publishMessage = JSON.stringify(message, null, 2);
45
45
  await this.mqttClient.publish(fullTopic, publishMessage);
46
- const emitDebug = config.debug ? this.emit('debug', `MQTT Publish topic: ${fullTopic}, message: ${publishMessage}`) : false;
46
+ if (config.debug) this.emit('debug', `MQTT Publish topic: ${fullTopic}, message: ${publishMessage}`);
47
47
  } catch (error) {
48
48
  this.emit('warn', `MQTT Publish error: ${error}`);
49
49
  };
package/src/restful.js CHANGED
@@ -53,9 +53,7 @@ class RestFul extends EventEmitter {
53
53
  this.emit('set', key, value);
54
54
  this.update(key, value);
55
55
 
56
- if (this.restFulDebug) {
57
- this.emit('debug', `RESTFul post data: ${JSON.stringify(obj, null, 2)}`);
58
- }
56
+ if (this.restFulDebug) this.emit('debug', `RESTFul post data: ${JSON.stringify(obj, null, 2)}`);
59
57
 
60
58
  res.json({ success: true, received: obj });
61
59
  } catch (error) {
@@ -81,9 +79,7 @@ class RestFul extends EventEmitter {
81
79
  return;
82
80
  }
83
81
 
84
- if (this.restFulDebug) {
85
- this.emit('debug', `RESTFul update path: ${path}, data: ${JSON.stringify(data)}`);
86
- }
82
+ if (this.restFulDebug) this.emit('debug', `RESTFul update path: ${path}, data: ${JSON.stringify(data)}`);
87
83
  }
88
84
  }
89
85