homebridge-melcloud-control 4.3.4-beta.0 → 4.3.4-beta.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.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/index.js +25 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -129,6 +129,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
129
129
  * Operating mode `HEAT/COOL/CURVE/HOLIDAY/AUTO HOT WATER/ECO HOT WATER/FORCE HOT WATER`.
130
130
  * Physical lock controls `LOCK/UNLOCK`.
131
131
  * Presets `SET/UNSET`.
132
+ * Frost protection `ON/OFF`.
132
133
  * Holiday mode `ON/OFF`.
133
134
  * Schedules `ON/OFF`.
134
135
  * Scene `ON/OFF`.
@@ -144,6 +145,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
144
145
  * Water tank temperature.
145
146
  * Flow Temperature Zone 1, 2, Hot Water.
146
147
  * Return Temperature Zone 1, 2, Hot Water.
148
+ * Frost protection.
147
149
  * Holiday mode.
148
150
  * Shedules control.
149
151
  * Shedule active.
package/index.js CHANGED
@@ -85,8 +85,22 @@ class MelCloudPlatform {
85
85
  .on('start', async () => {
86
86
  try {
87
87
  //melcloud account
88
- const melCloud = account.type === 'melcloud' ? new MelCloud(account, accountFile, buildingsFile, devicesFile, true) : new MelCloudHome(account, accountFile, buildingsFile, devicesFile, true)
89
- .on('success', (msg) => log.success(`${accountName}, ${msg}`))
88
+ let configureAccount;
89
+ let timmers = []
90
+ switch (account.type) {
91
+ case 'melcloud':
92
+ timmers = [{ name: 'checkDevicesList', sampling: refreshInterval }];
93
+ configureAccount = new MelCloud(account, accountFile, buildingsFile, devicesFile, true);
94
+ break;
95
+ case 'melcloudhome':
96
+ timmers = [{ name: 'connect', sampling: 3300000 }, { name: 'checkDevicesList', sampling: 3000 }];
97
+ configureAccount = new MelCloudHome(account, accountFile, buildingsFile, devicesFile, true);
98
+ break;
99
+ default:
100
+ if (logLevel.warn) log.warn(`Unknown account type: ${account.type}.`);
101
+ return;
102
+ }
103
+ configureAccount.on('success', (msg) => log.success(`${accountName}, ${msg}`))
90
104
  .on('info', (msg) => log.info(`${accountName}, ${msg}`))
91
105
  .on('debug', (msg) => log.info(`${accountName}, debug: ${msg}`))
92
106
  .on('warn', (msg) => log.warn(`${accountName}, ${msg}`))
@@ -95,7 +109,7 @@ class MelCloudPlatform {
95
109
  //connect
96
110
  let accountInfo;
97
111
  try {
98
- accountInfo = await melCloud.connect();
112
+ accountInfo = await configureAccount.connect();
99
113
  } catch (error) {
100
114
  if (logLevel.error) log.error(`${accountName}, Connect error: ${error.message ?? error}`);
101
115
  return;
@@ -110,7 +124,7 @@ class MelCloudPlatform {
110
124
  //check devices list
111
125
  let devicesList;
112
126
  try {
113
- devicesList = await melCloud.checkDevicesList();
127
+ devicesList = await configureAccount.checkDevicesList();
114
128
  } catch (error) {
115
129
  if (logLevel.error) log.error(`${accountName}, Check devices list error: ${error.message ?? error}`);
116
130
  return;
@@ -192,15 +206,16 @@ class MelCloudPlatform {
192
206
  api.publishExternalAccessories(PluginName, [accessory]);
193
207
  if (logLevel.success) log.success(`${accountName}, ${deviceTypeString}, ${deviceName}, Published as external accessory.`);
194
208
 
195
- //start impulse generators\
209
+ //start impulse generators for device
196
210
  await configuredDevice.startStopImpulseGenerator(true, [{ name: 'checkState', sampling: deviceRefreshInterval }]);
197
- const timmers = accountType === 'melcloudhome' ? [{ name: 'connect', sampling: 3300000 }, { name: 'checkDevicesList', sampling: 3000 }] : [{ name: 'checkDevicesList', sampling: refreshInterval }];
198
- await melCloud.impulseGenerator.state(true, timmers, false);
199
-
200
- //stop impulse generator
201
- await impulseGenerator.state(false);
202
211
  }
203
212
  }
213
+
214
+ //start melcloud impulse generator
215
+ await configureAccount.impulseGenerator.state(true, timmers, false);
216
+
217
+ //stop start impulse generator
218
+ await impulseGenerator.state(false);
204
219
  } catch (error) {
205
220
  if (logLevel.error) log.error(`${accountName}, Start impulse generator error, ${error.message ?? error}, trying again.`);
206
221
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.3.4-beta.0",
4
+ "version": "4.3.4-beta.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",