homebridge-tasmota-control 1.6.15-beta.4 → 1.6.15-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -519,7 +519,7 @@
519
519
  "title": "Mode",
520
520
  "type": "integer",
521
521
  "minimum": 0,
522
- "maximum": 53,
522
+ "maximum": 60,
523
523
  "default": 0,
524
524
  "description": "Here select function.",
525
525
  "oneOf": [
@@ -559,12 +559,6 @@
559
559
  5
560
560
  ]
561
561
  },
562
- {
563
- "title": "MODE PURIFY (not implemented)",
564
- "enum": [
565
- 6
566
- ]
567
- },
568
562
  {
569
563
  "title": "VANE H LEFT",
570
564
  "enum": [
@@ -732,6 +726,12 @@
732
726
  "enum": [
733
727
  53
734
728
  ]
729
+ },
730
+ {
731
+ "title": "PURIFY (not implemented)",
732
+ "enum": [
733
+ 60
734
+ ]
735
735
  }
736
736
  ],
737
737
  "required": false
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Tasmota Control",
3
3
  "name": "homebridge-tasmota-control",
4
- "version": "1.6.15-beta.4",
4
+ "version": "1.6.15-beta.6",
5
5
  "description": "Homebridge plugin to control Tasmota flashed devices.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/constants.js CHANGED
@@ -34,7 +34,6 @@ export const MiElHVAC = {
34
34
  "cool": "HVACSetMode%20cool",
35
35
  "fan": "HVACSetMode%20fan",
36
36
  "auto": "HVACSetMode%20auto",
37
- "purify": "HVACSetMode%20purify"
38
37
  },
39
38
  "SetFanSpeed": {
40
39
  "auto": "HVACSetFanSpeed%20auto",
@@ -64,9 +63,9 @@ export const MiElHVAC = {
64
63
  "swing": "HVACSetSwingH%20swing",
65
64
  },
66
65
  "SetAirDirection": {
67
- "even": "HVACSetSwingH%20even",
68
66
  "indirect": "HVACSetSwingH%20indirect",
69
67
  "direct": "HVACSetSwingH%20direct",
68
+ "even": "HVACSetSwingH%20even",
70
69
  "off": "HVACSetSwingH%20off"
71
70
  },
72
71
  "SetProhibit": {
@@ -83,6 +82,9 @@ export const MiElHVAC = {
83
82
  "c": "HVACSetDisplayUnit%20c",
84
83
  "f": "HVACSetDisplayUnit%20f"
85
84
  },
85
+ "SetPurify": {
86
+ "purify": "HVACSetPurify%20purify"
87
+ },
86
88
  "RemoteTemp": "HVACRemoteTemp%20",
87
89
  "RemoteTempClearTime": "HVACRemoteTempClearTime%20",
88
90
  "OperationMode": [
package/src/mielhvac.js CHANGED
@@ -217,6 +217,7 @@ class MiElHvac extends EventEmitter {
217
217
  const vaneVerticalDirection = miElHvac.SwingV ?? 'Unknown';
218
218
  const vaneHorizontalDirection = miElHvac.SwingH ?? 'Unknown';
219
219
  const prohibit = miElHvac.Prohibit ?? 'Unknown';
220
+ const purify = miElHvac.Purify ?? 'Unknown';
220
221
  const airDirection = miElHvac.AirDirection ?? 'Unknown';
221
222
  const compressor = miElHvac.Compressor ?? 'Unknown';
222
223
  const compressorFrequency = miElHvac.CompressorFrequency ?? 0;
@@ -256,6 +257,7 @@ class MiElHvac extends EventEmitter {
256
257
  vaneVerticalDirection: vaneVerticalDirection,
257
258
  vaneHorizontalDirection: vaneHorizontalDirection,
258
259
  prohibit: prohibit,
260
+ purify: purify,
259
261
  airDirection: airDirection,
260
262
  swingMode: swingMode,
261
263
  compressor: compressor,
@@ -366,17 +368,14 @@ class MiElHvac extends EventEmitter {
366
368
  obj.fanSpeed = hasAutomaticFanSpeed ? [3, 1, 2][fanIndex] ?? 1 : [0, 1, 2][fanIndex] ?? 1;
367
369
  obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 3 : 2;
368
370
  break;
369
-
370
371
  case 3:
371
372
  obj.fanSpeed = hasAutomaticFanSpeed ? [4, 1, 2, 3][fanIndex] ?? 1 : [0, 1, 2, 3][fanIndex] ?? 1;
372
373
  obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 4 : 3;
373
374
  break;
374
-
375
375
  case 4:
376
376
  obj.fanSpeed = hasAutomaticFanSpeed ? [5, 1, 2, 3, 4][fanIndex] ?? 1 : [0, 1, 2, 3, 4][fanIndex] ?? 1;
377
377
  obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 5 : 4;
378
378
  break;
379
-
380
379
  case 5:
381
380
  obj.fanSpeed = hasAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][fanIndex] ?? 1 : [0, 1, 2, 3, 4, 5][fanIndex] ?? 1;
382
381
  obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 6 : 5;
@@ -468,7 +467,6 @@ class MiElHvac extends EventEmitter {
468
467
  3: () => power && ['cool', 'cool_isee'].includes(operationMode),
469
468
  4: () => power && operationMode === 'fan',
470
469
  5: () => power && operationMode === 'auto',
471
- 6: () => power && operationMode === 'purify',
472
470
  };
473
471
 
474
472
  const vaneHMap = {
@@ -514,6 +512,10 @@ class MiElHvac extends EventEmitter {
514
512
  53: 'temp',
515
513
  };
516
514
 
515
+ const purifyMap = {
516
+ 60: () => power && purify === 'on',
517
+ };
518
+
517
519
  this.buttonsConfigured.forEach((button, index) => {
518
520
  const mode = button.mode;
519
521
  let state = false;
@@ -530,6 +532,8 @@ class MiElHvac extends EventEmitter {
530
532
  state = airDirMap[mode]();
531
533
  } else if (prohibitMap[mode] !== undefined) {
532
534
  state = prohibit === prohibitMap[mode];
535
+ } else if (purifyMap[mode] !== undefined) {
536
+ state = purify === purifyMap[mode];
533
537
  } else {
534
538
  this.emit('warn', `Unknown button mode: ${mode} detected`);
535
539
  }
@@ -1044,58 +1048,55 @@ class MiElHvac extends EventEmitter {
1044
1048
  0: () => state ? MiElHVAC.PowerOn : MiElHVAC.PowerOff,
1045
1049
 
1046
1050
  // Modes
1047
- 1: () => getModeCommand('heat'),
1048
- 2: () => getModeCommand('dry'),
1049
- 3: () => getModeCommand('cool'),
1050
- 4: () => getModeCommand('fan'),
1051
- 5: () => getModeCommand('auto'),
1052
- 6: () => getModeCommand('purify'),
1051
+ 1: () => getCommand('SetMode', 'heat'),
1052
+ 2: () => getCommand('SetMode', 'dry'),
1053
+ 3: () => getCommand('SetMode', 'cool'),
1054
+ 4: () => getCommand('SetMode', 'fan'),
1055
+ 5: () => getCommand('SetMode', 'auto'),
1053
1056
 
1054
1057
  // Horizontal Swing
1055
- 11: () => getSwingCommand('SetSwingH', 'left'),
1056
- 12: () => getSwingCommand('SetSwingH', 'left_middle'),
1057
- 13: () => getSwingCommand('SetSwingH', 'center'),
1058
- 14: () => getSwingCommand('SetSwingH', 'right_middle'),
1059
- 15: () => getSwingCommand('SetSwingH', 'right'),
1060
- 16: () => getSwingCommand('SetSwingH', 'split'),
1061
- 17: () => getSwingCommand('SetSwingH', 'swing'),
1058
+ 11: () => getCommand('SetSwingH', 'left'),
1059
+ 12: () => getCommand('SetSwingH', 'left_middle'),
1060
+ 13: () => getCommand('SetSwingH', 'center'),
1061
+ 14: () => getCommand('SetSwingH', 'right_middle'),
1062
+ 15: () => getCommand('SetSwingH', 'right'),
1063
+ 16: () => getCommand('SetSwingH', 'split'),
1064
+ 17: () => getCommand('SetSwingH', 'swing'),
1062
1065
 
1063
1066
  // Vertical Swing
1064
- 20: () => getSwingCommand('SetSwingV', 'auto'),
1065
- 21: () => getSwingCommand('SetSwingV', 'up'),
1066
- 22: () => getSwingCommand('SetSwingV', 'up_middle'),
1067
- 23: () => getSwingCommand('SetSwingV', 'center'),
1068
- 24: () => getSwingCommand('SetSwingV', 'down_middle'),
1069
- 25: () => getSwingCommand('SetSwingV', 'down'),
1070
- 26: () => getSwingCommand('SetSwingV', 'swing'),
1067
+ 20: () => getCommand('SetSwingV', 'auto'),
1068
+ 21: () => getCommand('SetSwingV', 'up'),
1069
+ 22: () => getCommand('SetSwingV', 'up_middle'),
1070
+ 23: () => getCommand('SetSwingV', 'center'),
1071
+ 24: () => getCommand('SetSwingV', 'down_middle'),
1072
+ 25: () => getCommand('SetSwingV', 'down'),
1073
+ 26: () => getCommand('SetSwingV', 'swing'),
1071
1074
 
1072
1075
  // Fan Speeds
1073
- 30: () => getSwingCommand('SetFanSpeed', 'auto'),
1074
- 31: () => getSwingCommand('SetFanSpeed', 'quiet'),
1075
- 32: () => getSwingCommand('SetFanSpeed', '1'),
1076
- 33: () => getSwingCommand('SetFanSpeed', '2'),
1077
- 34: () => getSwingCommand('SetFanSpeed', '3'),
1078
- 35: () => getSwingCommand('SetFanSpeed', '4'),
1076
+ 30: () => getCommand('SetFanSpeed', 'auto'),
1077
+ 31: () => getCommand('SetFanSpeed', 'quiet'),
1078
+ 32: () => getCommand('SetFanSpeed', '1'),
1079
+ 33: () => getCommand('SetFanSpeed', '2'),
1080
+ 34: () => getCommand('SetFanSpeed', '3'),
1081
+ 35: () => getCommand('SetFanSpeed', '4'),
1079
1082
 
1080
1083
  // Air Direction
1081
- 40: () => getSwingCommand('SetAirDirection', 'indirect'),
1082
- 41: () => getSwingCommand('SetAirDirection', 'direct'),
1083
- 42: () => getSwingCommand('SetAirDirection', 'even'),
1084
- 43: () => getSwingCommand('SetAirDirection', 'off'),
1084
+ 40: () => getCommand('SetAirDirection', 'indirect'),
1085
+ 41: () => getCommand('SetAirDirection', 'direct'),
1086
+ 42: () => getCommand('SetAirDirection', 'even'),
1087
+ 43: () => getCommand('SetAirDirection', 'off'),
1085
1088
 
1086
1089
  // Prohibit
1087
- 50: () => getSwingCommand('SetProhibit', 'all'),
1088
- 51: () => getSwingCommand('SetProhibit', 'power'),
1089
- 52: () => getSwingCommand('SetProhibit', 'mode'),
1090
- 53: () => getSwingCommand('SetProhibit', 'temp')
1091
- };
1090
+ 50: () => getCommand('SetProhibit', 'all'),
1091
+ 51: () => getCommand('SetProhibit', 'power'),
1092
+ 52: () => getCommand('SetProhibit', 'mode'),
1093
+ 53: () => getCommand('SetProhibit', 'temp'),
1092
1094
 
1093
- const getModeCommand = (target) => {
1094
- button.previousValue = state ? MiElHVAC.SetMode[this.mielHvac.operationMode] : button.previousValue;
1095
- return state ? MiElHVAC.SetMode[target] : button.previousValue;
1095
+ // Purify
1096
+ 60: () => getCommand('SetPurify', 'purify'),
1096
1097
  };
1097
1098
 
1098
- const getSwingCommand = (type, target) => {
1099
+ const getCommand = (type, target) => {
1099
1100
  const current = this.mielHvac[getCurrentKey(type)];
1100
1101
  button.previousValue = state ? MiElHVAC[type][current] : button.previousValue;
1101
1102
  return state ? MiElHVAC[type][target] : button.previousValue;
@@ -1103,11 +1104,13 @@ class MiElHvac extends EventEmitter {
1103
1104
 
1104
1105
  const getCurrentKey = (type) => {
1105
1106
  switch (type) {
1107
+ case 'SetMode': return 'operationMode';
1106
1108
  case 'SetSwingH': return 'vaneHorizontalDirection';
1107
1109
  case 'SetSwingV': return 'vaneVerticalDirection';
1108
1110
  case 'SetFanSpeed': return 'fanSpeed';
1109
1111
  case 'SetAirDirection': return 'airDirection';
1110
1112
  case 'SetProhibit': return 'prohibit';
1113
+ case 'SetPurify': return 'purify';
1111
1114
  default: return '';
1112
1115
  }
1113
1116
  };
@@ -1118,7 +1121,7 @@ class MiElHvac extends EventEmitter {
1118
1121
  }
1119
1122
 
1120
1123
  data = mappings[mode]();
1121
- if (!this.mielHvac.power && state && mode > 0 && mode < 50) {
1124
+ if (!this.mielHvac.power && state && mode > 0 && mode <= 60) {
1122
1125
  await this.axiosInstance(MiElHVAC.PowerOn);
1123
1126
  }
1124
1127