homebridge-melcloud-control 3.6.4 → 3.6.6
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/README.md +2 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/src/deviceata.js +72 -72
- package/src/deviceatw.js +72 -71
- package/src/deviceerv.js +72 -0
package/README.md
CHANGED
|
@@ -297,7 +297,8 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
|
|
|
297
297
|
### RESTful Integration
|
|
298
298
|
|
|
299
299
|
* Port: last 4 numbers of `device Id`, displayed in HB log during start.
|
|
300
|
-
* POST data as a JSON Object `{OperationMode: 8}
|
|
300
|
+
* POST data as a JSON Object `{OperationMode: 8}`.
|
|
301
|
+
* Header content type must be `application/json`.
|
|
301
302
|
|
|
302
303
|
| Method | URL | Path | Response | Type |
|
|
303
304
|
| --- | --- | --- | --- | --- |
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "3.6.
|
|
4
|
+
"version": "3.6.6",
|
|
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
|
@@ -99,6 +99,78 @@ class DeviceAta extends EventEmitter {
|
|
|
99
99
|
this.accessory.temperatureUnit = TemperatureDisplayUnits[this.accessory.useFahrenheit];
|
|
100
100
|
};
|
|
101
101
|
|
|
102
|
+
async externalIntegrations() {
|
|
103
|
+
try {
|
|
104
|
+
//RESTFul server
|
|
105
|
+
const restFulEnabled = this.restFul.enable || false;
|
|
106
|
+
if (restFulEnabled) {
|
|
107
|
+
if (!this.restFulConnected) {
|
|
108
|
+
this.restFul1 = new RestFul({
|
|
109
|
+
port: this.deviceId.slice(-4),
|
|
110
|
+
debug: this.restFul.debug || false
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
this.restFul1.on('connected', (message) => {
|
|
114
|
+
this.restFulConnected = true;
|
|
115
|
+
this.emit('success', message);
|
|
116
|
+
})
|
|
117
|
+
.on('set', async (key, value) => {
|
|
118
|
+
try {
|
|
119
|
+
await this.setOverExternalIntegration('RESTFul', this.deviceData, key, value);
|
|
120
|
+
} catch (error) {
|
|
121
|
+
this.emit('warn', error);
|
|
122
|
+
};
|
|
123
|
+
})
|
|
124
|
+
.on('debug', (debug) => {
|
|
125
|
+
this.emit('debug', debug);
|
|
126
|
+
})
|
|
127
|
+
.on('error', (error) => {
|
|
128
|
+
this.emit('warn', error);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
//MQTT client
|
|
134
|
+
const mqttEnabled = this.mqtt.enable || false;
|
|
135
|
+
if (mqttEnabled) {
|
|
136
|
+
if (!this.mqttConnected) {
|
|
137
|
+
this.mqtt1 = new Mqtt({
|
|
138
|
+
host: this.mqtt.host,
|
|
139
|
+
port: this.mqtt.port || 1883,
|
|
140
|
+
clientId: `${this.mqtt.clientId}_${this.deviceId}` || `${this.deviceTypeText}_${this.deviceName}_${this.deviceId}`,
|
|
141
|
+
prefix: `${this.mqtt.prefix}/${this.deviceTypeText}/${this.deviceName}`,
|
|
142
|
+
user: this.mqtt.user,
|
|
143
|
+
passwd: this.mqtt.pass,
|
|
144
|
+
debug: this.mqtt.debug || false
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
this.mqtt1.on('connected', (message) => {
|
|
148
|
+
this.mqttConnected = true;
|
|
149
|
+
this.emit('success', message);
|
|
150
|
+
})
|
|
151
|
+
.on('subscribed', (message) => {
|
|
152
|
+
this.emit('success', message);
|
|
153
|
+
})
|
|
154
|
+
.on('set', async (key, value) => {
|
|
155
|
+
try {
|
|
156
|
+
await this.setOverExternalIntegration('MQTT', this.deviceData, key, value);
|
|
157
|
+
} catch (error) {
|
|
158
|
+
this.emit('warn', error);
|
|
159
|
+
};
|
|
160
|
+
})
|
|
161
|
+
.on('debug', (debug) => {
|
|
162
|
+
this.emit('debug', debug);
|
|
163
|
+
})
|
|
164
|
+
.on('error', (error) => {
|
|
165
|
+
this.emit('warn', error);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
} catch (error) {
|
|
170
|
+
this.emit('warn', `External integration start error: ${error}`);
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
102
174
|
async setOverExternalIntegration(integration, deviceData, key, value) {
|
|
103
175
|
try {
|
|
104
176
|
let set = false
|
|
@@ -178,78 +250,6 @@ class DeviceAta extends EventEmitter {
|
|
|
178
250
|
};
|
|
179
251
|
}
|
|
180
252
|
|
|
181
|
-
async externalIntegrations() {
|
|
182
|
-
try {
|
|
183
|
-
//RESTFul server
|
|
184
|
-
const restFulEnabled = this.restFul.enable || false;
|
|
185
|
-
if (restFulEnabled) {
|
|
186
|
-
if (!this.restFulConnected) {
|
|
187
|
-
this.restFul1 = new RestFul({
|
|
188
|
-
port: this.deviceId.slice(-4),
|
|
189
|
-
debug: this.restFul.debug || false
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
this.restFul1.on('connected', (message) => {
|
|
193
|
-
this.restFulConnected = true;
|
|
194
|
-
this.emit('success', message);
|
|
195
|
-
})
|
|
196
|
-
.on('set', async (key, value) => {
|
|
197
|
-
try {
|
|
198
|
-
await this.setOverExternalIntegration('RESTFul', this.deviceData, key, value);
|
|
199
|
-
} catch (error) {
|
|
200
|
-
this.emit('warn', error);
|
|
201
|
-
};
|
|
202
|
-
})
|
|
203
|
-
.on('debug', (debug) => {
|
|
204
|
-
this.emit('debug', debug);
|
|
205
|
-
})
|
|
206
|
-
.on('error', (error) => {
|
|
207
|
-
this.emit('warn', error);
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
//MQTT client
|
|
213
|
-
const mqttEnabled = this.mqtt.enable || false;
|
|
214
|
-
if (mqttEnabled) {
|
|
215
|
-
if (!this.mqttConnected) {
|
|
216
|
-
this.mqtt1 = new Mqtt({
|
|
217
|
-
host: this.mqtt.host,
|
|
218
|
-
port: this.mqtt.port || 1883,
|
|
219
|
-
clientId: `${this.mqtt.clientId}_${this.deviceId}` || `${this.deviceTypeText}_${this.deviceName}_${this.deviceId}`,
|
|
220
|
-
prefix: `${this.mqtt.prefix}/${this.deviceTypeText}/${this.deviceName}`,
|
|
221
|
-
user: this.mqtt.user,
|
|
222
|
-
passwd: this.mqtt.pass,
|
|
223
|
-
debug: this.mqtt.debug || false
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
this.mqtt1.on('connected', (message) => {
|
|
227
|
-
this.mqttConnected = true;
|
|
228
|
-
this.emit('success', message);
|
|
229
|
-
})
|
|
230
|
-
.on('subscribed', (message) => {
|
|
231
|
-
this.emit('success', message);
|
|
232
|
-
})
|
|
233
|
-
.on('set', async (key, value) => {
|
|
234
|
-
try {
|
|
235
|
-
await this.setOverExternalIntegration('MQTT', this.deviceData, key, value);
|
|
236
|
-
} catch (error) {
|
|
237
|
-
this.emit('warn', error);
|
|
238
|
-
};
|
|
239
|
-
})
|
|
240
|
-
.on('debug', (debug) => {
|
|
241
|
-
this.emit('debug', debug);
|
|
242
|
-
})
|
|
243
|
-
.on('error', (error) => {
|
|
244
|
-
this.emit('warn', error);
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
} catch (error) {
|
|
249
|
-
this.emit('warn', `External integration start error: ${error}`);
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
|
|
253
253
|
async startImpulseGenerator() {
|
|
254
254
|
try {
|
|
255
255
|
//start impule generator
|
package/src/deviceatw.js
CHANGED
|
@@ -103,6 +103,78 @@ class DeviceAtw extends EventEmitter {
|
|
|
103
103
|
this.accessory.temperatureUnit = TemperatureDisplayUnits[this.accessory.useFahrenheit];
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
+
async externalIntegrations() {
|
|
107
|
+
try {
|
|
108
|
+
//RESTFul server
|
|
109
|
+
const restFulEnabled = this.restFul.enable || false;
|
|
110
|
+
if (restFulEnabled) {
|
|
111
|
+
if (!this.restFulConnected) {
|
|
112
|
+
this.restFul1 = new RestFul({
|
|
113
|
+
port: this.deviceId.slice(-4),
|
|
114
|
+
debug: this.restFul.debug || false
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
this.restFul1.on('connected', (message) => {
|
|
118
|
+
this.restFulConnected = true;
|
|
119
|
+
this.emit('success', message);
|
|
120
|
+
})
|
|
121
|
+
.on('set', async (key, value) => {
|
|
122
|
+
try {
|
|
123
|
+
await this.setOverExternalIntegration('RESTFul', this.deviceData, key, value);
|
|
124
|
+
} catch (error) {
|
|
125
|
+
this.emit('warn', error);
|
|
126
|
+
};
|
|
127
|
+
})
|
|
128
|
+
.on('debug', (debug) => {
|
|
129
|
+
this.emit('debug', debug);
|
|
130
|
+
})
|
|
131
|
+
.on('error', (error) => {
|
|
132
|
+
this.emit('warn', error);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
//MQTT client
|
|
138
|
+
const mqttEnabled = this.mqtt.enable || false;
|
|
139
|
+
if (mqttEnabled) {
|
|
140
|
+
if (!this.mqttConnected) {
|
|
141
|
+
this.mqtt1 = new Mqtt({
|
|
142
|
+
host: this.mqtt.host,
|
|
143
|
+
port: this.mqtt.port || 1883,
|
|
144
|
+
clientId: `${this.mqtt.clientId}_${this.deviceId}` || `${this.deviceTypeText}_${this.deviceName}_${this.deviceId}`,
|
|
145
|
+
prefix: `${this.mqtt.prefix}/${this.deviceTypeText}/${this.deviceName}`,
|
|
146
|
+
user: this.mqtt.user,
|
|
147
|
+
passwd: this.mqtt.pass,
|
|
148
|
+
debug: this.mqtt.debug || false
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
this.mqtt1.on('connected', (message) => {
|
|
152
|
+
this.mqttConnected = true;
|
|
153
|
+
this.emit('success', message);
|
|
154
|
+
})
|
|
155
|
+
.on('subscribed', (message) => {
|
|
156
|
+
this.emit('success', message);
|
|
157
|
+
})
|
|
158
|
+
.on('set', async (key, value) => {
|
|
159
|
+
try {
|
|
160
|
+
await this.setOverExternalIntegration('MQTT', this.deviceData, key, value);
|
|
161
|
+
} catch (error) {
|
|
162
|
+
this.emit('warn', error);
|
|
163
|
+
};
|
|
164
|
+
})
|
|
165
|
+
.on('debug', (debug) => {
|
|
166
|
+
this.emit('debug', debug);
|
|
167
|
+
})
|
|
168
|
+
.on('error', (error) => {
|
|
169
|
+
this.emit('warn', error);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
} catch (error) {
|
|
174
|
+
this.emit('warn', `External integration start error: ${error}`);
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
106
178
|
async setOverExternalIntegration(integration, deviceData, key, value) {
|
|
107
179
|
try {
|
|
108
180
|
let set = false
|
|
@@ -202,77 +274,6 @@ class DeviceAtw extends EventEmitter {
|
|
|
202
274
|
};
|
|
203
275
|
}
|
|
204
276
|
|
|
205
|
-
async externalIntegrations() {
|
|
206
|
-
try {
|
|
207
|
-
//RESTFul server
|
|
208
|
-
const restFulEnabled = this.restFul.enable || false;
|
|
209
|
-
if (restFulEnabled) {
|
|
210
|
-
if (!this.restFulConnected) {
|
|
211
|
-
this.restFul1 = new RestFul({
|
|
212
|
-
port: this.deviceId.slice(-4),
|
|
213
|
-
debug: this.restFul.debug || false
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
this.restFul1.on('connected', (message) => {
|
|
217
|
-
this.restFulConnected = true;
|
|
218
|
-
this.emit('success', message);
|
|
219
|
-
})
|
|
220
|
-
.on('set', async (key, value) => {
|
|
221
|
-
try {
|
|
222
|
-
await this.setOverExternalIntegration('RESTFul', this.deviceData, key, value);
|
|
223
|
-
} catch (error) {
|
|
224
|
-
this.emit('warn', error);
|
|
225
|
-
};
|
|
226
|
-
})
|
|
227
|
-
.on('debug', (debug) => {
|
|
228
|
-
this.emit('debug', debug);
|
|
229
|
-
})
|
|
230
|
-
.on('error', (error) => {
|
|
231
|
-
this.emit('warn', error);
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
//MQTT client
|
|
237
|
-
const mqttEnabled = this.mqtt.enable || false;
|
|
238
|
-
if (mqttEnabled) {
|
|
239
|
-
if (!this.mqttConnected) {
|
|
240
|
-
this.mqtt1 = new Mqtt({
|
|
241
|
-
host: this.mqtt.host,
|
|
242
|
-
port: this.mqtt.port || 1883,
|
|
243
|
-
clientId: `${this.mqtt.clientId}_${this.deviceId}` || `${this.deviceTypeText}_${this.deviceName}_${this.deviceId}`,
|
|
244
|
-
prefix: `${this.mqtt.prefix}/${this.deviceTypeText}/${this.deviceName}`,
|
|
245
|
-
user: this.mqtt.user,
|
|
246
|
-
passwd: this.mqtt.pass,
|
|
247
|
-
debug: this.mqtt.debug || false
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
this.mqtt1.on('connected', (message) => {
|
|
251
|
-
this.mqttConnected = true;
|
|
252
|
-
this.emit('success', message);
|
|
253
|
-
})
|
|
254
|
-
.on('subscribed', (message) => {
|
|
255
|
-
this.emit('success', message);
|
|
256
|
-
})
|
|
257
|
-
.on('set', async (key, value) => {
|
|
258
|
-
try {
|
|
259
|
-
await this.setOverExternalIntegration('MQTT', this.deviceData, key, value);
|
|
260
|
-
} catch (error) {
|
|
261
|
-
this.emit('warn', error);
|
|
262
|
-
};
|
|
263
|
-
})
|
|
264
|
-
.on('debug', (debug) => {
|
|
265
|
-
this.emit('debug', debug);
|
|
266
|
-
})
|
|
267
|
-
.on('error', (error) => {
|
|
268
|
-
this.emit('warn', error);
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
} catch (error) {
|
|
273
|
-
this.emit('warn', `External integration start error: ${error}`);
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
277
|
|
|
277
278
|
async startImpulseGenerator() {
|
|
278
279
|
try {
|
package/src/deviceerv.js
CHANGED
|
@@ -97,6 +97,78 @@ class DeviceErv extends EventEmitter {
|
|
|
97
97
|
this.accessory.temperatureUnit = TemperatureDisplayUnits[this.accessory.useFahrenheit];
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
+
async externalIntegrations() {
|
|
101
|
+
try {
|
|
102
|
+
//RESTFul server
|
|
103
|
+
const restFulEnabled = this.restFul.enable || false;
|
|
104
|
+
if (restFulEnabled) {
|
|
105
|
+
if (!this.restFulConnected) {
|
|
106
|
+
this.restFul1 = new RestFul({
|
|
107
|
+
port: this.deviceId.slice(-4),
|
|
108
|
+
debug: this.restFul.debug || false
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
this.restFul1.on('connected', (message) => {
|
|
112
|
+
this.restFulConnected = true;
|
|
113
|
+
this.emit('success', message);
|
|
114
|
+
})
|
|
115
|
+
.on('set', async (key, value) => {
|
|
116
|
+
try {
|
|
117
|
+
await this.setOverExternalIntegration('RESTFul', this.deviceData, key, value);
|
|
118
|
+
} catch (error) {
|
|
119
|
+
this.emit('warn', error);
|
|
120
|
+
};
|
|
121
|
+
})
|
|
122
|
+
.on('debug', (debug) => {
|
|
123
|
+
this.emit('debug', debug);
|
|
124
|
+
})
|
|
125
|
+
.on('error', (error) => {
|
|
126
|
+
this.emit('warn', error);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
//MQTT client
|
|
132
|
+
const mqttEnabled = this.mqtt.enable || false;
|
|
133
|
+
if (mqttEnabled) {
|
|
134
|
+
if (!this.mqttConnected) {
|
|
135
|
+
this.mqtt1 = new Mqtt({
|
|
136
|
+
host: this.mqtt.host,
|
|
137
|
+
port: this.mqtt.port || 1883,
|
|
138
|
+
clientId: `${this.mqtt.clientId}_${this.deviceId}` || `${this.deviceTypeText}_${this.deviceName}_${this.deviceId}`,
|
|
139
|
+
prefix: `${this.mqtt.prefix}/${this.deviceTypeText}/${this.deviceName}`,
|
|
140
|
+
user: this.mqtt.user,
|
|
141
|
+
passwd: this.mqtt.pass,
|
|
142
|
+
debug: this.mqtt.debug || false
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
this.mqtt1.on('connected', (message) => {
|
|
146
|
+
this.mqttConnected = true;
|
|
147
|
+
this.emit('success', message);
|
|
148
|
+
})
|
|
149
|
+
.on('subscribed', (message) => {
|
|
150
|
+
this.emit('success', message);
|
|
151
|
+
})
|
|
152
|
+
.on('set', async (key, value) => {
|
|
153
|
+
try {
|
|
154
|
+
await this.setOverExternalIntegration('MQTT', this.deviceData, key, value);
|
|
155
|
+
} catch (error) {
|
|
156
|
+
this.emit('warn', error);
|
|
157
|
+
};
|
|
158
|
+
})
|
|
159
|
+
.on('debug', (debug) => {
|
|
160
|
+
this.emit('debug', debug);
|
|
161
|
+
})
|
|
162
|
+
.on('error', (error) => {
|
|
163
|
+
this.emit('warn', error);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
} catch (error) {
|
|
168
|
+
this.emit('warn', `External integration start error: ${error}`);
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
100
172
|
async setOverExternalIntegration(integration, deviceData, key, value) {
|
|
101
173
|
try {
|
|
102
174
|
let set = false
|