homebridge-melcloud-control 4.1.1-beta.2 → 4.1.1-beta.3
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 +1 -1
- package/src/melcloudatw.js +13 -36
- package/src/melclouderv.js +13 -33
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.1.1-beta.
|
|
4
|
+
"version": "4.1.1-beta.3",
|
|
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/melcloudatw.js
CHANGED
|
@@ -11,6 +11,8 @@ class MelCloudAtw extends EventEmitter {
|
|
|
11
11
|
this.logWarn = account.log?.warn;
|
|
12
12
|
this.logError = account.log?.error;
|
|
13
13
|
this.logDebug = account.log?.debug;
|
|
14
|
+
this.restFulEnabled = account.restFul?.enable;
|
|
15
|
+
this.mqttEnabled = account.mqtt?.enable;
|
|
14
16
|
this.deviceId = device.id;
|
|
15
17
|
this.devicesFile = devicesFile;
|
|
16
18
|
this.defaultTempsFile = defaultTempsFile;
|
|
@@ -20,7 +22,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
20
22
|
.on('debug', debug => this.emit('debug', debug));
|
|
21
23
|
|
|
22
24
|
//set default values
|
|
23
|
-
this.
|
|
25
|
+
this.devicesData = {};
|
|
24
26
|
this.headers = {};
|
|
25
27
|
|
|
26
28
|
//lock flags
|
|
@@ -130,50 +132,25 @@ class MelCloudAtw extends EventEmitter {
|
|
|
130
132
|
if (this.logDebug) this.emit('debug', `Units are not configured in MELCloud service`);
|
|
131
133
|
};
|
|
132
134
|
|
|
133
|
-
const deviceState = {
|
|
134
|
-
Power: power,
|
|
135
|
-
IdleZone1: idleZone1,
|
|
136
|
-
IdleZone2: idleZone2,
|
|
137
|
-
UnitStatus: unitStatus,
|
|
138
|
-
SetTemperatureZone1: setTemperatureZone1,
|
|
139
|
-
SetTemperatureZone2: setTemperatureZone2,
|
|
140
|
-
RoomTemperatureZone1: roomTemperatureZone1,
|
|
141
|
-
RoomTemperatureZone2: roomTemperatureZone2,
|
|
142
|
-
OperationMode: operationMode,
|
|
143
|
-
OperationModeZone1: operationModeZone1,
|
|
144
|
-
OperationModeZone2: operationModeZone2,
|
|
145
|
-
SetHeatFlowTemperatureZone1: setHeatFlowTemperatureZone1,
|
|
146
|
-
SetHeatFlowTemperatureZone2: setHeatFlowTemperatureZone2,
|
|
147
|
-
SetCoolFlowTemperatureZone1: setCoolFlowTemperatureZone1,
|
|
148
|
-
SetCoolFlowTemperatureZone2: setCoolFlowTemperatureZone2,
|
|
149
|
-
TankWaterTemperature: tankWaterTemperature,
|
|
150
|
-
SetTankWaterTemperature: setTankWaterTemperature,
|
|
151
|
-
ForcedHotWaterMode: forcedHotWaterMode,
|
|
152
|
-
OutdoorTemperature: outdoorTemperature,
|
|
153
|
-
TemperatureIncrement: temperatureIncrement,
|
|
154
|
-
EcoHotWater: ecoHotWater,
|
|
155
|
-
HolidayMode: holidayMode,
|
|
156
|
-
ProhibitZone1: prohibitHeatingZone1,
|
|
157
|
-
ProhibitZone2: prohibitHeatingZone2,
|
|
158
|
-
ProhibitHotWater: prohibitHotWater,
|
|
159
|
-
IsInError: isInError
|
|
160
|
-
}
|
|
161
|
-
|
|
162
135
|
//restFul
|
|
163
|
-
this.
|
|
164
|
-
|
|
136
|
+
if (this.restFulEnabled) {
|
|
137
|
+
this.emit('restFul', 'info', deviceData);
|
|
138
|
+
this.emit('restFul', 'state', deviceData.Device);
|
|
139
|
+
}
|
|
165
140
|
|
|
166
141
|
//mqtt
|
|
167
|
-
this.
|
|
168
|
-
|
|
142
|
+
if (this.mqttEnabled) {
|
|
143
|
+
this.emit('mqtt', 'Info', deviceData);
|
|
144
|
+
this.emit('mqtt', 'State', deviceData.Device);
|
|
145
|
+
}
|
|
169
146
|
|
|
170
147
|
//check state changes
|
|
171
|
-
const deviceDataHasNotChanged = JSON.stringify(
|
|
148
|
+
const deviceDataHasNotChanged = JSON.stringify(devicesData) === JSON.stringify(this.devicesData);
|
|
172
149
|
if (deviceDataHasNotChanged) {
|
|
173
150
|
if (this.logDebug) this.emit('debug', `Device state not changed`);
|
|
174
151
|
return;
|
|
175
152
|
}
|
|
176
|
-
this.
|
|
153
|
+
this.devicesData = devicesData;
|
|
177
154
|
|
|
178
155
|
//emit info
|
|
179
156
|
this.emit('deviceInfo', manufacturer, indoor.model, outdoor.model, serialNumber, firmwareAppVersion, hasHotWaterTank, hasZone2);
|
package/src/melclouderv.js
CHANGED
|
@@ -11,6 +11,8 @@ class MelCloudErv extends EventEmitter {
|
|
|
11
11
|
this.logWarn = account.log?.warn;
|
|
12
12
|
this.logError = account.log?.error;
|
|
13
13
|
this.logDebug = account.log?.debug;
|
|
14
|
+
this.restFulEnabled = account.restFul?.enable;
|
|
15
|
+
this.mqttEnabled = account.mqtt?.enable;
|
|
14
16
|
this.deviceId = device.id;
|
|
15
17
|
this.devicesFile = devicesFile;
|
|
16
18
|
this.defaultTempsFile = defaultTempsFile;
|
|
@@ -20,7 +22,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
20
22
|
.on('debug', debug => this.emit('debug', debug));
|
|
21
23
|
|
|
22
24
|
//set default values
|
|
23
|
-
this.
|
|
25
|
+
this.devicesData = {};
|
|
24
26
|
this.headers = {};
|
|
25
27
|
|
|
26
28
|
//lock flags
|
|
@@ -130,47 +132,25 @@ class MelCloudErv extends EventEmitter {
|
|
|
130
132
|
if (this.logDebug) this.emit('debug', `Units are not configured in MELCloud service`);
|
|
131
133
|
};
|
|
132
134
|
|
|
133
|
-
const deviceState = {
|
|
134
|
-
Power: power,
|
|
135
|
-
RoomTemperature: roomTemperature,
|
|
136
|
-
SupplyTemperature: supplyTemperature,
|
|
137
|
-
OutdoorTemperature: outdoorTemperature,
|
|
138
|
-
NightPurgeMode: nightPurgeMode,
|
|
139
|
-
SetTemperature: setTemperature,
|
|
140
|
-
SetFanSpeed: setFanSpeed,
|
|
141
|
-
OperationMode: operationMode,
|
|
142
|
-
VentilationMode: ventilationMode,
|
|
143
|
-
RoomCO2Level: roomCO2Level,
|
|
144
|
-
ActualSupplyFanSpeed: actualSupplyFanSpeed,
|
|
145
|
-
ActualExhaustFanSpeed: actualExhaustFanSpeed,
|
|
146
|
-
CoreMaintenanceRequired: coreMaintenanceRequired,
|
|
147
|
-
FilterMaintenanceRequired: filterMaintenanceRequired,
|
|
148
|
-
TemperatureIncrement: temperatureIncrement,
|
|
149
|
-
DefaultCoolingSetTemperature: defaultCoolingSetTemperature,
|
|
150
|
-
DefaultHeatingSetTemperature: defaultHeatingSetTemperature,
|
|
151
|
-
PM25SensorStatus: pM25SensorStatus,
|
|
152
|
-
PM25Level: pM25Level,
|
|
153
|
-
HideRoomTemperature: hideRoomTemperature,
|
|
154
|
-
HideSupplyTemperature: hideSupplyTemperature,
|
|
155
|
-
HideOutdoorTemperature: hideOutdoorTemperature,
|
|
156
|
-
IsInError: isInError
|
|
157
|
-
}
|
|
158
|
-
|
|
159
135
|
//restFul
|
|
160
|
-
this.
|
|
161
|
-
|
|
136
|
+
if (this.restFulEnabled) {
|
|
137
|
+
this.emit('restFul', 'info', deviceData);
|
|
138
|
+
this.emit('restFul', 'state', deviceData.Device);
|
|
139
|
+
}
|
|
162
140
|
|
|
163
141
|
//mqtt
|
|
164
|
-
this.
|
|
165
|
-
|
|
142
|
+
if (this.mqttEnabled) {
|
|
143
|
+
this.emit('mqtt', 'Info', deviceData);
|
|
144
|
+
this.emit('mqtt', 'State', deviceData.Device);
|
|
145
|
+
}
|
|
166
146
|
|
|
167
147
|
//check state changes
|
|
168
|
-
const deviceDataHasNotChanged = JSON.stringify(
|
|
148
|
+
const deviceDataHasNotChanged = JSON.stringify(devicesData) === JSON.stringify(this.devicesData);
|
|
169
149
|
if (deviceDataHasNotChanged) {
|
|
170
150
|
if (this.logDebug) this.emit('debug', `Device state not changed`);
|
|
171
151
|
return;
|
|
172
152
|
}
|
|
173
|
-
this.
|
|
153
|
+
this.devicesData = devicesData;
|
|
174
154
|
|
|
175
155
|
//emit info
|
|
176
156
|
this.emit('deviceInfo', manufacturer, indoor.model, outdoor.model, serialNumber, firmwareAppVersion);
|