homebridge-melcloud-control 4.2.8 → 4.3.0-beta.0

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
@@ -26,7 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
26
26
 
27
27
  ## Changes
28
28
 
29
- - added option to set only switch for presets, scenses, schedules or buttons
29
+ - added option to set only switch for presets, scenes, schedules or buttons
30
30
  - readme updated
31
31
  - cleanup
32
32
 
package/README.md CHANGED
@@ -238,13 +238,13 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
238
238
  | `user` | Here set the account username. |
239
239
  | `passwd` | Here set the account password. |
240
240
  | `language` | Here select the account language. |
241
- | `type` | Here select the account type `None/Disabled`, `MELCloud`, `MELCloud Home`. |
241
+ | `type` | Here select the account type `0 - None/Disabled`, `1 - MELCloud`, `2 - MELCloud Home`. |
242
242
  | `ataDevices[]` | Array of ATA devices created automatically after login to MELCloud from plugin config UI. |
243
243
  | `ataDevices[].id` | Read only data, do not change it. |
244
244
  | `ataDevices[].type` | Read only data, do not change it. |
245
245
  | `ataDevices[].typeString` | Read only data, do not change it. |
246
246
  | `ataDevices[].name` | Here You can change the `Accessory Name` which is exposed to the `Homebridge/HomeKit`. |
247
- | `ataDevices[].displayType` | Here select device control mode `None/Disabled`, `Heater/Cooler`, `Thermostat`. |
247
+ | `ataDevices[].displayType` | Here select device control mode `0 - None/Disabled`, `1 - Heater/Cooler`, `2 - Thermostat`. |
248
248
  | `ataDevices[].heatDryFanMode` | Here select the operatiing mode for `Heat`, if this mode is not supported, it will be disabled. |
249
249
  | `ataDevices[].coolDryFanMode` | Here select the operatiing mode for `Cool`, if this mode is not supported, it will be disabled. |
250
250
  | `ataDevices[].autoDryFanMode` | Here select the operatiing mode for `Auto`, if this mode is not supported, it will be disabled.. |
@@ -260,18 +260,18 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
260
260
  | `ataDevices[].presets[]` | Array of ATA device `Presets` created automatically after login to MELCloud from plugin config UI. |
261
261
  | `ataDevices[].presets[].id` | Read only data, do not change it. |
262
262
  | `ataDevices[].presets[].name` | Here You can change the `Preset Name` which is exposed to the `Homebridge/HomeKit`. |
263
- | `ataDevices[].presets[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch +Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
263
+ | `ataDevices[].presets[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch + Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
264
264
  | `ataDevices[].schedules[]` | Array of ATA device `Schedules` created automatically after login to MELCloud Home from plugin config UI. |
265
265
  | `ataDevices[].schedules[].id` | Read only data, do not change it. |
266
266
  | `ataDevices[].schedules[].name` | Here You can change the `Schedule Name` which is exposed to the `Homebridge/HomeKit`. |
267
- | `ataDevices[].schedules[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch +Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
267
+ | `ataDevices[].schedules[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch + Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
268
268
  | `ataDevices[].scenes[].id` | Read only data, do not change it. |
269
269
  | `ataDevices[].scenes[].name` | Here You can change the `Scene Name` which is exposed to the `Homebridge/HomeKit`. |
270
- | `ataDevices[].scenes[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch +Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
270
+ | `ataDevices[].scenes[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch + Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
271
271
  | `ataDevices[].buttonsSensors[]` | Array of buttons sensors. |
272
272
  | `ataDevices[].buttonsSensors[].name` | Here set `Button Name` which You want expose to the `Homebridge/HomeKit`. |
273
273
  | `ataDevices[].buttonsSensors[].mode` | Here select button mode, VH - Vane Horizontal, VV - Vane Horizontal. |
274
- | `ataDevices[].buttonsSensors[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch +Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
274
+ | `ataDevices[].buttonsSensors[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch + Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
275
275
  | `ataDevices[].buttonsSensors[].namePrefix` | Here enable/disable the accessory name as a prefix for button/sensor name. |
276
276
  | `atwDevices[]` | Array of ATA devices created automatically after login to MELCloud from plugin config UI. |
277
277
  | `atwDevices[].id` | Read only data, do not change it. |
@@ -297,18 +297,18 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
297
297
  | `atwDevices[].presets[]` | Array of ATW device `Presets` created automatically after login to MELCloud from plugin config UI. |
298
298
  | `atwDevices[].presets[].id` | Read only data, do not change it. |
299
299
  | `atwDevices[].presets[].name` | Here You can change the `Preset Name` which is exposed to the `Homebridge/HomeKit`. |
300
- | `atwDevices[].presets[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch +Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
300
+ | `atwDevices[].presets[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch + Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
301
301
  | `atwDevices[].schedules[]` | Array of ATW device `Schedules` created automatically after login to MELCloud Home from plugin config UI. |
302
302
  | `atwDevices[].schedules[].id` | Read only data, do not change it. |
303
303
  | `atwDevices[].schedules[].name` | Here You can change the `Schedule Name` which is exposed to the `Homebridge/HomeKit`. |
304
- | `atwDevices[].schedules[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch +Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
304
+ | `atwDevices[].schedules[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch + Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
305
305
  | `atwDevices[].scenes[].id` | Read only data, do not change it. |
306
306
  | `atwDevices[].scenes[].name` | Here You can change the `Scene Name` which is exposed to the `Homebridge/HomeKit`. |
307
- | `atwDevices[].scenes[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch +Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
307
+ | `atwDevices[].scenes[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch + Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
308
308
  | `atwDevices[].buttonsSensors[]` | Array of buttons sensors. |
309
309
  | `atwDevices[].buttonsSensors[].name` | Here set `Button Name` which You want expose to the `Homebridge/HomeKit`. |
310
310
  | `atwDevices[].buttonsSensors[].mode` | Here select button mode. |
311
- | `atwDevices[].buttonsSensors[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch +Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
311
+ | `atwDevices[].buttonsSensors[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch + Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
312
312
  | `atwDevices[].buttonsSensors[].namePrefix` | Here enable/disable the accessory name as a prefix for button/sensor name. |
313
313
  | `ervDevices[]` | Array of ATA devices created automatically after login to MELCloud from plugin config UI. |
314
314
  | `ervDevices[].id` | Read only data, do not change it. |
@@ -327,18 +327,18 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
327
327
  | `ervDevices[].presets[]` | Array of ERV device `Presets` created automatically after login to MELCloud from plugin config UI. |
328
328
  | `ervDevices[].presets[].id` | Read only data, do not change it. |
329
329
  | `ervDevices[].presets[].name` | Here You can change the `Preset Name` which is exposed to the `Homebridge/HomeKit`. |
330
- | `ervDevices[].presets[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch +Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
330
+ | `ervDevices[].presets[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch + Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
331
331
  | `ervDevices[].schedules[]` | Array of ERV device `Schedules` created automatically after login to MELCloud Home from plugin config UI. |
332
332
  | `ervDevices[].schedules[].id` | Read only data, do not change it. |
333
333
  | `ervDevices[].schedules[].name` | Here You can change the `Schedule Name` which is exposed to the `Homebridge/HomeKit`. |
334
- | `ervDevices[].schedules[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch +Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
334
+ | `ervDevices[].schedules[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch + Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
335
335
  | `ervDevices[].scenes[].id` | Read only data, do not change it. |
336
336
  | `ervDevices[].scenes[].name` | Here You can change the `Scene Name` which is exposed to the `Homebridge/HomeKit`. |
337
- | `ervDevices[].scenes[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch +Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
337
+ | `ervDevices[].scenes[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch + Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
338
338
  | `ervDevices[].buttonsSensors[]` | Array of buttons sensors. |
339
339
  | `ervDevices[].buttonsSensors[].name` | Here set `Button Name` which You want expose to the `Homebridge/HomeKit`. |
340
340
  | `ervDevices[].buttonsSensors[].mode` | Here select button mode. |
341
- | `ervDevices[].buttonsSensors[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch +Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
341
+ | `ervDevices[].buttonsSensors[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch + Occupancy Sensor`, `6 - Switch + Contact Sensor`, `7 - Switch`. |
342
342
  | `ervDevices[].buttonsSensors[].namePrefix` | Here enable/disable the accessory name as a prefix for button/sensor name. |
343
343
  | `refreshInterval` | Here set the background account data refresh time in (sec) , only for old MELCLoud, default `120s`. |
344
344
  | `log{}` | Log object. |
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.2.8",
4
+ "version": "4.3.0-beta.0",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -39,7 +39,8 @@
39
39
  "async-mqtt": "^2.6.3",
40
40
  "axios": "^1.13.2",
41
41
  "express": "^5.1.0",
42
- "puppeteer": "^24.30.0"
42
+ "puppeteer": "^24.30.0",
43
+ "ws": "^8.18.3"
43
44
  },
44
45
  "keywords": [
45
46
  "homebridge",
package/src/deviceata.js CHANGED
@@ -1082,7 +1082,7 @@ class DeviceAta extends EventEmitter {
1082
1082
  const buttonControlService = new serviceType(serviceName, `buttonControlService${deviceId} ${i}`);
1083
1083
  buttonControlService.addOptionalCharacteristic(Characteristic.ConfiguredName);
1084
1084
  buttonControlService.setCharacteristic(Characteristic.ConfiguredName, serviceName);
1085
- buttonControlService.getCharacteristic(Characteristic, On)
1085
+ buttonControlService.getCharacteristic(Characteristic.On)
1086
1086
  .onGet(async () => {
1087
1087
  const state = button.state;
1088
1088
  return state;
@@ -1,3 +1,4 @@
1
+ import WebSocket from 'ws';
1
2
  import axios from 'axios';
2
3
  import EventEmitter from 'events';
3
4
  import ImpulseGenerator from './impulsegenerator.js';
@@ -25,6 +26,7 @@ class MelCloudAta extends EventEmitter {
25
26
  //set default values
26
27
  this.deviceData = {};
27
28
  this.headers = {};
29
+ this.start = true;
28
30
 
29
31
  //lock flag
30
32
  this.locks = false;
@@ -52,6 +54,7 @@ class MelCloudAta extends EventEmitter {
52
54
 
53
55
  async checkState() {
54
56
  try {
57
+
55
58
  //read device info from file
56
59
  const devicesData = await this.functions.readData(this.devicesFile, true);
57
60
  if (!devicesData) return;
@@ -73,6 +76,33 @@ class MelCloudAta extends EventEmitter {
73
76
  }
74
77
  if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`);
75
78
 
79
+ if (this.start) {
80
+ const hash = '2db32d6f-c19c-4b1f-a0dd-1915420a5152';
81
+
82
+ const ws = new WebSocket(`wss://ws.melcloudhome.com/?hash=${hash}`, {
83
+ headers: {
84
+ 'Origin': 'https://melcloudhome.com',
85
+ 'User-Agent': this.headers['User-Agent'],
86
+ 'Pragma': 'no-cache',
87
+ 'Cache-Control': 'no-cache'
88
+ }
89
+ });
90
+ ws.on('open', () => {
91
+ if (!this.logDebug) this.emit('warn', `Connected to MelCloudHome WebSocket`);
92
+ this.start = false;
93
+ })
94
+ .on('message', (data) => {
95
+ if (!this.logDebug) this.emit('warn', `Incoming message:', data.toString()`);
96
+ })
97
+ .on('close', () => {
98
+ if (!this.logDebug) this.emit('warn', `Connection closed`);
99
+ })
100
+ .on('error', (error) => {
101
+ if (!this.logDebug) this.emit('warn', `Connected error: ${error}`);
102
+ });
103
+ }
104
+
105
+
76
106
  //device
77
107
  const serialNumber = deviceData.SerialNumber || '4.0.0';
78
108
  const firmwareAppVersion = deviceData.Device?.FirmwareAppVersion || '4.0.0';