homebridge-melcloud-control 3.8.5-beta.4 → 3.8.5

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/CHANGELOG.md CHANGED
@@ -16,6 +16,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
16
16
  - do not configure it manually, always using Config UI X
17
17
  - required Homebridge v2.0.0 and above
18
18
 
19
+ ## [3.8.5] - (24.05.2025)
20
+
21
+ ## Changes
22
+
23
+ - fix [#199](https://github.com/grzegorz914/homebridge-melcloud-control/issues/199)
24
+ - cleanup
25
+
19
26
  ## [3.8.3] - (20.05.2025)
20
27
 
21
28
  ## Changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "3.8.5-beta.4",
4
+ "version": "3.8.5",
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/deviceata.js CHANGED
@@ -1396,8 +1396,8 @@ class DeviceAta extends EventEmitter {
1396
1396
  .on('restFul', (path, data) => {
1397
1397
  const restFul = this.restFulConnected ? this.restFul1.update(path, data) : false;
1398
1398
  })
1399
- .on('mqtt', async (topic, message) => {
1400
- const mqtt = this.mqttConnected ? await this.mqtt1.publish(topic, message) : false;
1399
+ .on('mqtt', (topic, message) => {
1400
+ const mqtt = this.mqttConnected ? this.mqtt1.emit('publish', topic, message) : false;
1401
1401
  });
1402
1402
 
1403
1403
  //start external integrations
@@ -397,14 +397,6 @@ class MelCloudAtw extends EventEmitter {
397
397
  ProhibitHotWater: prohibitHotWater
398
398
  }
399
399
 
400
- //check state changes
401
- const deviceDataHasNotChanged = JSON.stringify(deviceState) === JSON.stringify(this.deviceState);
402
- if (deviceDataHasNotChanged) {
403
- const debug = this.enableDebugMode ? this.emit('debug', `Device state not changed`) : false;
404
- return;
405
- }
406
- this.deviceState = deviceState;
407
-
408
400
  //restFul
409
401
  this.emit('restFul', 'info', deviceData);
410
402
  this.emit('restFul', 'state', deviceData.Device);
@@ -413,6 +405,14 @@ class MelCloudAtw extends EventEmitter {
413
405
  this.emit('mqtt', 'Info', deviceData);
414
406
  this.emit('mqtt', 'State', deviceData.Device);
415
407
 
408
+ //check state changes
409
+ const deviceDataHasNotChanged = JSON.stringify(deviceState) === JSON.stringify(this.deviceState);
410
+ if (deviceDataHasNotChanged) {
411
+ const debug = this.enableDebugMode ? this.emit('debug', `Device state not changed`) : false;
412
+ return;
413
+ }
414
+ this.deviceState = deviceState;
415
+
416
416
  //emit info
417
417
  this.emit('deviceInfo', manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion, hasHotWaterTank, hasZone2);
418
418
 
@@ -321,14 +321,6 @@ class MelCloudErv extends EventEmitter {
321
321
  HideOutdoorTemperature: hideOutdoorTemperature
322
322
  }
323
323
 
324
- //check state changes
325
- const deviceDataHasNotChanged = JSON.stringify(deviceState) === JSON.stringify(this.deviceState);
326
- if (deviceDataHasNotChanged) {
327
- const debug = this.enableDebugMode ? this.emit('debug', `Device state not changed`) : false;
328
- return;
329
- }
330
- this.deviceState = deviceState;
331
-
332
324
  //restFul
333
325
  this.emit('restFul', 'info', deviceData);
334
326
  this.emit('restFul', 'state', deviceData.Device);
@@ -337,6 +329,14 @@ class MelCloudErv extends EventEmitter {
337
329
  this.emit('mqtt', 'Info', deviceData);
338
330
  this.emit('mqtt', 'State', deviceData.Device);
339
331
 
332
+ //check state changes
333
+ const deviceDataHasNotChanged = JSON.stringify(deviceState) === JSON.stringify(this.deviceState);
334
+ if (deviceDataHasNotChanged) {
335
+ const debug = this.enableDebugMode ? this.emit('debug', `Device state not changed`) : false;
336
+ return;
337
+ }
338
+ this.deviceState = deviceState;
339
+
340
340
  //emit info
341
341
  this.emit('deviceInfo', manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion);
342
342
 
package/src/mqtt.js CHANGED
@@ -12,7 +12,6 @@ class Mqtt extends EventEmitter {
12
12
  }
13
13
  const url = `mqtt://${config.host}:${config.port}`;
14
14
  const subscribeTopic = `${config.prefix}/Set`;
15
- this.topic = config.prefix;
16
15
 
17
16
  this.on('connect', async () => {
18
17
  try {
@@ -52,17 +51,5 @@ class Mqtt extends EventEmitter {
52
51
 
53
52
  this.emit('connect');
54
53
  };
55
-
56
- async publish(topic, message) {
57
- try {
58
- const fullTopic = `${this.topic}/${topic}`;
59
- const publishMessage = JSON.stringify(message, null, 2);
60
- await this.mqttClient.publish(fullTopic, publishMessage);
61
- const emitDebug = config.debug ? this.emit('debug', `MQTT Publish topic: ${fullTopic}, message: ${publishMessage}`) : false;
62
- return;
63
- } catch (error) {
64
- this.emit('warn', `MQTT Publish error: ${error}`);
65
- };
66
- }
67
54
  };
68
55
  export default Mqtt;