homebridge-melcloud-control 4.1.1-beta.2 → 4.1.1-beta.4
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/melcloudata.js +2 -36
- package/src/melcloudatw.js +17 -74
- package/src/melclouderv.js +14 -65
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.4",
|
|
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/melcloudata.js
CHANGED
|
@@ -77,43 +77,9 @@ class MelCloudAta extends EventEmitter {
|
|
|
77
77
|
}
|
|
78
78
|
if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`);
|
|
79
79
|
|
|
80
|
-
//keys
|
|
81
|
-
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
82
|
-
const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
83
|
-
const errorKey = this.accountType === 'melcloud' ? 'HasError' : 'IsInError';
|
|
84
|
-
|
|
85
|
-
//device info
|
|
86
|
-
const serialNumber = deviceData.SerialNumber;
|
|
87
|
-
const hideVaneControls = deviceData.HideVaneControls;
|
|
88
|
-
const hideDryModeControl = deviceData.HideDryModeControl;
|
|
89
|
-
const frostProtection = deviceData.FrostProtection;
|
|
90
|
-
const overheatProtection = deviceData.OverheatProtection;
|
|
91
|
-
const holidayMode = deviceData.HolidayMode;
|
|
92
|
-
const sheduleEnabled = deviceData.ScheduleEnabled;
|
|
93
|
-
|
|
94
80
|
//device
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
const prohibitOperationMode = device.ProhibitOperationMode;
|
|
98
|
-
const prohibitPower = device.ProhibitPower;
|
|
99
|
-
const power = device.Power;
|
|
100
|
-
const roomTemperature = device.RoomTemperature;
|
|
101
|
-
const outdoorTemperature = device.OutdoorTemperature;
|
|
102
|
-
const setTemperature = device.SetTemperature;
|
|
103
|
-
const actualFanSpeed = device.ActualFanSpeed;
|
|
104
|
-
const setFanSpeed = device[fanKey];
|
|
105
|
-
const automaticFanSpeed = device.AutomaticFanSpeed;
|
|
106
|
-
const vaneVerticalDirection = device.VaneVerticalDirection;
|
|
107
|
-
const vaneVerticalSwing = device.VaneVerticalSwing;
|
|
108
|
-
const vaneHorizontalDirection = device.VaneHorizontalDirection;
|
|
109
|
-
const vaneHorizontalSwing = device.VaneHorizontalSwing;
|
|
110
|
-
const operationMode = device.OperationMode;
|
|
111
|
-
const inStandbyMode = device.InStandbyMode;
|
|
112
|
-
const temperatureIncrement = device[tempStepKey];
|
|
113
|
-
const defaultCoolingSetTemperature = device.DefaultCoolingSetTemperature;
|
|
114
|
-
const defaultHeatingSetTemperature = device.DefaultHeatingSetTemperature;
|
|
115
|
-
const firmwareAppVersion = device.FirmwareAppVersion;
|
|
116
|
-
const isInError = device[errorKey];
|
|
81
|
+
const serialNumber = deviceData.SerialNumber;
|
|
82
|
+
const firmwareAppVersion = deviceData.Device?.FirmwareAppVersion;
|
|
117
83
|
|
|
118
84
|
//units
|
|
119
85
|
const units = Array.isArray(device.Units) ? device.Units : [];
|
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
|
|
@@ -67,45 +69,11 @@ class MelCloudAtw extends EventEmitter {
|
|
|
67
69
|
}
|
|
68
70
|
if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`);
|
|
69
71
|
|
|
70
|
-
//keys
|
|
71
|
-
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
72
|
-
const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
73
|
-
const errorKey = this.accountType === 'melcloud' ? 'HasError' : 'IsInError';
|
|
74
|
-
|
|
75
|
-
//device info
|
|
76
|
-
const serialNumber = deviceData.SerialNumber;
|
|
77
|
-
|
|
78
72
|
//device
|
|
79
|
-
const
|
|
80
|
-
const hasHotWaterTank =
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
const roomTemperatureZone2 = device.RoomTemperatureZone2;
|
|
84
|
-
const outdoorTemperature = device.OutdoorTemperature;
|
|
85
|
-
const tankWaterTemperature = device.TankWaterTemperature;
|
|
86
|
-
const unitStatus = device.UnitStatus;
|
|
87
|
-
const power = device.Power;
|
|
88
|
-
const ecoHotWater = device.EcoHotWater;
|
|
89
|
-
const operationMode = device.OperationMode;
|
|
90
|
-
const operationModeZone1 = device.OperationModeZone1;
|
|
91
|
-
const operationModeZone2 = device.OperationModeZone2;
|
|
92
|
-
const setTemperatureZone1 = device.SetTemperatureZone1;
|
|
93
|
-
const setTemperatureZone2 = device.SetTemperatureZone2;
|
|
94
|
-
const setTankWaterTemperature = device.SetTankWaterTemperature;
|
|
95
|
-
const forcedHotWaterMode = device.ForcedHotWaterMode;
|
|
96
|
-
const holidayMode = device.HolidayMode;
|
|
97
|
-
const prohibitHotWater = device.ProhibitHotWater;
|
|
98
|
-
const prohibitHeatingZone1 = device.ProhibitHeatingZone1;
|
|
99
|
-
const prohibitHeatingZone2 = device.ProhibitHeatingZone2;
|
|
100
|
-
const setHeatFlowTemperatureZone1 = device.SetHeatFlowTemperatureZone1;
|
|
101
|
-
const setHeatFlowTemperatureZone2 = device.SetHeatFlowTemperatureZone2;
|
|
102
|
-
const setCoolFlowTemperatureZone1 = device.SetCoolFlowTemperatureZone1;
|
|
103
|
-
const setCoolFlowTemperatureZone2 = device.SetCoolFlowTemperatureZone2;
|
|
104
|
-
const idleZone1 = device.IdleZone1 ?? false;
|
|
105
|
-
const idleZone2 = device.IdleZone2 ?? false;
|
|
106
|
-
const firmwareAppVersion = device.FirmwareAppVersion;
|
|
107
|
-
const hasZone2 = device.HasZone2 ?? false;
|
|
108
|
-
const isInError = device[errorKey];
|
|
73
|
+
const serialNumber = deviceData.SerialNumber;
|
|
74
|
+
const hasHotWaterTank = deviceData.Device?.HasHotWaterTank;
|
|
75
|
+
const firmwareAppVersion = deviceData.Device?.FirmwareAppVersion;
|
|
76
|
+
const hasZone2 = deviceData.Device?.HasZone2;
|
|
109
77
|
|
|
110
78
|
//units
|
|
111
79
|
const units = Array.isArray(device.Units) ? device.Units : [];
|
|
@@ -130,50 +98,25 @@ class MelCloudAtw extends EventEmitter {
|
|
|
130
98
|
if (this.logDebug) this.emit('debug', `Units are not configured in MELCloud service`);
|
|
131
99
|
};
|
|
132
100
|
|
|
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
101
|
//restFul
|
|
163
|
-
this.
|
|
164
|
-
|
|
102
|
+
if (this.restFulEnabled) {
|
|
103
|
+
this.emit('restFul', 'info', deviceData);
|
|
104
|
+
this.emit('restFul', 'state', deviceData.Device);
|
|
105
|
+
}
|
|
165
106
|
|
|
166
107
|
//mqtt
|
|
167
|
-
this.
|
|
168
|
-
|
|
108
|
+
if (this.mqttEnabled) {
|
|
109
|
+
this.emit('mqtt', 'Info', deviceData);
|
|
110
|
+
this.emit('mqtt', 'State', deviceData.Device);
|
|
111
|
+
}
|
|
169
112
|
|
|
170
113
|
//check state changes
|
|
171
|
-
const deviceDataHasNotChanged = JSON.stringify(
|
|
114
|
+
const deviceDataHasNotChanged = JSON.stringify(devicesData) === JSON.stringify(this.devicesData);
|
|
172
115
|
if (deviceDataHasNotChanged) {
|
|
173
116
|
if (this.logDebug) this.emit('debug', `Device state not changed`);
|
|
174
117
|
return;
|
|
175
118
|
}
|
|
176
|
-
this.
|
|
119
|
+
this.devicesData = devicesData;
|
|
177
120
|
|
|
178
121
|
//emit info
|
|
179
122
|
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
|
|
@@ -72,40 +74,9 @@ class MelCloudErv extends EventEmitter {
|
|
|
72
74
|
}
|
|
73
75
|
if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`);
|
|
74
76
|
|
|
75
|
-
//keys
|
|
76
|
-
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
77
|
-
const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
78
|
-
const errorKey = this.accountType === 'melcloud' ? 'HasError' : 'IsInError';
|
|
79
|
-
|
|
80
77
|
//presets
|
|
81
|
-
const hideRoomTemperature = deviceData.HideRoomTemperature;
|
|
82
|
-
const hideSupplyTemperature = deviceData.HideSupplyTemperature;
|
|
83
|
-
const hideOutdoorTemperature = deviceData.HideOutdoorTemperature;
|
|
84
78
|
const serialNumber = deviceData.SerialNumber;
|
|
85
|
-
|
|
86
|
-
//device
|
|
87
|
-
const device = deviceData.Device ?? {};
|
|
88
|
-
const pM25SensorStatus = device.PM25SensorStatus;
|
|
89
|
-
const pM25Level = device.PM25Level;
|
|
90
|
-
const temperatureIncrement = device[tempStepKey];
|
|
91
|
-
const coreMaintenanceRequired = device.CoreMaintenanceRequired;
|
|
92
|
-
const filterMaintenanceRequired = device.FilterMaintenanceRequired;
|
|
93
|
-
const power = device.Power;
|
|
94
|
-
const roomTemperature = device.RoomTemperature;
|
|
95
|
-
const supplyTemperature = device.SupplyTemperature;
|
|
96
|
-
const outdoorTemperature = device.OutdoorTemperature;
|
|
97
|
-
const roomCO2Level = device.RoomCO2Level;
|
|
98
|
-
const nightPurgeMode = device.NightPurgeMode;
|
|
99
|
-
const setTemperature = device.SetTemperature;
|
|
100
|
-
const actualSupplyFanSpeed = device.ActualSupplyFanSpeed;
|
|
101
|
-
const actualExhaustFanSpeed = device.ActualExhaustFanSpeed;
|
|
102
|
-
const setFanSpeed = device.SetFanSpeed;
|
|
103
|
-
const operationMode = device.OperationMode; //0, Heat, 2, Cool, 4, 5, 6, Fan, Auto
|
|
104
|
-
const ventilationMode = device.VentilationMode; //Lossnay, Bypass, Auto
|
|
105
|
-
const defaultCoolingSetTemperature = device.DefaultCoolingSetTemperature;
|
|
106
|
-
const defaultHeatingSetTemperature = device.DefaultHeatingSetTemperature;
|
|
107
|
-
const firmwareAppVersion = device.FirmwareAppVersion;
|
|
108
|
-
const isInError = device[errorKey];
|
|
79
|
+
const firmwareAppVersion = deviceData.Device?.FirmwareAppVersion;
|
|
109
80
|
|
|
110
81
|
//units
|
|
111
82
|
const units = Array.isArray(device.Units) ? device.Units : [];
|
|
@@ -130,47 +101,25 @@ class MelCloudErv extends EventEmitter {
|
|
|
130
101
|
if (this.logDebug) this.emit('debug', `Units are not configured in MELCloud service`);
|
|
131
102
|
};
|
|
132
103
|
|
|
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
104
|
//restFul
|
|
160
|
-
this.
|
|
161
|
-
|
|
105
|
+
if (this.restFulEnabled) {
|
|
106
|
+
this.emit('restFul', 'info', deviceData);
|
|
107
|
+
this.emit('restFul', 'state', deviceData.Device);
|
|
108
|
+
}
|
|
162
109
|
|
|
163
110
|
//mqtt
|
|
164
|
-
this.
|
|
165
|
-
|
|
111
|
+
if (this.mqttEnabled) {
|
|
112
|
+
this.emit('mqtt', 'Info', deviceData);
|
|
113
|
+
this.emit('mqtt', 'State', deviceData.Device);
|
|
114
|
+
}
|
|
166
115
|
|
|
167
116
|
//check state changes
|
|
168
|
-
const deviceDataHasNotChanged = JSON.stringify(
|
|
117
|
+
const deviceDataHasNotChanged = JSON.stringify(devicesData) === JSON.stringify(this.devicesData);
|
|
169
118
|
if (deviceDataHasNotChanged) {
|
|
170
119
|
if (this.logDebug) this.emit('debug', `Device state not changed`);
|
|
171
120
|
return;
|
|
172
121
|
}
|
|
173
|
-
this.
|
|
122
|
+
this.devicesData = devicesData;
|
|
174
123
|
|
|
175
124
|
//emit info
|
|
176
125
|
this.emit('deviceInfo', manufacturer, indoor.model, outdoor.model, serialNumber, firmwareAppVersion);
|