homebridge-melcloud-control 4.2.0-beta.0 → 4.2.0-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.
- package/package.json +1 -1
- package/src/deviceata.js +21 -20
- package/src/deviceatw.js +16 -19
- package/src/deviceerv.js +18 -21
- package/src/melcloudata.js +1 -1
- package/src/melcloudatw.js +1 -1
- package/src/melclouderv.js +1 -1
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.0-beta.
|
|
4
|
+
"version": "4.2.0-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",
|
package/src/deviceata.js
CHANGED
|
@@ -26,22 +26,24 @@ class DeviceAta extends EventEmitter {
|
|
|
26
26
|
|
|
27
27
|
//device config
|
|
28
28
|
this.device = device;
|
|
29
|
+
this.deviceId = device.id;
|
|
30
|
+
this.deviceName = device.name;
|
|
31
|
+
this.deviceTypeText = device.typeString;
|
|
29
32
|
this.displayType = device.displayType;
|
|
33
|
+
this.heatDryFanMode = device.heatDryFanMode || 1; //NONE, HEAT, DRY, FAN
|
|
34
|
+
this.coolDryFanMode = device.coolDryFanMode || 1; //NONE, COOL, DRY, FAN
|
|
35
|
+
this.autoDryFanMode = device.autoDryFanMode || 1; //NONE, AUTO, DRY, FAN
|
|
30
36
|
this.temperatureSensor = device.temperatureSensor || false;
|
|
31
37
|
this.temperatureOutdoorSensor = device.temperatureOutdoorSensor || false;
|
|
32
38
|
this.errorSensor = device.errorSensor || false;
|
|
33
39
|
this.frostProtectionSupport = device.frostProtectionSupport || false;
|
|
34
40
|
this.overheatProtectionSupport = device.overheatProtectionSupport || false;
|
|
35
41
|
this.holidayModeSupport = device.holidayModeSupport || false;
|
|
36
|
-
this.heatDryFanMode = device.heatDryFanMode || 1; //NONE, HEAT, DRY, FAN
|
|
37
|
-
this.coolDryFanMode = device.coolDryFanMode || 1; //NONE, COOL, DRY, FAN
|
|
38
|
-
this.autoDryFanMode = device.autoDryFanMode || 1; //NONE, AUTO, DRY, FAN
|
|
39
42
|
this.presets = this.accountType === 'melcloud' ? (device.presets || []).filter(preset => (preset.displayType ?? 0) > 0 && preset.id !== '0') : [];
|
|
40
43
|
this.schedules = this.accountType === 'melcloudhome' ? (device.schedules || []).filter(schedule => (schedule.displayType ?? 0) > 0 && schedule.id !== '0') : [];
|
|
41
44
|
this.buttons = (device.buttonsSensors || []).filter(sensor => (sensor.displayType ?? 0) > 0);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.deviceTypeText = device.typeString;
|
|
45
|
+
|
|
46
|
+
//files
|
|
45
47
|
this.devicesFile = devicesFile;
|
|
46
48
|
this.defaultTempsFile = defaultTempsFile;
|
|
47
49
|
this.displayDeviceInfo = true;
|
|
@@ -670,7 +672,7 @@ class DeviceAta extends EventEmitter {
|
|
|
670
672
|
if (this.logDebug) this.emit('debug', `Prepare frost protection service`);
|
|
671
673
|
this.frostProtectionSensorService = new Service.ContactSensor(`${serviceName} Frost Protection`, `frostProtectionSensorService${deviceId}`);
|
|
672
674
|
this.frostProtectionSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
673
|
-
this.frostProtectionSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Frost Protection
|
|
675
|
+
this.frostProtectionSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Frost Protection`);
|
|
674
676
|
this.frostProtectionSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
675
677
|
.onGet(async () => {
|
|
676
678
|
const state = this.accessory.frostProtectionActive;
|
|
@@ -716,7 +718,7 @@ class DeviceAta extends EventEmitter {
|
|
|
716
718
|
if (this.logDebug) this.emit('debug', `Prepare overheat protection sensor service`);
|
|
717
719
|
this.overheatProtectionSensorService = new Service.ContactSensor(`${serviceName} Overheat Protection`, `overheatProtectionSensorService${deviceId}`);
|
|
718
720
|
this.overheatProtectionSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
719
|
-
this.overheatProtectionSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Overheat Protection
|
|
721
|
+
this.overheatProtectionSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Overheat Protection`);
|
|
720
722
|
this.overheatProtectionSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
721
723
|
.onGet(async () => {
|
|
722
724
|
const state = this.accessory.overheatProtectionActive;
|
|
@@ -763,7 +765,7 @@ class DeviceAta extends EventEmitter {
|
|
|
763
765
|
if (this.logDebug) this.emit('debug', `Prepare holiday mode sensor service`);
|
|
764
766
|
this.holidayModeSensorService = new Service.ContactSensor(`${serviceName} Holiday Mode`, `holidayModeSensorService${deviceId}`);
|
|
765
767
|
this.holidayModeSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
766
|
-
this.holidayModeSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode
|
|
768
|
+
this.holidayModeSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode`);
|
|
767
769
|
this.holidayModeSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
768
770
|
.onGet(async () => {
|
|
769
771
|
const state = this.accessory.holidayModeActive;
|
|
@@ -785,12 +787,12 @@ class DeviceAta extends EventEmitter {
|
|
|
785
787
|
//get preset name prefix
|
|
786
788
|
const namePrefix = preset.namePrefix;
|
|
787
789
|
|
|
788
|
-
const
|
|
790
|
+
const serviceName1 = namePrefix ? `${accessoryName} ${name}` : name;
|
|
789
791
|
const serviceType = preset.serviceType;
|
|
790
792
|
const characteristicType = preset.characteristicType;
|
|
791
|
-
const presetService = new serviceType(
|
|
793
|
+
const presetService = new serviceType(serviceName1, `Preset ${deviceId} ${i}`);
|
|
792
794
|
presetService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
793
|
-
presetService.setCharacteristic(Characteristic.ConfiguredName,
|
|
795
|
+
presetService.setCharacteristic(Characteristic.ConfiguredName, serviceName1);
|
|
794
796
|
presetService.getCharacteristic(characteristicType)
|
|
795
797
|
.onGet(async () => {
|
|
796
798
|
const state = preset.state;
|
|
@@ -843,10 +845,9 @@ class DeviceAta extends EventEmitter {
|
|
|
843
845
|
//control
|
|
844
846
|
if (i === 0) {
|
|
845
847
|
if (this.logDebug) this.emit('debug', `Prepare schedule control service`);
|
|
846
|
-
|
|
847
|
-
this.schedulesControlService = new Service.Switch(serviceNameSchedule, `schedulesControlService${deviceId} ${i}`);
|
|
848
|
+
this.schedulesControlService = new Service.Switch(`${serviceName} Schedule`, `schedulesControlService${deviceId} ${i}`);
|
|
848
849
|
this.schedulesControlService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
849
|
-
this.schedulesControlService.setCharacteristic(Characteristic.ConfiguredName,
|
|
850
|
+
this.schedulesControlService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Schedule`);
|
|
850
851
|
this.schedulesControlService.getCharacteristic(Characteristic.On)
|
|
851
852
|
.onGet(async () => {
|
|
852
853
|
const state = this.accessory.scheduleEnabled;
|
|
@@ -864,9 +865,9 @@ class DeviceAta extends EventEmitter {
|
|
|
864
865
|
accessory.addService(this.schedulesControlService);
|
|
865
866
|
|
|
866
867
|
if (this.logDebug) this.emit('debug', `Prepare schedule control sensor service`);
|
|
867
|
-
this.schedulesControlSensorService = new Service.ContactSensor(
|
|
868
|
+
this.schedulesControlSensorService = new Service.ContactSensor(`${serviceName} Schedule Control`, `schedulesControlSensorService${deviceId}`);
|
|
868
869
|
this.schedulesControlSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
869
|
-
this.schedulesControlSensorService.setCharacteristic(Characteristic.ConfiguredName,
|
|
870
|
+
this.schedulesControlSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Schedule Control`);
|
|
870
871
|
this.schedulesControlSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
871
872
|
.onGet(async () => {
|
|
872
873
|
const state = this.accessory.scheduleEnabled;
|
|
@@ -876,12 +877,12 @@ class DeviceAta extends EventEmitter {
|
|
|
876
877
|
}
|
|
877
878
|
|
|
878
879
|
//sensors
|
|
879
|
-
const
|
|
880
|
+
const serviceName1 = namePrefix ? `${accessoryName} ${name}` : name;
|
|
880
881
|
const serviceType = schedule.serviceType;
|
|
881
882
|
const characteristicType = schedule.characteristicType;
|
|
882
|
-
const scheduleService = new serviceType(
|
|
883
|
+
const scheduleService = new serviceType(serviceName1, `scheduleService${deviceId} ${i}`);
|
|
883
884
|
scheduleService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
884
|
-
scheduleService.setCharacteristic(Characteristic.ConfiguredName,
|
|
885
|
+
scheduleService.setCharacteristic(Characteristic.ConfiguredName, serviceName1);
|
|
885
886
|
scheduleService.getCharacteristic(characteristicType)
|
|
886
887
|
.onGet(async () => {
|
|
887
888
|
const state = schedule.state;
|
package/src/deviceatw.js
CHANGED
|
@@ -302,6 +302,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
302
302
|
.setCharacteristic(Characteristic.ConfiguredName, accessoryName);
|
|
303
303
|
|
|
304
304
|
//services
|
|
305
|
+
const serviceName = `${deviceTypeText} ${accessoryName}`;
|
|
305
306
|
if (zonesCount > 0) {
|
|
306
307
|
this.melCloudServices = [];
|
|
307
308
|
this.accessory.zones.forEach((zone, i) => {
|
|
@@ -1051,7 +1052,6 @@ class DeviceAtw extends EventEmitter {
|
|
|
1051
1052
|
//error sensor
|
|
1052
1053
|
if (this.errorSensor && this.accessory.isInError !== null) {
|
|
1053
1054
|
if (this.logDebug) this.emit('debug', `Prepare error service`);
|
|
1054
|
-
const serviceName = `${deviceTypeText} ${accessoryName}`;
|
|
1055
1055
|
this.errorService = new Service.ContactSensor(`${serviceName} Error`, `Error Sensor ${deviceId}`);
|
|
1056
1056
|
this.errorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1057
1057
|
this.errorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Error`);
|
|
@@ -1114,9 +1114,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
1114
1114
|
if (this.presets.length > 0) {
|
|
1115
1115
|
if (this.logDebug) this.emit('debug', `Prepare presets services`);
|
|
1116
1116
|
this.presetsServices = [];
|
|
1117
|
-
const presetsIdKey = this.accountType === 'melcloud' ? 'ID' : 'Id';
|
|
1118
1117
|
this.presets.forEach((preset, i) => {
|
|
1119
|
-
const presetData = presetsOnServer.find(p => p
|
|
1118
|
+
const presetData = presetsOnServer.find(p => p.ID === preset.id);
|
|
1120
1119
|
|
|
1121
1120
|
//get preset name
|
|
1122
1121
|
const name = preset.name;
|
|
@@ -1194,10 +1193,9 @@ class DeviceAtw extends EventEmitter {
|
|
|
1194
1193
|
//control
|
|
1195
1194
|
if (i === 0) {
|
|
1196
1195
|
if (this.logDebug) this.emit('debug', `Prepare schedule control service`);
|
|
1197
|
-
|
|
1198
|
-
this.schedulesControlService = new Service.Switch(serviceNameSchedule, `Schedule Control ${deviceId} ${i}`);
|
|
1196
|
+
this.schedulesControlService = new Service.Switch(`${serviceName} Schedule`, `schedulesControlService${deviceId} ${i}`);
|
|
1199
1197
|
this.schedulesControlService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1200
|
-
this.schedulesControlService.setCharacteristic(Characteristic.ConfiguredName,
|
|
1198
|
+
this.schedulesControlService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Schedules`);
|
|
1201
1199
|
this.schedulesControlService.getCharacteristic(Characteristic.On)
|
|
1202
1200
|
.onGet(async () => {
|
|
1203
1201
|
const state = this.accessory.scheduleEnabled;
|
|
@@ -1215,24 +1213,24 @@ class DeviceAtw extends EventEmitter {
|
|
|
1215
1213
|
accessory.addService(this.schedulesControlService);
|
|
1216
1214
|
|
|
1217
1215
|
if (this.logDebug) this.emit('debug', `Prepare schedule control sensor service`);
|
|
1218
|
-
this.
|
|
1219
|
-
this.
|
|
1220
|
-
this.
|
|
1221
|
-
this.
|
|
1216
|
+
this.schedulesControlSensorService = new Service.ContactSensor(`${serviceName} Schedule Control`, `schedulesControlSensorService${deviceId}`);
|
|
1217
|
+
this.schedulesControlSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1218
|
+
this.schedulesControlSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Schedule Control`);
|
|
1219
|
+
this.schedulesControlSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
1222
1220
|
.onGet(async () => {
|
|
1223
1221
|
const state = this.accessory.scheduleEnabled;
|
|
1224
1222
|
return state;
|
|
1225
1223
|
})
|
|
1226
|
-
accessory.addService(this.
|
|
1224
|
+
accessory.addService(this.schedulesControlSensorService);
|
|
1227
1225
|
}
|
|
1228
1226
|
|
|
1229
1227
|
//sensors
|
|
1230
|
-
const
|
|
1228
|
+
const serviceName1 = namePrefix ? `${accessoryName} ${name}` : name;
|
|
1231
1229
|
const serviceType = schedule.serviceType;
|
|
1232
1230
|
const characteristicType = schedule.characteristicType;
|
|
1233
|
-
const scheduleService = new serviceType(serviceName, `
|
|
1231
|
+
const scheduleService = new serviceType(serviceName, `scheduleService${deviceId} ${i}`);
|
|
1234
1232
|
scheduleService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1235
|
-
scheduleService.setCharacteristic(Characteristic.ConfiguredName,
|
|
1233
|
+
scheduleService.setCharacteristic(Characteristic.ConfiguredName, serviceName1);
|
|
1236
1234
|
scheduleService.getCharacteristic(characteristicType)
|
|
1237
1235
|
.onGet(async () => {
|
|
1238
1236
|
const state = schedule.state;
|
|
@@ -1260,12 +1258,12 @@ class DeviceAtw extends EventEmitter {
|
|
|
1260
1258
|
//get button name prefix
|
|
1261
1259
|
const namePrefix = button.namePrefix;
|
|
1262
1260
|
|
|
1263
|
-
const
|
|
1261
|
+
const serviceName1 = namePrefix ? `${accessoryName} ${name}` : name;
|
|
1264
1262
|
const serviceType = button.serviceType;
|
|
1265
1263
|
const characteristicType = button.characteristicType;
|
|
1266
1264
|
const buttonService = new serviceType(serviceName, `Button ${deviceId} ${i}`);
|
|
1267
1265
|
buttonService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1268
|
-
buttonService.setCharacteristic(Characteristic.ConfiguredName,
|
|
1266
|
+
buttonService.setCharacteristic(Characteristic.ConfiguredName, serviceName1);
|
|
1269
1267
|
buttonService.getCharacteristic(characteristicType)
|
|
1270
1268
|
.onGet(async () => {
|
|
1271
1269
|
const state = button.state;
|
|
@@ -1453,7 +1451,6 @@ class DeviceAtw extends EventEmitter {
|
|
|
1453
1451
|
this.deviceData = deviceData;
|
|
1454
1452
|
|
|
1455
1453
|
//keys
|
|
1456
|
-
const presetsIdKey = this.accountType === 'melcloud' ? 'ID' : 'Id';
|
|
1457
1454
|
const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
1458
1455
|
const errorKey = this.accountType === 'melcloud' ? 'HasError' : 'IsInError';
|
|
1459
1456
|
|
|
@@ -1958,7 +1955,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1958
1955
|
//presets
|
|
1959
1956
|
if (this.presets.length > 0) {
|
|
1960
1957
|
this.presets.forEach((preset, i) => {
|
|
1961
|
-
const presetData = presetsOnServer.find(p => p
|
|
1958
|
+
const presetData = presetsOnServer.find(p => p.ID === preset.id);
|
|
1962
1959
|
|
|
1963
1960
|
preset.state = presetData ? (presetData.Power === power
|
|
1964
1961
|
&& presetData.EcoHotWater === ecoHotWater
|
|
@@ -1985,7 +1982,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1985
1982
|
if (i === 0) this.schedulesControlService?.updateCharacteristic(Characteristic.On, scheduleEnabled);
|
|
1986
1983
|
|
|
1987
1984
|
//sensors
|
|
1988
|
-
const scheduleData = schedulesOnServer.find(s => s
|
|
1985
|
+
const scheduleData = schedulesOnServer.find(s => s.Id === schedule.id);
|
|
1989
1986
|
schedule.state = scheduleEnabled ? scheduleData.Enabled ?? false : false;
|
|
1990
1987
|
|
|
1991
1988
|
const characteristicType = schedule.characteristicType;
|
package/src/deviceerv.js
CHANGED
|
@@ -741,12 +741,12 @@ class DeviceErv extends EventEmitter {
|
|
|
741
741
|
//get preset name prefix
|
|
742
742
|
const namePrefix = preset.namePrefix;
|
|
743
743
|
|
|
744
|
-
const
|
|
744
|
+
const serviceName1 = namePrefix ? `${accessoryName} ${name}` : name;
|
|
745
745
|
const serviceType = preset.serviceType;
|
|
746
746
|
const characteristicType = preset.characteristicType;
|
|
747
|
-
const presetService = new serviceType(
|
|
747
|
+
const presetService = new serviceType(serviceName1, `Preset ${deviceId} ${i}`);
|
|
748
748
|
presetService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
749
|
-
presetService.setCharacteristic(Characteristic.ConfiguredName,
|
|
749
|
+
presetService.setCharacteristic(Characteristic.ConfiguredName, serviceName1);
|
|
750
750
|
presetService.getCharacteristic(characteristicType)
|
|
751
751
|
.onGet(async () => {
|
|
752
752
|
const state = preset.state;
|
|
@@ -797,10 +797,9 @@ class DeviceErv extends EventEmitter {
|
|
|
797
797
|
//control
|
|
798
798
|
if (i === 0) {
|
|
799
799
|
if (this.logDebug) this.emit('debug', `Prepare schedule control service`);
|
|
800
|
-
|
|
801
|
-
this.schedulesControlService = new Service.Switch(serviceNameSchedule, `Schedule Control ${deviceId} ${i}`);
|
|
800
|
+
this.schedulesControlService = new Service.Switch(`${serviceName} Schedule`, `schedulesControlService${deviceId} ${i}`);
|
|
802
801
|
this.schedulesControlService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
803
|
-
this.schedulesControlService.setCharacteristic(Characteristic.ConfiguredName,
|
|
802
|
+
this.schedulesControlService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Schedules`);
|
|
804
803
|
this.schedulesControlService.getCharacteristic(Characteristic.On)
|
|
805
804
|
.onGet(async () => {
|
|
806
805
|
const state = this.accessory.scheduleEnabled;
|
|
@@ -818,24 +817,24 @@ class DeviceErv extends EventEmitter {
|
|
|
818
817
|
accessory.addService(this.schedulesControlService);
|
|
819
818
|
|
|
820
819
|
if (this.logDebug) this.emit('debug', `Prepare schedule control sensor service`);
|
|
821
|
-
this.
|
|
822
|
-
this.
|
|
823
|
-
this.
|
|
824
|
-
this.
|
|
820
|
+
this.schedulesControlSensorService = new Service.ContactSensor(`${serviceName} Schedule Control`, `schedulesControlSensorService${deviceId}`);
|
|
821
|
+
this.schedulesControlSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
822
|
+
this.schedulesControlSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Schedule Control`);
|
|
823
|
+
this.schedulesControlSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
825
824
|
.onGet(async () => {
|
|
826
825
|
const state = this.accessory.scheduleEnabled;
|
|
827
826
|
return state;
|
|
828
827
|
})
|
|
829
|
-
accessory.addService(this.
|
|
828
|
+
accessory.addService(this.schedulesControlSensorService);
|
|
830
829
|
}
|
|
831
830
|
|
|
832
831
|
//sensors
|
|
833
|
-
const
|
|
832
|
+
const serviceName1 = namePrefix ? `${accessoryName} ${name}` : name;
|
|
834
833
|
const serviceType = schedule.serviceType;
|
|
835
834
|
const characteristicType = schedule.characteristicType;
|
|
836
|
-
const scheduleService = new serviceType(
|
|
835
|
+
const scheduleService = new serviceType(serviceName1, `scheduleService${deviceId} ${i}`);
|
|
837
836
|
scheduleService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
838
|
-
scheduleService.setCharacteristic(Characteristic.ConfiguredName,
|
|
837
|
+
scheduleService.setCharacteristic(Characteristic.ConfiguredName, serviceName1);
|
|
839
838
|
scheduleService.getCharacteristic(characteristicType)
|
|
840
839
|
.onGet(async () => {
|
|
841
840
|
const state = schedule.state;
|
|
@@ -860,12 +859,12 @@ class DeviceErv extends EventEmitter {
|
|
|
860
859
|
//get button name prefix
|
|
861
860
|
const namePrefix = button.namePrefix;
|
|
862
861
|
|
|
863
|
-
const
|
|
862
|
+
const serviceName1 = namePrefix ? `${accessoryName} ${buttonName}` : buttonName;
|
|
864
863
|
const serviceType = button.serviceType;
|
|
865
864
|
const characteristicType = button.characteristicType;
|
|
866
|
-
const buttonService = new serviceType(
|
|
865
|
+
const buttonService = new serviceType(serviceName1, `Button ${deviceId} ${i}`);
|
|
867
866
|
buttonService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
868
|
-
buttonService.setCharacteristic(Characteristic.ConfiguredName,
|
|
867
|
+
buttonService.setCharacteristic(Characteristic.ConfiguredName, serviceName1);
|
|
869
868
|
buttonService.getCharacteristic(characteristicType)
|
|
870
869
|
.onGet(async () => {
|
|
871
870
|
const state = button.state;
|
|
@@ -997,8 +996,6 @@ class DeviceErv extends EventEmitter {
|
|
|
997
996
|
this.deviceData = deviceData;
|
|
998
997
|
|
|
999
998
|
//keys
|
|
1000
|
-
const presetsIdKey = this.accountType === 'melcloud' ? 'ID' : 'Id';
|
|
1001
|
-
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
1002
999
|
const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
1003
1000
|
const errorKey = this.accountType === 'melcloud' ? 'HasError' : 'IsInError';
|
|
1004
1001
|
|
|
@@ -1251,7 +1248,7 @@ class DeviceErv extends EventEmitter {
|
|
|
1251
1248
|
//presets
|
|
1252
1249
|
if (this.presets.length > 0) {
|
|
1253
1250
|
this.presets.forEach((preset, i) => {
|
|
1254
|
-
const presetData = presetsOnServer.find(p => p
|
|
1251
|
+
const presetData = presetsOnServer.find(p => p.ID === preset.id);
|
|
1255
1252
|
|
|
1256
1253
|
preset.state = presetData ? (presetData.Power === power
|
|
1257
1254
|
&& presetData.SetTemperature === setTemperature
|
|
@@ -1271,7 +1268,7 @@ class DeviceErv extends EventEmitter {
|
|
|
1271
1268
|
if (i === 0) this.schedulesControlService?.updateCharacteristic(Characteristic.On, scheduleEnabled);
|
|
1272
1269
|
|
|
1273
1270
|
//sensors
|
|
1274
|
-
const scheduleData = schedulesOnServer.find(s => s
|
|
1271
|
+
const scheduleData = schedulesOnServer.find(s => s.Id === schedule.id);
|
|
1275
1272
|
schedule.state = scheduleEnabled ? scheduleData.Enabled ?? false : false;
|
|
1276
1273
|
|
|
1277
1274
|
const characteristicType = schedule.characteristicType;
|
package/src/melcloudata.js
CHANGED
package/src/melcloudatw.js
CHANGED