homebridge-melcloud-control 3.10.0-beta.2 → 3.10.0-beta.21
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/config.schema.json +57 -57
- package/index.js +7 -7
- package/package.json +1 -1
- package/src/deviceata.js +27 -28
- package/src/deviceatw.js +23 -24
- package/src/deviceerv.js +28 -29
- package/src/melcloud.js +5 -4
- package/src/melcloudata.js +3 -2
- package/src/melcloudatw.js +2 -1
- package/src/melclouderv.js +2 -1
package/config.schema.json
CHANGED
|
@@ -1592,7 +1592,7 @@
|
|
|
1592
1592
|
}
|
|
1593
1593
|
},
|
|
1594
1594
|
"required": [
|
|
1595
|
-
"
|
|
1595
|
+
"displayType"
|
|
1596
1596
|
]
|
|
1597
1597
|
}
|
|
1598
1598
|
}
|
|
@@ -1809,14 +1809,14 @@
|
|
|
1809
1809
|
"key": "accounts[].ataDevices[].typeString",
|
|
1810
1810
|
"readonly": true
|
|
1811
1811
|
},
|
|
1812
|
-
"accounts[].ataDevices[].displayMode",
|
|
1813
1812
|
{
|
|
1814
1813
|
"key": "accounts[].ataDevices[]",
|
|
1815
|
-
"type": "section",
|
|
1816
1814
|
"title": "Settings",
|
|
1815
|
+
"type": "section",
|
|
1817
1816
|
"expandable": true,
|
|
1818
1817
|
"expanded": false,
|
|
1819
1818
|
"items": [
|
|
1819
|
+
"accounts[].ataDevices[].displayMode",
|
|
1820
1820
|
"accounts[].ataDevices[].name",
|
|
1821
1821
|
"accounts[].ataDevices[].heatDryFanMode",
|
|
1822
1822
|
"accounts[].ataDevices[].coolDryFanMode",
|
|
@@ -1825,9 +1825,20 @@
|
|
|
1825
1825
|
]
|
|
1826
1826
|
},
|
|
1827
1827
|
{
|
|
1828
|
-
"key": "accounts[].ataDevices",
|
|
1828
|
+
"key": "accounts[].ataDevices[]",
|
|
1829
|
+
"title": "Temperature Sensors",
|
|
1829
1830
|
"type": "section",
|
|
1831
|
+
"expandable": true,
|
|
1832
|
+
"expanded": false,
|
|
1833
|
+
"items": [
|
|
1834
|
+
"accounts[].ataDevices[].temperatureSensor",
|
|
1835
|
+
"accounts[].ataDevices[].temperatureSensorOutdoor"
|
|
1836
|
+
]
|
|
1837
|
+
},
|
|
1838
|
+
{
|
|
1839
|
+
"key": "accounts[].ataDevices[].presets",
|
|
1830
1840
|
"title": "Presets",
|
|
1841
|
+
"type": "section",
|
|
1831
1842
|
"expandable": true,
|
|
1832
1843
|
"expanded": false,
|
|
1833
1844
|
"items": [
|
|
@@ -1848,20 +1859,9 @@
|
|
|
1848
1859
|
]
|
|
1849
1860
|
},
|
|
1850
1861
|
{
|
|
1851
|
-
"key": "accounts[].ataDevices",
|
|
1852
|
-
"type": "section",
|
|
1853
|
-
"title": "Temperature Sensors",
|
|
1854
|
-
"expandable": true,
|
|
1855
|
-
"expanded": false,
|
|
1856
|
-
"items": [
|
|
1857
|
-
"accounts[].ataDevices[].temperatureSensor",
|
|
1858
|
-
"accounts[].ataDevices[].temperatureSensorOutdoor"
|
|
1859
|
-
]
|
|
1860
|
-
},
|
|
1861
|
-
{
|
|
1862
|
-
"key": "accounts[].ataDevices",
|
|
1863
|
-
"type": "section",
|
|
1862
|
+
"key": "accounts[].ataDevices[].buttonsSensors",
|
|
1864
1863
|
"title": "Buttons / Sensors",
|
|
1864
|
+
"type": "section",
|
|
1865
1865
|
"expandable": true,
|
|
1866
1866
|
"expanded": false,
|
|
1867
1867
|
"items": [
|
|
@@ -1911,8 +1911,6 @@
|
|
|
1911
1911
|
"key": "accounts[].atwDevices[].typeString",
|
|
1912
1912
|
"readonly": true
|
|
1913
1913
|
},
|
|
1914
|
-
"accounts[].atwDevices[].displayMode",
|
|
1915
|
-
"accounts[].atwDevices[].hideZone",
|
|
1916
1914
|
{
|
|
1917
1915
|
"key": "accounts[].atwDevices[]",
|
|
1918
1916
|
"type": "section",
|
|
@@ -1920,14 +1918,34 @@
|
|
|
1920
1918
|
"expandable": true,
|
|
1921
1919
|
"expanded": false,
|
|
1922
1920
|
"items": [
|
|
1921
|
+
"accounts[].atwDevices[].displayMode",
|
|
1922
|
+
"accounts[].atwDevices[].hideZone",
|
|
1923
1923
|
"accounts[].atwDevices[].name",
|
|
1924
1924
|
"accounts[].atwDevices[].refreshInterval"
|
|
1925
1925
|
]
|
|
1926
1926
|
},
|
|
1927
1927
|
{
|
|
1928
|
-
"key": "accounts[].atwDevices",
|
|
1928
|
+
"key": "accounts[].atwDevices[]",
|
|
1929
|
+
"title": "Temperature Sensors",
|
|
1929
1930
|
"type": "section",
|
|
1931
|
+
"expandable": true,
|
|
1932
|
+
"expanded": false,
|
|
1933
|
+
"items": [
|
|
1934
|
+
"accounts[].atwDevices[].temperatureSensor",
|
|
1935
|
+
"accounts[].atwDevices[].temperatureSensorFlow",
|
|
1936
|
+
"accounts[].atwDevices[].temperatureSensorReturn",
|
|
1937
|
+
"accounts[].atwDevices[].temperatureSensorFlowZone1",
|
|
1938
|
+
"accounts[].atwDevices[].temperatureSensorReturnZone1",
|
|
1939
|
+
"accounts[].atwDevices[].temperatureSensorFlowWaterTank",
|
|
1940
|
+
"accounts[].atwDevices[].temperatureSensorReturnWaterTank",
|
|
1941
|
+
"accounts[].atwDevices[].temperatureSensorFlowZone2",
|
|
1942
|
+
"accounts[].atwDevices[].temperatureSensorReturnZone2"
|
|
1943
|
+
]
|
|
1944
|
+
},
|
|
1945
|
+
{
|
|
1946
|
+
"key": "accounts[].atwDevices[].presets",
|
|
1930
1947
|
"title": "Presets",
|
|
1948
|
+
"type": "section",
|
|
1931
1949
|
"expandable": true,
|
|
1932
1950
|
"expanded": false,
|
|
1933
1951
|
"items": [
|
|
@@ -1948,27 +1966,9 @@
|
|
|
1948
1966
|
]
|
|
1949
1967
|
},
|
|
1950
1968
|
{
|
|
1951
|
-
"key": "accounts[].atwDevices",
|
|
1952
|
-
"type": "section",
|
|
1953
|
-
"title": "Temperature Sensors",
|
|
1954
|
-
"expandable": true,
|
|
1955
|
-
"expanded": false,
|
|
1956
|
-
"items": [
|
|
1957
|
-
"accounts[].atwDevices[].temperatureSensor",
|
|
1958
|
-
"accounts[].atwDevices[].temperatureSensorFlow",
|
|
1959
|
-
"accounts[].atwDevices[].temperatureSensorReturn",
|
|
1960
|
-
"accounts[].atwDevices[].temperatureSensorFlowZone1",
|
|
1961
|
-
"accounts[].atwDevices[].temperatureSensorReturnZone1",
|
|
1962
|
-
"accounts[].atwDevices[].temperatureSensorFlowWaterTank",
|
|
1963
|
-
"accounts[].atwDevices[].temperatureSensorReturnWaterTank",
|
|
1964
|
-
"accounts[].atwDevices[].temperatureSensorFlowZone2",
|
|
1965
|
-
"accounts[].atwDevices[].temperatureSensorReturnZone2"
|
|
1966
|
-
]
|
|
1967
|
-
},
|
|
1968
|
-
{
|
|
1969
|
-
"key": "accounts[].atwDevices",
|
|
1970
|
-
"type": "section",
|
|
1969
|
+
"key": "accounts[].atwDevices[].buttonsSensors",
|
|
1971
1970
|
"title": "Buttons / Sensors",
|
|
1971
|
+
"type": "section",
|
|
1972
1972
|
"expandable": true,
|
|
1973
1973
|
"expanded": false,
|
|
1974
1974
|
"items": [
|
|
@@ -2018,22 +2018,34 @@
|
|
|
2018
2018
|
"key": "accounts[].ervDevices[].typeString",
|
|
2019
2019
|
"readonly": true
|
|
2020
2020
|
},
|
|
2021
|
-
"accounts[].ervDevices[].displayMode",
|
|
2022
2021
|
{
|
|
2023
2022
|
"key": "accounts[].ervDevices[]",
|
|
2024
|
-
"type": "section",
|
|
2025
2023
|
"title": "Settings",
|
|
2024
|
+
"type": "section",
|
|
2026
2025
|
"expandable": true,
|
|
2027
2026
|
"expanded": false,
|
|
2028
2027
|
"items": [
|
|
2028
|
+
"accounts[].ervDevices[].displayMode",
|
|
2029
2029
|
"accounts[].ervDevices[].name",
|
|
2030
2030
|
"accounts[].ervDevices[].refreshInterval"
|
|
2031
2031
|
]
|
|
2032
2032
|
},
|
|
2033
2033
|
{
|
|
2034
|
-
"key": "accounts[].ervDevices",
|
|
2034
|
+
"key": "accounts[].ervDevices[]",
|
|
2035
|
+
"title": "Temperature Sensors",
|
|
2035
2036
|
"type": "section",
|
|
2037
|
+
"expandable": true,
|
|
2038
|
+
"expanded": false,
|
|
2039
|
+
"items": [
|
|
2040
|
+
"accounts[].ervDevices[].temperatureSensor",
|
|
2041
|
+
"accounts[].ervDevices[].temperatureSensorOutdoor",
|
|
2042
|
+
"accounts[].ervDevices[].temperatureSensorSupply"
|
|
2043
|
+
]
|
|
2044
|
+
},
|
|
2045
|
+
{
|
|
2046
|
+
"key": "accounts[].ervDevices[].presets",
|
|
2036
2047
|
"title": "Presets",
|
|
2048
|
+
"type": "section",
|
|
2037
2049
|
"expandable": true,
|
|
2038
2050
|
"expanded": false,
|
|
2039
2051
|
"items": [
|
|
@@ -2054,21 +2066,9 @@
|
|
|
2054
2066
|
]
|
|
2055
2067
|
},
|
|
2056
2068
|
{
|
|
2057
|
-
"key": "accounts[].ervDevices",
|
|
2058
|
-
"type": "section",
|
|
2059
|
-
"title": "Temperature Sensors",
|
|
2060
|
-
"expandable": true,
|
|
2061
|
-
"expanded": false,
|
|
2062
|
-
"items": [
|
|
2063
|
-
"accounts[].ervDevices[].temperatureSensor",
|
|
2064
|
-
"accounts[].ervDevices[].temperatureSensorOutdoor",
|
|
2065
|
-
"accounts[].ervDevices[].temperatureSensorSupply"
|
|
2066
|
-
]
|
|
2067
|
-
},
|
|
2068
|
-
{
|
|
2069
|
-
"key": "accounts[].ervDevices",
|
|
2070
|
-
"type": "section",
|
|
2069
|
+
"key": "accounts[].ervDevices[].buttonsSensors",
|
|
2071
2070
|
"title": "Buttons / Sensors",
|
|
2071
|
+
"type": "section",
|
|
2072
2072
|
"expandable": true,
|
|
2073
2073
|
"expanded": false,
|
|
2074
2074
|
"items": [
|
package/index.js
CHANGED
|
@@ -48,12 +48,12 @@ class MelCloudPlatform {
|
|
|
48
48
|
|
|
49
49
|
//log config
|
|
50
50
|
const logLevel = {
|
|
51
|
-
devInfo:
|
|
52
|
-
success:
|
|
53
|
-
info:
|
|
54
|
-
warn:
|
|
55
|
-
error:
|
|
56
|
-
debug:
|
|
51
|
+
devInfo: account.log?.deviceInfo,
|
|
52
|
+
success: account.log?.success,
|
|
53
|
+
info: account.log?.info,
|
|
54
|
+
warn: account.log?.warn,
|
|
55
|
+
error: account.log?.error,
|
|
56
|
+
debug: account.log?.debug
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
|
|
@@ -86,7 +86,7 @@ class MelCloudPlatform {
|
|
|
86
86
|
.on('start', async () => {
|
|
87
87
|
try {
|
|
88
88
|
//melcloud account
|
|
89
|
-
const melCloud = new MelCloud(user, passwd, language, accountFile, buildingsFile, devicesFile, logLevel.debug, false)
|
|
89
|
+
const melCloud = new MelCloud(user, passwd, language, accountFile, buildingsFile, devicesFile, logLevel.warn, logLevel.debug, false)
|
|
90
90
|
.on('success', (msg) => logLevel.success && log.success(`${accountName}, ${msg}`))
|
|
91
91
|
.on('info', (msg) => logLevel.info && log.info(`${accountName}, ${msg}`))
|
|
92
92
|
.on('debug', (msg) => logLevel.debug && log.info(`${accountName}, debug: ${msg}`))
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "3.10.0-beta.
|
|
4
|
+
"version": "3.10.0-beta.21",
|
|
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
|
@@ -133,8 +133,8 @@ class DeviceAta extends EventEmitter {
|
|
|
133
133
|
port: this.mqtt.port || 1883,
|
|
134
134
|
clientId: this.mqtt.clientId ? `melcloud_${this.mqtt.clientId}_${Math.random().toString(16).slice(3)}` : `melcloud_${Math.random().toString(16).slice(3)}`,
|
|
135
135
|
prefix: this.mqtt.prefix ? `melcloud/${this.mqtt.prefix}/${this.deviceTypeText}/${this.deviceName}` : `melcloud/${this.deviceTypeText}/${this.deviceName}`,
|
|
136
|
-
user: this.mqtt.auth
|
|
137
|
-
passwd: this.mqtt.auth
|
|
136
|
+
user: this.mqtt.auth?.user,
|
|
137
|
+
passwd: this.mqtt.auth?.passwd,
|
|
138
138
|
debug: this.mqtt.debug || false
|
|
139
139
|
});
|
|
140
140
|
|
|
@@ -315,7 +315,7 @@ class DeviceAta extends EventEmitter {
|
|
|
315
315
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
316
316
|
if (this.logInfo) this.emit('info', `Set power: ${state ? 'ON' : 'OFF'}`);
|
|
317
317
|
} catch (error) {
|
|
318
|
-
this.emit('warn', `Set power error: ${error}`);
|
|
318
|
+
if (this.logWarn) this.emit('warn', `Set power error: ${error}`);
|
|
319
319
|
};
|
|
320
320
|
});
|
|
321
321
|
this.melCloudService.getCharacteristic(Characteristic.CurrentHeaterCoolerState)
|
|
@@ -352,7 +352,7 @@ class DeviceAta extends EventEmitter {
|
|
|
352
352
|
const operationModeText = AirConditioner.DriveMode[deviceData.Device.OperationMode];
|
|
353
353
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
354
354
|
} catch (error) {
|
|
355
|
-
this.emit('warn', `Set operation mode error: ${error}`);
|
|
355
|
+
if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
|
|
356
356
|
};
|
|
357
357
|
});
|
|
358
358
|
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
@@ -400,7 +400,7 @@ class DeviceAta extends EventEmitter {
|
|
|
400
400
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
401
401
|
if (this.logInfo) this.emit('info', `Set fan speed mode: ${AirConditioner.FanSpeed[fanSpeedModeText]}`);
|
|
402
402
|
} catch (error) {
|
|
403
|
-
this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
403
|
+
if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
404
404
|
};
|
|
405
405
|
});
|
|
406
406
|
};
|
|
@@ -419,7 +419,7 @@ class DeviceAta extends EventEmitter {
|
|
|
419
419
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
420
420
|
if (this.logInfo) this.emit('info', `Set air direction mode: ${AirConditioner.AirDirection[value]}`);
|
|
421
421
|
} catch (error) {
|
|
422
|
-
this.emit('warn', `Set vane swing mode error: ${error}`);
|
|
422
|
+
if (this.logWarn) this.emit('warn', `Set vane swing mode error: ${error}`);
|
|
423
423
|
};
|
|
424
424
|
});
|
|
425
425
|
};
|
|
@@ -440,7 +440,7 @@ class DeviceAta extends EventEmitter {
|
|
|
440
440
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
441
441
|
if (this.logInfo) this.emit('info', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
442
442
|
} catch (error) {
|
|
443
|
-
this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
443
|
+
if (this.logWarn) this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
444
444
|
};
|
|
445
445
|
});
|
|
446
446
|
if (modelSupportsHeat) {
|
|
@@ -461,7 +461,7 @@ class DeviceAta extends EventEmitter {
|
|
|
461
461
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
462
462
|
if (this.logInfo) this.emit('info', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
463
463
|
} catch (error) {
|
|
464
|
-
this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
464
|
+
if (this.logWarn) this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
465
465
|
};
|
|
466
466
|
});
|
|
467
467
|
};
|
|
@@ -480,7 +480,7 @@ class DeviceAta extends EventEmitter {
|
|
|
480
480
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
481
481
|
if (this.logInfo) this.emit('info', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
|
|
482
482
|
} catch (error) {
|
|
483
|
-
this.emit('warn', `Set lock physical controls error: ${error}`);
|
|
483
|
+
if (this.logWarn) this.emit('warn', `Set lock physical controls error: ${error}`);
|
|
484
484
|
};
|
|
485
485
|
});
|
|
486
486
|
this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
@@ -495,7 +495,7 @@ class DeviceAta extends EventEmitter {
|
|
|
495
495
|
this.emit('melCloud', 'UseFahrenheit', value);
|
|
496
496
|
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
497
497
|
} catch (error) {
|
|
498
|
-
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
498
|
+
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
499
499
|
};
|
|
500
500
|
});
|
|
501
501
|
accessory.addService(this.melCloudService);
|
|
@@ -547,7 +547,7 @@ class DeviceAta extends EventEmitter {
|
|
|
547
547
|
const operationModeText = AirConditioner.DriveMode[deviceData.Device.OperationMode];
|
|
548
548
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
549
549
|
} catch (error) {
|
|
550
|
-
this.emit('warn', `Set operation mode error: ${error}`);
|
|
550
|
+
if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
|
|
551
551
|
};
|
|
552
552
|
});
|
|
553
553
|
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
@@ -572,7 +572,7 @@ class DeviceAta extends EventEmitter {
|
|
|
572
572
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
573
573
|
if (this.logInfo) this.emit('info', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
574
574
|
} catch (error) {
|
|
575
|
-
this.emit('warn', `Set temperature error: ${error}`);
|
|
575
|
+
if (this.logWarn) this.emit('warn', `Set temperature error: ${error}`);
|
|
576
576
|
};
|
|
577
577
|
});
|
|
578
578
|
this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
@@ -587,7 +587,7 @@ class DeviceAta extends EventEmitter {
|
|
|
587
587
|
this.emit('melCloud', 'UseFahrenheit', value);
|
|
588
588
|
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
589
589
|
} catch (error) {
|
|
590
|
-
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
590
|
+
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
591
591
|
};
|
|
592
592
|
});
|
|
593
593
|
accessory.addService(this.melCloudService);
|
|
@@ -682,7 +682,7 @@ class DeviceAta extends EventEmitter {
|
|
|
682
682
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
683
683
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
684
684
|
} catch (error) {
|
|
685
|
-
this.emit('warn', `Set preset error: ${error}`);
|
|
685
|
+
if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
|
|
686
686
|
};
|
|
687
687
|
});
|
|
688
688
|
this.presetsServices.push(presetService);
|
|
@@ -915,14 +915,14 @@ class DeviceAta extends EventEmitter {
|
|
|
915
915
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
916
916
|
break;
|
|
917
917
|
default:
|
|
918
|
-
this.emit('warn', `Unknown button mode: ${mode}`);
|
|
918
|
+
if (this.logWarn) this.emit('warn', `Unknown button mode: ${mode}`);
|
|
919
919
|
break;
|
|
920
920
|
};
|
|
921
921
|
|
|
922
922
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
923
923
|
if (this.logInfo) this.emit('info', `${state ? `Set: ${name}` : `Unset: ${name}, Set: ${button.previousValue}`}`);
|
|
924
924
|
} catch (error) {
|
|
925
|
-
this.emit('warn', `Set button error: ${error}`);
|
|
925
|
+
if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
|
|
926
926
|
};
|
|
927
927
|
});
|
|
928
928
|
this.buttonsServices.push(buttonService);
|
|
@@ -944,30 +944,29 @@ class DeviceAta extends EventEmitter {
|
|
|
944
944
|
contextKey: this.contextKey,
|
|
945
945
|
devicesFile: this.devicesFile,
|
|
946
946
|
deviceId: this.deviceId,
|
|
947
|
+
logWarn: this.logWarn,
|
|
947
948
|
logDebug: this.logDebug
|
|
948
949
|
})
|
|
949
950
|
.on('deviceInfo', (manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
|
|
950
|
-
if (
|
|
951
|
-
return;
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
if (!this.logDeviceInfo) {
|
|
951
|
+
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
955
952
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
956
953
|
this.emit('devInfo', `Account: ${this.accountName}`);
|
|
957
|
-
|
|
958
|
-
|
|
954
|
+
if (modelIndoor) this.emit('devInfo', `Indoor: ${modelIndoor}`);
|
|
955
|
+
if (modelOutdoor) this.emit('devInfo', `Outdoor: ${modelOutdoor}`);
|
|
959
956
|
this.emit('devInfo', `Serial: ${serialNumber}`);
|
|
960
957
|
this.emit('devInfo', `Firmware: ${firmwareAppVersion}`);
|
|
961
958
|
this.emit('devInfo', `Manufacturer: ${manufacturer}`);
|
|
962
959
|
this.emit('devInfo', '----------------------------------');
|
|
963
|
-
|
|
960
|
+
this.displayDeviceInfo = false;
|
|
961
|
+
}
|
|
964
962
|
|
|
965
963
|
//accessory info
|
|
966
964
|
this.manufacturer = manufacturer;
|
|
967
965
|
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText} ${this.deviceId}`;
|
|
968
966
|
this.serialNumber = serialNumber;
|
|
969
967
|
this.firmwareRevision = firmwareAppVersion;
|
|
970
|
-
|
|
968
|
+
|
|
969
|
+
this.informationService?.setCharacteristic(Characteristic.FirmwareRevision, firmwareAppVersion);
|
|
971
970
|
})
|
|
972
971
|
.on('deviceState', async (deviceData) => {
|
|
973
972
|
this.deviceData = deviceData;
|
|
@@ -1093,7 +1092,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1093
1092
|
obj.targetOperationMode = 2;
|
|
1094
1093
|
break;
|
|
1095
1094
|
default:
|
|
1096
|
-
this.emit('warn', `Unknown operating mode: ${operationMode}`);
|
|
1095
|
+
if (this.logWarn) this.emit('warn', `Unknown operating mode: ${operationMode}`);
|
|
1097
1096
|
return
|
|
1098
1097
|
};
|
|
1099
1098
|
|
|
@@ -1176,7 +1175,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1176
1175
|
obj.targetOperationMode = 2;
|
|
1177
1176
|
break;
|
|
1178
1177
|
default:
|
|
1179
|
-
this.emit('warn', `Unknown operating mode: ${operationMode}`);
|
|
1178
|
+
if (this.logWarn) this.emit('warn', `Unknown operating mode: ${operationMode}`);
|
|
1180
1179
|
break;
|
|
1181
1180
|
};
|
|
1182
1181
|
|
|
@@ -1328,7 +1327,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1328
1327
|
button.state = (prohibitSetTemperature === true);
|
|
1329
1328
|
break;
|
|
1330
1329
|
default: //Unknown button
|
|
1331
|
-
this.emit('warn', `Unknown button mode: ${mode} detected`);
|
|
1330
|
+
if (this.logWarn) this.emit('warn', `Unknown button mode: ${mode} detected`);
|
|
1332
1331
|
break;
|
|
1333
1332
|
};
|
|
1334
1333
|
|
package/src/deviceatw.js
CHANGED
|
@@ -138,8 +138,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
138
138
|
port: this.mqtt.port || 1883,
|
|
139
139
|
clientId: this.mqtt.clientId ? `melcloud_${this.mqtt.clientId}_${Math.random().toString(16).slice(3)}` : `melcloud_${Math.random().toString(16).slice(3)}`,
|
|
140
140
|
prefix: this.mqtt.prefix ? `melcloud/${this.mqtt.prefix}/${this.deviceTypeText}/${this.deviceName}` : `melcloud/${this.deviceTypeText}/${this.deviceName}`,
|
|
141
|
-
user: this.mqtt.auth
|
|
142
|
-
passwd: this.mqtt.auth
|
|
141
|
+
user: this.mqtt.auth?.user,
|
|
142
|
+
passwd: this.mqtt.auth?.passwd,
|
|
143
143
|
debug: this.mqtt.debug || false
|
|
144
144
|
});
|
|
145
145
|
|
|
@@ -348,7 +348,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
348
348
|
break;
|
|
349
349
|
};
|
|
350
350
|
} catch (error) {
|
|
351
|
-
this.emit('warn', `Set power error: ${error}`);
|
|
351
|
+
if (this.logWarn) this.emit('warn', `Set power error: ${error}`);
|
|
352
352
|
};
|
|
353
353
|
});
|
|
354
354
|
melCloudService.getCharacteristic(Characteristic.CurrentHeaterCoolerState)
|
|
@@ -445,7 +445,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
445
445
|
await this.melCloudAtw.send(deviceData);
|
|
446
446
|
if (this.logInfo) this.emit('info', `${zoneName}, Set operation mode: ${operationModeText}`);
|
|
447
447
|
} catch (error) {
|
|
448
|
-
this.emit('warn', `${zoneName}, Set operation mode error: ${error}`);
|
|
448
|
+
if (this.logWarn) this.emit('warn', `${zoneName}, Set operation mode error: ${error}`);
|
|
449
449
|
};
|
|
450
450
|
});
|
|
451
451
|
melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
@@ -518,7 +518,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
518
518
|
const set = i > 0 ? await this.melCloudAtw.send(deviceData) : false;
|
|
519
519
|
const info = this.logInfo || i === 0 ? false : this.emit('info', `${zoneName}, Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
520
520
|
} catch (error) {
|
|
521
|
-
this.emit('warn', `${zoneName}, Set cooling threshold temperature error: ${error}`);
|
|
521
|
+
if (this.logWarn) this.emit('warn', `${zoneName}, Set cooling threshold temperature error: ${error}`);
|
|
522
522
|
};
|
|
523
523
|
});
|
|
524
524
|
};
|
|
@@ -582,7 +582,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
582
582
|
const set = i > 0 ? await this.melCloudAtw.send(deviceData) : false;
|
|
583
583
|
const info = this.logInfo || i === 0 ? false : this.emit('info', `${zoneName}, Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
584
584
|
} catch (error) {
|
|
585
|
-
this.emit('warn', `${zoneName}, Set heating threshold temperature error: ${error}`);
|
|
585
|
+
if (this.logWarn) this.emit('warn', `${zoneName}, Set heating threshold temperature error: ${error}`);
|
|
586
586
|
};
|
|
587
587
|
});
|
|
588
588
|
};
|
|
@@ -618,7 +618,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
618
618
|
await this.melCloudAtw.send(deviceData);
|
|
619
619
|
if (this.logInfo) this.emit('info', `${zoneName}, Set lock physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
|
|
620
620
|
} catch (error) {
|
|
621
|
-
this.emit('warn', `${zoneName}, Set lock physical controls error: ${error}`);
|
|
621
|
+
if (this.logWarn) this.emit('warn', `${zoneName}, Set lock physical controls error: ${error}`);
|
|
622
622
|
};
|
|
623
623
|
});
|
|
624
624
|
melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
@@ -633,7 +633,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
633
633
|
this.emit('melCloud', 'UseFahrenheit', value);
|
|
634
634
|
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
635
635
|
} catch (error) {
|
|
636
|
-
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
636
|
+
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
637
637
|
};
|
|
638
638
|
});
|
|
639
639
|
this.melCloudServices.push(melCloudService);
|
|
@@ -753,7 +753,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
753
753
|
await this.melCloudAtw.send(deviceData);
|
|
754
754
|
if (this.logInfo) this.emit('info', `${zoneName}, Set operation mode: ${operationModeText}`);
|
|
755
755
|
} catch (error) {
|
|
756
|
-
this.emit('warn', `${zoneName}, Set operation mode error: ${error}`);
|
|
756
|
+
if (this.logWarn) this.emit('warn', `${zoneName}, Set operation mode error: ${error}`);
|
|
757
757
|
};
|
|
758
758
|
});
|
|
759
759
|
melCloudServiceT.getCharacteristic(Characteristic.CurrentTemperature)
|
|
@@ -800,7 +800,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
800
800
|
const set = i > 0 ? await this.melCloudAtw.send(deviceData) : false;
|
|
801
801
|
const info = this.logInfo || i === 0 ? false : this.emit('info', `${zoneName}, Set temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
802
802
|
} catch (error) {
|
|
803
|
-
this.emit('warn', `${zoneName}, Set temperature error: ${error}`);
|
|
803
|
+
if (this.logWarn) this.emit('warn', `${zoneName}, Set temperature error: ${error}`);
|
|
804
804
|
};
|
|
805
805
|
});
|
|
806
806
|
melCloudServiceT.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
@@ -815,7 +815,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
815
815
|
this.emit('melCloud', 'UseFahrenheit', value);
|
|
816
816
|
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
817
817
|
} catch (error) {
|
|
818
|
-
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
818
|
+
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
819
819
|
};
|
|
820
820
|
});
|
|
821
821
|
this.melCloudServices.push(melCloudServiceT);
|
|
@@ -1119,7 +1119,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1119
1119
|
await this.melCloudAtw.send(deviceData);
|
|
1120
1120
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
1121
1121
|
} catch (error) {
|
|
1122
|
-
this.emit('warn', `Set preset error: ${error}`);
|
|
1122
|
+
if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
|
|
1123
1123
|
};
|
|
1124
1124
|
});
|
|
1125
1125
|
this.presetsServices.push(presetService);
|
|
@@ -1280,14 +1280,14 @@ class DeviceAtw extends EventEmitter {
|
|
|
1280
1280
|
HeatPump.EffectiveFlags.ProhibitHeatingZone2;
|
|
1281
1281
|
break;
|
|
1282
1282
|
default:
|
|
1283
|
-
this.emit('warn', `Unknown button mode: ${mode}`);
|
|
1283
|
+
if (this.logWarn) this.emit('warn', `Unknown button mode: ${mode}`);
|
|
1284
1284
|
break;
|
|
1285
1285
|
};
|
|
1286
1286
|
|
|
1287
1287
|
await this.melCloudAtw.send(deviceData);
|
|
1288
1288
|
if (this.logInfo) this.emit('info', `${state ? `Set: ${name}` : `Unset: ${name}, Set: ${button.previousValue}`}`);
|
|
1289
1289
|
} catch (error) {
|
|
1290
|
-
this.emit('warn', `Set button error: ${error}`);
|
|
1290
|
+
if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
|
|
1291
1291
|
};
|
|
1292
1292
|
};
|
|
1293
1293
|
});
|
|
@@ -1310,18 +1310,15 @@ class DeviceAtw extends EventEmitter {
|
|
|
1310
1310
|
contextKey: this.contextKey,
|
|
1311
1311
|
devicesFile: this.devicesFile,
|
|
1312
1312
|
deviceId: this.deviceId,
|
|
1313
|
+
logWarn: this.logWarn,
|
|
1313
1314
|
logDebug: this.logDebug
|
|
1314
1315
|
})
|
|
1315
1316
|
.on('deviceInfo', (manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion, hasHotWaterTank, hasZone2) => {
|
|
1316
|
-
if (
|
|
1317
|
-
return;
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
if (!this.logDeviceInfo) {
|
|
1317
|
+
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
1321
1318
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
1322
1319
|
this.emit('devInfo', `Account: ${this.accountName}`);
|
|
1323
|
-
|
|
1324
|
-
|
|
1320
|
+
if (modelIndoor) this.emit('devInfo', `Indoor: ${modelIndoor}`);
|
|
1321
|
+
if (modelOutdoor) this.emit('devInfo', `Outdoor: ${modelOutdoor}`);
|
|
1325
1322
|
this.emit('devInfo', `Serial: ${serialNumber}`)
|
|
1326
1323
|
this.emit('devInfo', `Firmware: ${firmwareAppVersion}`);
|
|
1327
1324
|
this.emit('devInfo', `Manufacturer: ${manufacturer}`);
|
|
@@ -1330,14 +1327,16 @@ class DeviceAtw extends EventEmitter {
|
|
|
1330
1327
|
this.emit('devInfo', `Hot Water Tank: ${hasHotWaterTank ? 'Yes' : 'No'}`);
|
|
1331
1328
|
this.emit('devInfo', `Zone 2: ${hasZone2 ? 'Yes' : 'No'}`);
|
|
1332
1329
|
this.emit('devInfo', '----------------------------------');
|
|
1333
|
-
|
|
1330
|
+
this.displayDeviceInfo = false;
|
|
1331
|
+
}
|
|
1334
1332
|
|
|
1335
1333
|
//accessory info
|
|
1336
1334
|
this.manufacturer = manufacturer;
|
|
1337
1335
|
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText} ${this.deviceId}`;
|
|
1338
1336
|
this.serialNumber = serialNumber;
|
|
1339
1337
|
this.firmwareRevision = firmwareAppVersion;
|
|
1340
|
-
|
|
1338
|
+
|
|
1339
|
+
this.informationService?.setCharacteristic(Characteristic.FirmwareRevision, firmwareAppVersion);
|
|
1341
1340
|
})
|
|
1342
1341
|
.on('deviceState', async (deviceData) => {
|
|
1343
1342
|
this.deviceData = deviceData;
|
|
@@ -1917,7 +1916,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1917
1916
|
button.state = (prohibitZone2 === true);
|
|
1918
1917
|
break;
|
|
1919
1918
|
default: //Unknown button
|
|
1920
|
-
this.emit('warn', `Unknown button mode: ${mode} detected`);
|
|
1919
|
+
if (this.logWarn) this.emit('warn', `Unknown button mode: ${mode} detected`);
|
|
1921
1920
|
break;
|
|
1922
1921
|
};
|
|
1923
1922
|
|
package/src/deviceerv.js
CHANGED
|
@@ -131,8 +131,8 @@ class DeviceErv extends EventEmitter {
|
|
|
131
131
|
port: this.mqtt.port || 1883,
|
|
132
132
|
clientId: this.mqtt.clientId ? `melcloud_${this.mqtt.clientId}_${Math.random().toString(16).slice(3)}` : `melcloud_${Math.random().toString(16).slice(3)}`,
|
|
133
133
|
prefix: this.mqtt.prefix ? `melcloud/${this.mqtt.prefix}/${this.deviceTypeText}/${this.deviceName}` : `melcloud/${this.deviceTypeText}/${this.deviceName}`,
|
|
134
|
-
user: this.mqtt.auth
|
|
135
|
-
passwd: this.mqtt.auth
|
|
134
|
+
user: this.mqtt.auth?.user,
|
|
135
|
+
passwd: this.mqtt.auth?.passwd,
|
|
136
136
|
debug: this.mqtt.debug || false
|
|
137
137
|
});
|
|
138
138
|
|
|
@@ -302,7 +302,7 @@ class DeviceErv extends EventEmitter {
|
|
|
302
302
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
303
303
|
if (this.logInfo) this.emit('info', `Set power: ${state ? 'ON' : 'OFF'}`);
|
|
304
304
|
} catch (error) {
|
|
305
|
-
this.emit('warn', `Set power error: ${error}`);
|
|
305
|
+
if (this.logWarn) this.emit('warn', `Set power error: ${error}`);
|
|
306
306
|
};
|
|
307
307
|
});
|
|
308
308
|
this.melCloudService.getCharacteristic(Characteristic.CurrentHeaterCoolerState)
|
|
@@ -339,7 +339,7 @@ class DeviceErv extends EventEmitter {
|
|
|
339
339
|
const operationModeText = Ventilation.VentilationMode[deviceData.Device.VentilationMode];
|
|
340
340
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
341
341
|
} catch (error) {
|
|
342
|
-
this.emit('warn', `Set operation mode error: ${error}`);
|
|
342
|
+
if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
|
|
343
343
|
};
|
|
344
344
|
});
|
|
345
345
|
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
@@ -382,7 +382,7 @@ class DeviceErv extends EventEmitter {
|
|
|
382
382
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
383
383
|
if (this.logInfo) this.emit('info', `Set fan speed mode: ${Ventilation.FanSpeed[fanSpeedModeText]}`);
|
|
384
384
|
} catch (error) {
|
|
385
|
-
this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
385
|
+
if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
386
386
|
};
|
|
387
387
|
});
|
|
388
388
|
//device can cool
|
|
@@ -404,7 +404,7 @@ class DeviceErv extends EventEmitter {
|
|
|
404
404
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
405
405
|
if (this.logInfo) this.emit('info', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
406
406
|
} catch (error) {
|
|
407
|
-
this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
407
|
+
if (this.logWarn) this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
408
408
|
};
|
|
409
409
|
});
|
|
410
410
|
};
|
|
@@ -427,7 +427,7 @@ class DeviceErv extends EventEmitter {
|
|
|
427
427
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
428
428
|
if (this.logInfo) this.emit('info', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
429
429
|
} catch (error) {
|
|
430
|
-
this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
430
|
+
if (this.logWarn) this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
431
431
|
};
|
|
432
432
|
});
|
|
433
433
|
};
|
|
@@ -445,7 +445,7 @@ class DeviceErv extends EventEmitter {
|
|
|
445
445
|
// await this.melCloudErv.send(deviceData, this.displayMode);
|
|
446
446
|
// if (this.logInfo) this.emit('info', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
|
|
447
447
|
// } catch (error) {
|
|
448
|
-
// this.emit('warn', `Set lock physical controls error: ${error}`);
|
|
448
|
+
// if (this.logWarn) this.emit('warn', `Set lock physical controls error: ${error}`);
|
|
449
449
|
// };
|
|
450
450
|
// });
|
|
451
451
|
this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
@@ -460,7 +460,7 @@ class DeviceErv extends EventEmitter {
|
|
|
460
460
|
this.emit('melCloud', 'UseFahrenheit', value);
|
|
461
461
|
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
462
462
|
} catch (error) {
|
|
463
|
-
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
463
|
+
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
464
464
|
};
|
|
465
465
|
});
|
|
466
466
|
accessory.addService(this.melCloudService);
|
|
@@ -512,7 +512,7 @@ class DeviceErv extends EventEmitter {
|
|
|
512
512
|
const operationModeText = Ventilation.VentilationMode[deviceData.Device.VentilationMode];
|
|
513
513
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
514
514
|
} catch (error) {
|
|
515
|
-
this.emit('warn', `Set operation mode error: ${error}`);
|
|
515
|
+
if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
|
|
516
516
|
};
|
|
517
517
|
});
|
|
518
518
|
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
@@ -537,7 +537,7 @@ class DeviceErv extends EventEmitter {
|
|
|
537
537
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
538
538
|
if (this.logInfo) this.emit('info', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
539
539
|
} catch (error) {
|
|
540
|
-
this.emit('warn', `Set temperature error: ${error}`);
|
|
540
|
+
if (this.logWarn) this.emit('warn', `Set temperature error: ${error}`);
|
|
541
541
|
};
|
|
542
542
|
});
|
|
543
543
|
this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
@@ -552,7 +552,7 @@ class DeviceErv extends EventEmitter {
|
|
|
552
552
|
this.emit('melCloud', 'UseFahrenheit', value);
|
|
553
553
|
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
554
554
|
} catch (error) {
|
|
555
|
-
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
555
|
+
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
556
556
|
};
|
|
557
557
|
});
|
|
558
558
|
accessory.addService(this.melCloudService);
|
|
@@ -729,7 +729,7 @@ class DeviceErv extends EventEmitter {
|
|
|
729
729
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
730
730
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
731
731
|
} catch (error) {
|
|
732
|
-
this.emit('warn', `Set preset error: ${error}`);
|
|
732
|
+
if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
|
|
733
733
|
};
|
|
734
734
|
});
|
|
735
735
|
});
|
|
@@ -836,14 +836,14 @@ class DeviceErv extends EventEmitter {
|
|
|
836
836
|
deviceData.hideOutdoorTemperature = state;
|
|
837
837
|
break;
|
|
838
838
|
default:
|
|
839
|
-
this.emit('warn', `Unknown button mode: ${mode}`);
|
|
839
|
+
if (this.logWarn) this.emit('warn', `Unknown button mode: ${mode}`);
|
|
840
840
|
break;
|
|
841
841
|
};
|
|
842
842
|
|
|
843
843
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
844
844
|
if (this.logInfo) this.emit('info', `${state ? `Set: ${buttonName}` : `Unset: ${buttonName}, Set: ${button.previousValue}`}`);
|
|
845
845
|
} catch (error) {
|
|
846
|
-
this.emit('warn', `Set button error: ${error}`);
|
|
846
|
+
if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
|
|
847
847
|
};
|
|
848
848
|
});
|
|
849
849
|
this.buttonsServices.push(buttonService);
|
|
@@ -865,30 +865,29 @@ class DeviceErv extends EventEmitter {
|
|
|
865
865
|
contextKey: this.contextKey,
|
|
866
866
|
devicesFile: this.devicesFile,
|
|
867
867
|
deviceId: this.deviceId,
|
|
868
|
+
logWarn: this.logWarn,
|
|
868
869
|
logDebug: this.logDebug
|
|
869
870
|
})
|
|
870
871
|
.on('deviceInfo', (manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
|
|
871
|
-
if (
|
|
872
|
-
return;
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
if (!this.logDeviceInfo) {
|
|
872
|
+
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
876
873
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
877
874
|
this.emit('devInfo', `Account: ${this.accountName}`);
|
|
878
|
-
|
|
879
|
-
|
|
875
|
+
if (modelIndoor) this.emit('devInfo', `Indoor: ${modelIndoor}`);
|
|
876
|
+
if (modelOutdoor) this.emit('devInfo', `Outdoor: ${modelOutdoor}`);
|
|
880
877
|
this.emit('devInfo', `Serial: ${serialNumber}`);
|
|
881
878
|
this.emit('devInfo', `Firmware: ${firmwareAppVersion}`);
|
|
882
879
|
this.emit('devInfo', `Manufacturer: ${manufacturer}`);
|
|
883
880
|
this.emit('devInfo', '----------------------------------');
|
|
884
|
-
|
|
881
|
+
this.displayDeviceInfo = false;
|
|
882
|
+
}
|
|
885
883
|
|
|
886
884
|
//accessory info
|
|
887
885
|
this.manufacturer = manufacturer;
|
|
888
886
|
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText} ${this.deviceId}`;
|
|
889
887
|
this.serialNumber = serialNumber;
|
|
890
888
|
this.firmwareRevision = firmwareAppVersion;
|
|
891
|
-
|
|
889
|
+
|
|
890
|
+
this.informationService?.setCharacteristic(Characteristic.FirmwareRevision, firmwareAppVersion);
|
|
892
891
|
})
|
|
893
892
|
.on('deviceState', async (deviceData) => {
|
|
894
893
|
this.deviceData = deviceData;
|
|
@@ -1005,13 +1004,13 @@ class DeviceErv extends EventEmitter {
|
|
|
1005
1004
|
obj.currentOperationMode = 3;
|
|
1006
1005
|
break;
|
|
1007
1006
|
default:
|
|
1008
|
-
this.emit('warn', `Unknown actual ventilation mode: ${actualVentilationMode}`);
|
|
1007
|
+
if (this.logWarn) this.emit('warn', `Unknown actual ventilation mode: ${actualVentilationMode}`);
|
|
1009
1008
|
break;
|
|
1010
1009
|
};
|
|
1011
1010
|
obj.targetOperationMode = 0;
|
|
1012
1011
|
break;
|
|
1013
1012
|
default:
|
|
1014
|
-
this.emit('warn', `Unknown ventilation mode: ${ventilationMode}`);
|
|
1013
|
+
if (this.logWarn) this.emit('warn', `Unknown ventilation mode: ${ventilationMode}`);
|
|
1015
1014
|
break;
|
|
1016
1015
|
};
|
|
1017
1016
|
|
|
@@ -1070,13 +1069,13 @@ class DeviceErv extends EventEmitter {
|
|
|
1070
1069
|
obj.currentOperationMode = 2;
|
|
1071
1070
|
break;
|
|
1072
1071
|
default:
|
|
1073
|
-
this.emit('warn', `Unknown actual ventilation mode: ${actualVentilationMode}`);
|
|
1072
|
+
if (this.logWarn) this.emit('warn', `Unknown actual ventilation mode: ${actualVentilationMode}`);
|
|
1074
1073
|
break;
|
|
1075
1074
|
};
|
|
1076
1075
|
obj.targetOperationMode = 3;
|
|
1077
1076
|
break;
|
|
1078
1077
|
default:
|
|
1079
|
-
this.emit('warn', `Unknown ventilation mode: ${ventilationMode}`);
|
|
1078
|
+
if (this.logWarn) this.emit('warn', `Unknown ventilation mode: ${ventilationMode}`);
|
|
1080
1079
|
break;
|
|
1081
1080
|
};
|
|
1082
1081
|
|
|
@@ -1182,7 +1181,7 @@ class DeviceErv extends EventEmitter {
|
|
|
1182
1181
|
button.state = (hideOutdoorTemperature === true);
|
|
1183
1182
|
break;
|
|
1184
1183
|
default: //Unknown button
|
|
1185
|
-
this.emit('warn', `Unknown button mode: ${mode} detected`);
|
|
1184
|
+
if (this.logWarn) this.emit('warn', `Unknown button mode: ${mode} detected`);
|
|
1186
1185
|
break;
|
|
1187
1186
|
};
|
|
1188
1187
|
|
package/src/melcloud.js
CHANGED
|
@@ -6,11 +6,12 @@ import Functions from './functions.js';
|
|
|
6
6
|
import { ApiUrls } from './constants.js';
|
|
7
7
|
|
|
8
8
|
class MelCloud extends EventEmitter {
|
|
9
|
-
constructor(user, passwd, language, accountFile, buildingsFile, devicesFile, logDebug, requestConfig) {
|
|
9
|
+
constructor(user, passwd, language, accountFile, buildingsFile, devicesFile, logWarn, logDebug, requestConfig) {
|
|
10
10
|
super();
|
|
11
11
|
this.accountFile = accountFile;
|
|
12
12
|
this.buildingsFile = buildingsFile;
|
|
13
13
|
this.devicesFile = devicesFile;
|
|
14
|
+
this.logWarn = logWarn;
|
|
14
15
|
this.logDebug = logDebug;
|
|
15
16
|
this.requestConfig = requestConfig;
|
|
16
17
|
this.devicesId = [];
|
|
@@ -67,7 +68,7 @@ class MelCloud extends EventEmitter {
|
|
|
67
68
|
if (this.logDebug) this.emit('debug', `Buildings: ${JSON.stringify(buildingsList, null, 2)}`);
|
|
68
69
|
|
|
69
70
|
if (!buildingsList) {
|
|
70
|
-
this.emit('warn', `No building found`);
|
|
71
|
+
if (this.logWarn) this.emit('warn', `No building found`);
|
|
71
72
|
return null;
|
|
72
73
|
}
|
|
73
74
|
|
|
@@ -90,7 +91,7 @@ class MelCloud extends EventEmitter {
|
|
|
90
91
|
|
|
91
92
|
const devicesCount = devices.length;
|
|
92
93
|
if (devicesCount === 0) {
|
|
93
|
-
this.emit('warn', `No devices found`);
|
|
94
|
+
if (this.logWarn) this.emit('warn', `No devices found`);
|
|
94
95
|
return null;
|
|
95
96
|
}
|
|
96
97
|
|
|
@@ -132,7 +133,7 @@ class MelCloud extends EventEmitter {
|
|
|
132
133
|
if (this.logDebug) this.emit('debug', `MELCloud Info: ${JSON.stringify(debugData, null, 2)}`);
|
|
133
134
|
|
|
134
135
|
if (!contextKey) {
|
|
135
|
-
this.emit('warn', `Context key missing`);
|
|
136
|
+
if (this.logWarn) this.emit('warn', `Context key missing`);
|
|
136
137
|
return null;
|
|
137
138
|
}
|
|
138
139
|
|
package/src/melcloudata.js
CHANGED
|
@@ -10,6 +10,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
10
10
|
super();
|
|
11
11
|
this.devicesFile = config.devicesFile;
|
|
12
12
|
this.deviceId = config.deviceId;
|
|
13
|
+
this.logWarn = config.logWarn;
|
|
13
14
|
this.logDebug = config.logDebug;
|
|
14
15
|
this.functions = new Functions();
|
|
15
16
|
|
|
@@ -64,7 +65,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
64
65
|
const devicesData = JSON.parse(data);
|
|
65
66
|
|
|
66
67
|
if (!Array.isArray(devicesData)) {
|
|
67
|
-
this.emit('warn', `Device data not found`);
|
|
68
|
+
if (this.logWarn) this.emit('warn', `Device data not found`);
|
|
68
69
|
return null;
|
|
69
70
|
}
|
|
70
71
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
|
@@ -323,7 +324,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
323
324
|
|
|
324
325
|
//display info if units are not configured in MELCloud service
|
|
325
326
|
if (unitsCount === 0) {
|
|
326
|
-
this.emit('warn', `Units are not configured in MELCloud service`);
|
|
327
|
+
if (this.logWarn) this.emit('warn', `Units are not configured in MELCloud service`);
|
|
327
328
|
};
|
|
328
329
|
|
|
329
330
|
const deviceState = {
|
package/src/melcloudatw.js
CHANGED
|
@@ -10,6 +10,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
10
10
|
super();
|
|
11
11
|
this.devicesFile = config.devicesFile;
|
|
12
12
|
this.deviceId = config.deviceId;
|
|
13
|
+
this.logWarn = config.logWarn;
|
|
13
14
|
this.logDebug = config.logDebug;
|
|
14
15
|
this.functions = new Functions();
|
|
15
16
|
|
|
@@ -64,7 +65,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
64
65
|
const devicesData = JSON.parse(data);
|
|
65
66
|
|
|
66
67
|
if (!Array.isArray(devicesData)) {
|
|
67
|
-
this.emit('warn', `Device data not found`);
|
|
68
|
+
if (this.logWarn) this.emit('warn', `Device data not found`);
|
|
68
69
|
return null;
|
|
69
70
|
}
|
|
70
71
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
package/src/melclouderv.js
CHANGED
|
@@ -10,6 +10,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
10
10
|
super();
|
|
11
11
|
this.devicesFile = config.devicesFile;
|
|
12
12
|
this.deviceId = config.deviceId;
|
|
13
|
+
this.logWarn = config.logWarn;
|
|
13
14
|
this.logDebug = config.logDebug;
|
|
14
15
|
this.functions = new Functions();
|
|
15
16
|
|
|
@@ -64,7 +65,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
64
65
|
const devicesData = JSON.parse(data);
|
|
65
66
|
|
|
66
67
|
if (!Array.isArray(devicesData)) {
|
|
67
|
-
this.emit('warn', `Device data not found`);
|
|
68
|
+
if (this.logWarn) this.emit('warn', `Device data not found`);
|
|
68
69
|
return null;
|
|
69
70
|
}
|
|
70
71
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|