homebridge-tasmota-control 1.6.15-beta.29 → 1.6.15-beta.30

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Tasmota Control",
3
3
  "name": "homebridge-tasmota-control",
4
- "version": "1.6.15-beta.29",
4
+ "version": "1.6.15-beta.30",
5
5
  "description": "Homebridge plugin to control Tasmota flashed devices.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/deviceinfo.js CHANGED
@@ -11,7 +11,6 @@ class DeviceInfo extends EventEmitter {
11
11
 
12
12
  //axios instance
13
13
  this.axiosInstance = axios.create({
14
- method: 'GET',
15
14
  baseURL: url,
16
15
  timeout: 10000,
17
16
  withCredentials: auth,
@@ -26,7 +25,7 @@ class DeviceInfo extends EventEmitter {
26
25
  async getInfo() {
27
26
  if (this.enableDebugMode) this.emit('debug', `Requesting info`);
28
27
  try {
29
- const deviceInfoData = await this.axiosInstance(ApiCommands.Status);
28
+ const deviceInfoData = await this.axiosInstance.get(ApiCommands.Status);
30
29
  const deviceInfo = deviceInfoData.data ?? {};
31
30
  if (this.enableDebugMode) this.emit('debug', `Info: ${JSON.stringify(deviceInfo, null, 2)}`);
32
31
  await new Promise(resolve => setTimeout(resolve, 250));
package/src/fans.js CHANGED
@@ -31,9 +31,8 @@ class Fans extends EventEmitter {
31
31
  //axios instance
32
32
  const url = `http://${config.host}/cm?cmnd=`;
33
33
  this.axiosInstance = axios.create({
34
- method: 'GET',
35
34
  baseURL: url,
36
- timeout: 6000,
35
+ timeout: 10000,
37
36
  withCredentials: config.auth,
38
37
  auth: {
39
38
  username: config.user,
@@ -65,13 +64,13 @@ class Fans extends EventEmitter {
65
64
  if (this.enableDebugMode) this.emit('debug', `Requesting status`);
66
65
  try {
67
66
  //power status
68
- const powerStatusData = await this.axiosInstance(ApiCommands.PowerStatus);
67
+ const powerStatusData = await this.axiosInstance.get(ApiCommands.PowerStatus);
69
68
  const powerStatus = powerStatusData.data ?? {};
70
69
  const powerStatusKeys = Object.keys(powerStatus);
71
70
  if (this.enableDebugMode) this.emit('debug', `Power status: ${JSON.stringify(powerStatus, null, 2)}`);
72
71
 
73
72
  //sensor status
74
- const sensorStatusData = await this.axiosInstance(ApiCommands.Status);
73
+ const sensorStatusData = await this.axiosInstance.get(ApiCommands.Status);
75
74
  const sensorStatus = sensorStatusData.data ?? {};
76
75
  if (this.enableDebugMode) this.emit('debug', `Sensors status: ${JSON.stringify(sensorStatus, null, 2)}`);
77
76
 
@@ -236,7 +235,7 @@ class Fans extends EventEmitter {
236
235
  try {
237
236
  state = state ? 1 : 0;
238
237
  const speed = `${ApiCommands.FanSpeed}${state}`;
239
- await this.axiosInstance(speed);
238
+ await this.axiosInstance.get(speed);
240
239
  if (!this.disableLogInfo) this.emit('info', `${friendlyName}, set state: ${state ? 'ON' : 'OFF'}`);
241
240
  } catch (error) {
242
241
  this.emit('warn', `${friendlyName}, set state error: ${error}`);
@@ -250,7 +249,7 @@ class Fans extends EventEmitter {
250
249
  // .onSet(async (value) => {
251
250
  // try {
252
251
  // const direction = `${ApiCommands.FanDirection}${value}`;
253
- // await this.axiosInstance(direction);
252
+ // await this.axiosInstance.get(direction);
254
253
  // if (!this.disableLogInfo) this.emit('info', `${friendlyName}, set direction: ${value}`);
255
254
  // } catch (error) {
256
255
  // this.emit('warn', `${friendlyName}, set direction error: ${error}`);
@@ -269,7 +268,7 @@ class Fans extends EventEmitter {
269
268
  .onSet(async (value) => {
270
269
  try {
271
270
  const speed = `${ApiCommands.FanSpeed}${value}`;
272
- await this.axiosInstance(speed);
271
+ await this.axiosInstance.get(speed);
273
272
  if (!this.disableLogInfo) this.emit('info', `${friendlyName}, set speed: ${value}`);
274
273
  } catch (error) {
275
274
  this.emit('warn', `${friendlyName}, set rotation speed error: ${error}`);
@@ -299,7 +298,7 @@ class Fans extends EventEmitter {
299
298
  const powerOn = this.lights.length === 1 ? (this.lights[i].power1 ? `${ApiCommands.Power}${relayNr}${ApiCommands.On}` : ApiCommands.PowerOn) : `${ApiCommands.Power}${relayNr}${ApiCommands.On}`;
300
299
  const powerOff = this.lights.length === 1 ? (this.lights[i].power1 ? `${ApiCommands.Power}${relayNr}${ApiCommands.Off}` : ApiCommands.PowerOff) : `${ApiCommands.Power}${relayNr}${ApiCommands.Off}`;
301
300
  state = state ? powerOn : powerOff;
302
- await this.axiosInstance(state);
301
+ await this.axiosInstance.get(state);
303
302
  if (!this.disableLogInfo) this.emit('info', `${friendlyName}, set state: ${state ? 'ON' : 'OFF'}`);
304
303
  } catch (error) {
305
304
  this.emit('warn', `${friendlyName}, set state error: ${error}`);
package/src/lights.js CHANGED
@@ -30,9 +30,8 @@ class Lights extends EventEmitter {
30
30
  //axios instance
31
31
  const url = `http://${config.host}/cm?cmnd=`;
32
32
  this.axiosInstance = axios.create({
33
- method: 'GET',
34
33
  baseURL: url,
35
- timeout: 6000,
34
+ timeout: 10000,
36
35
  withCredentials: config.auth,
37
36
  auth: {
38
37
  username: config.user,
@@ -251,7 +250,7 @@ class Lights extends EventEmitter {
251
250
  const powerOff = this.lights.length === 1 ? ApiCommands.PowerOff : `${ApiCommands.Power}${relayNr}${ApiCommands.Off}`;
252
251
  state = state ? powerOn : powerOff;
253
252
 
254
- await this.axiosInstance(state);
253
+ await this.axiosInstance.get(state);
255
254
  if (!this.disableLogInfo) this.emit('info', `${friendlyName}, set state: ${state ? 'ON' : 'OFF'}`);
256
255
  } catch (error) {
257
256
  this.emit('warn', `${friendlyName}, set state error: ${error}`);
@@ -266,7 +265,7 @@ class Lights extends EventEmitter {
266
265
  .onSet(async (value) => {
267
266
  try {
268
267
  const brightness = ['', `${ApiCommands.Dimmer}${value}`, `${ApiCommands.HSBBrightness}${value}`][this.lights[i].brightnessType]; //0..100
269
- await this.axiosInstance(brightness);
268
+ await this.axiosInstance.get(brightness);
270
269
  if (!this.disableLogInfo) this.emit('info', `${friendlyName}, set brightness: ${value} %`);
271
270
  } catch (error) {
272
271
  this.emit('warn', `set brightness error: ${error}`);
@@ -283,7 +282,7 @@ class Lights extends EventEmitter {
283
282
  try {
284
283
  value = await this.scaleValue(value, 140, 500, 153, 500);
285
284
  const colorTemperature = `${ApiCommands.ColorTemperature}${value}`; //153..500
286
- await this.axiosInstance(colorTemperature);
285
+ await this.axiosInstance.get(colorTemperature);
287
286
  if (!this.disableLogInfo) this.emit('info', `${friendlyName}, set color temperatur: ${value}`);
288
287
  } catch (error) {
289
288
  this.emit('warn', `set color temperatur error: ${error}`);
@@ -299,7 +298,7 @@ class Lights extends EventEmitter {
299
298
  .onSet(async (value) => {
300
299
  try {
301
300
  const hue = `${ApiCommands.HSBHue}${value}`; //0..360
302
- await this.axiosInstance(hue);
301
+ await this.axiosInstance.get(hue);
303
302
  if (!this.disableLogInfo) this.emit('info', `${friendlyName}, set hue: ${value}`);
304
303
  } catch (error) {
305
304
  this.emit('warn', `set hue error: ${error}`);
@@ -315,7 +314,7 @@ class Lights extends EventEmitter {
315
314
  .onSet(async (value) => {
316
315
  try {
317
316
  const saturation = `${ApiCommands.HSBSaturation}${value}`; //0..100
318
- await this.axiosInstance(saturation);
317
+ await this.axiosInstance.get(saturation);
319
318
  if (!this.disableLogInfo) this.emit('info', `set saturation: ${value}`);
320
319
  } catch (error) {
321
320
  this.emit('warn', `set saturation error: ${error}`);
package/src/mielhvac.js CHANGED
@@ -122,9 +122,8 @@ class MiElHvac extends EventEmitter {
122
122
  //axios instance
123
123
  const url = `http://${config.host}/cm?cmnd=`;
124
124
  this.axiosInstance = axios.create({
125
- method: 'GET',
126
125
  baseURL: url,
127
- timeout: 6000,
126
+ timeout: 10000,
128
127
  withCredentials: config.auth,
129
128
  auth: {
130
129
  username: config.user,
@@ -134,11 +133,9 @@ class MiElHvac extends EventEmitter {
134
133
 
135
134
  //axios instance remote temp
136
135
  if (remoteTemperatureSensorEnable) {
137
- const path = remoteTemperatureSensorPath;
138
136
  this.axiosInstanceRemoteTemp = axios.create({
139
- method: 'GET',
140
- baseURL: path,
141
- timeout: remoteTemperatureSensorRefreshInterval > 10000 ? 10000 : remoteTemperatureSensorRefreshInterval,
137
+ baseURL: remoteTemperatureSensorPath,
138
+ timeout: 10000,
142
139
  withCredentials: remoteTemperatureSensorAuth,
143
140
  auth: {
144
141
  username: remoteTemperatureSensorUser,
@@ -183,12 +180,12 @@ class MiElHvac extends EventEmitter {
183
180
  if (this.enableDebugMode) this.emit('debug', `Requesting status`);
184
181
  try {
185
182
  //power status
186
- const powerStatusData = await this.axiosInstance(ApiCommands.PowerStatus);
183
+ const powerStatusData = await this.axiosInstance.get(ApiCommands.PowerStatus);
187
184
  const powerStatus = powerStatusData.data ?? {};
188
185
  if (this.enableDebugMode) this.emit('debug', `Power status: ${JSON.stringify(powerStatus, null, 2)}`);
189
186
 
190
187
  //sensor status
191
- const sensorStatusData = await this.axiosInstance(ApiCommands.Status);
188
+ const sensorStatusData = await this.axiosInstance.get(ApiCommands.Status);
192
189
  const sensorStatus = sensorStatusData.data ?? {};
193
190
  if (this.enableDebugMode) this.emit('debug', `Sensors status: ${JSON.stringify(sensorStatus, null, 2)}`);
194
191
 
@@ -710,13 +707,13 @@ class MiElHvac extends EventEmitter {
710
707
  async updateRemoteTemp() {
711
708
  try {
712
709
  //get remote temp
713
- const rmoteTempData = await this.axiosInstanceRemoteTemp();
710
+ const rmoteTempData = await this.axiosInstanceRemoteTemp.get();
714
711
  const remoteTemp = rmoteTempData.data ?? false;
715
712
  if (this.enableDebugMode) this.emit('debug', `Remote temp: ${JSON.stringify(remoteTemp, null, 2)}`);
716
713
 
717
714
  //set remote temp
718
715
  const temp = `${MiElHVAC.SetRemoteTemp}${remoteTemp}`
719
- await this.axiosInstance(temp);
716
+ await this.axiosInstance.get(temp);
720
717
 
721
718
  return true
722
719
  } catch (error) {
@@ -807,7 +804,7 @@ class MiElHvac extends EventEmitter {
807
804
  .onSet(async (state) => {
808
805
  try {
809
806
  const power = [MiElHVAC.PowerOff, MiElHVAC.PowerOn][state];
810
- await this.axiosInstance(power);
807
+ await this.axiosInstance.get(power);
811
808
  if (!this.disableLogInfo) this.emit('info', `Set power: ${state ? 'ON' : 'OFF'}`);
812
809
  } catch (error) {
813
810
  this.emit('warn', `Set power error: ${error}`);
@@ -832,13 +829,13 @@ class MiElHvac extends EventEmitter {
832
829
  try {
833
830
  switch (value) {
834
831
  case 0: //AUTO
835
- await this.axiosInstance(autoDryFanMode);
832
+ await this.axiosInstance.get(autoDryFanMode);
836
833
  break;
837
834
  case 1: //HEAT
838
- await this.axiosInstance(heatDryFanMode);
835
+ await this.axiosInstance.get(heatDryFanMode);
839
836
  break;
840
837
  case 2: //COOL
841
- await this.axiosInstance(coolDryFanMode);
838
+ await this.axiosInstance.get(coolDryFanMode);
842
839
  break;
843
840
  };
844
841
 
@@ -888,7 +885,7 @@ class MiElHvac extends EventEmitter {
888
885
 
889
886
  //fan speed mode
890
887
  const fanSpeedMap = ['auto', 'quiet', '1', '2', '3', '4'][fanSpeed];
891
- await this.axiosInstance(MiElHVAC.SetFanSpeed[fanSpeedMap]);
888
+ await this.axiosInstance.get(MiElHVAC.SetFanSpeed[fanSpeedMap]);
892
889
  if (!this.disableLogInfo) this.emit('info', `Set fan speed mode: ${MiElHVAC.FanSpeed[fanSpeedModeText]}`);
893
890
  } catch (error) {
894
891
  this.emit('warn', `Set fan speed mode error: ${error}`);
@@ -905,17 +902,17 @@ class MiElHvac extends EventEmitter {
905
902
  try {
906
903
  switch (value) {
907
904
  case 0:
908
- await this.axiosInstance(MiElHVAC.SetSwingV[this.previousStateSwingV]);
909
- await this.axiosInstance(MiElHVAC.SetSwingH[this.previousStateSwingH]);
905
+ await this.axiosInstance.get(MiElHVAC.SetSwingV[this.previousStateSwingV]);
906
+ await this.axiosInstance.get(MiElHVAC.SetSwingH[this.previousStateSwingH]);
910
907
  break;
911
908
  case 1:
912
909
  //set vane v
913
910
  this.previousStateSwingV = this.mielHvac.vaneVerticalDirection;
914
- await this.axiosInstance(MiElHVAC.SetSwingV.swing);
911
+ await this.axiosInstance.get(MiElHVAC.SetSwingV.swing);
915
912
 
916
913
  //set vane h
917
914
  this.previousStateSwingH = this.mielHvac.vaneHorizontalDirection;
918
- await this.axiosInstance(MiElHVAC.SetSwingH.swing);
915
+ await this.axiosInstance.get(MiElHVAC.SetSwingH.swing);
919
916
  break;
920
917
  }
921
918
  if (!this.disableLogInfo) this.emit('info', `Set air direction mode: ${MiElHVAC.SwingMode[value]}`);
@@ -942,7 +939,7 @@ class MiElHvac extends EventEmitter {
942
939
  }
943
940
 
944
941
  const temp = `${MiElHVAC.SetTemp}${value}`
945
- await this.axiosInstance(temp);
942
+ await this.axiosInstance.get(temp);
946
943
  if (!this.disableLogInfo) this.emit('info', `Set ${this.mielHvac.targetOperationMode === 2 ? 'temperature' : 'cooling threshold temperature'}: ${value}${this.mielHvac.temperatureUnit}`);
947
944
  } catch (error) {
948
945
  this.emit('warn', `Set cooling threshold temperature error: ${error}`);
@@ -967,7 +964,7 @@ class MiElHvac extends EventEmitter {
967
964
  }
968
965
 
969
966
  const temp = `${MiElHVAC.SetTemp}${value}`
970
- await this.axiosInstance(temp);
967
+ await this.axiosInstance.get(temp);
971
968
  if (!this.disableLogInfo) this.emit('info', `Set ${this.mielHvac.targetOperationMode === 1 ? 'temperature' : 'heating threshold temperature'}: ${value}${this.mielHvac.temperatureUnit}`);
972
969
  } catch (error) {
973
970
  this.emit('warn', `Set heating threshold temperature error: ${error}`);
@@ -982,7 +979,7 @@ class MiElHvac extends EventEmitter {
982
979
  .onSet(async (value) => {
983
980
  try {
984
981
  const lock = [MiElHVAC.SetProhibit.off, MiElHVAC.SetProhibit.all][value];
985
- await this.axiosInstance(lock);
982
+ await this.axiosInstance.get(lock);
986
983
  if (!this.disableLogInfo) this.emit('info', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
987
984
  } catch (error) {
988
985
  this.emit('warn', `Set lock physical controls error: ${error}`);
@@ -996,7 +993,7 @@ class MiElHvac extends EventEmitter {
996
993
  .onSet(async (value) => {
997
994
  try {
998
995
  const unit = [MiElHVAC.SetDisplayUnit.c, MiElHVAC.SetDisplayUnit.f][value];
999
- //await this.axiosInstance(unit);
996
+ //await this.axiosInstance.get(unit);
1000
997
  if (!this.disableLogInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
1001
998
  } catch (error) {
1002
999
  this.emit('warn', `Set temperature display unit error: ${error}`);
@@ -1024,7 +1021,7 @@ class MiElHvac extends EventEmitter {
1024
1021
  if (state) {
1025
1022
  // Power on if needed
1026
1023
  if (!this.mielHvac.power) {
1027
- await this.axiosInstance(MiElHVAC.PowerOn);
1024
+ await this.axiosInstance.get(MiElHVAC.PowerOn);
1028
1025
  }
1029
1026
 
1030
1027
  // Apply preset commands in sequence
@@ -1037,7 +1034,7 @@ class MiElHvac extends EventEmitter {
1037
1034
  ];
1038
1035
 
1039
1036
  for (const cmd of commands) {
1040
- await this.axiosInstance(cmd);
1037
+ await this.axiosInstance.get(cmd);
1041
1038
  }
1042
1039
 
1043
1040
  if (!this.disableLogInfo) {
@@ -1159,10 +1156,10 @@ class MiElHvac extends EventEmitter {
1159
1156
 
1160
1157
  data = mappings[mode]();
1161
1158
  if (!this.mielHvac.power && state && mode > 0 && mode <= 63) {
1162
- await this.axiosInstance(MiElHVAC.PowerOn);
1159
+ await this.axiosInstance.get(MiElHVAC.PowerOn);
1163
1160
  }
1164
1161
 
1165
- await this.axiosInstance(data);
1162
+ await this.axiosInstance.get(data);
1166
1163
 
1167
1164
  if (!this.disableLogInfo) {
1168
1165
  const action = state ? `Set: ${buttonName}` : `Unset: ${buttonName}, Set: ${button.previousValue}`;
package/src/sensors.js CHANGED
@@ -32,9 +32,8 @@ class Sensors extends EventEmitter {
32
32
  //axios instance
33
33
  const url = `http://${config.host}/cm?cmnd=`;
34
34
  this.axiosInstance = axios.create({
35
- method: 'GET',
36
35
  baseURL: url,
37
- timeout: 6000,
36
+ timeout: 10000,
38
37
  withCredentials: config.auth,
39
38
  auth: {
40
39
  username: config.user,
@@ -66,7 +65,7 @@ class Sensors extends EventEmitter {
66
65
  if (this.enableDebugMode) this.emit('debug', `Requesting status`);
67
66
  try {
68
67
  //sensor status
69
- const sensorStatusData = await this.axiosInstance(ApiCommands.Status);
68
+ const sensorStatusData = await this.axiosInstance.get(ApiCommands.Status);
70
69
  const sensorStatus = sensorStatusData.data ?? {};
71
70
  if (this.enableDebugMode) this.emit('debug', `Sensors status: ${JSON.stringify(sensorStatus, null, 2)}`);
72
71
 
package/src/switches.js CHANGED
@@ -31,9 +31,8 @@ class Switches extends EventEmitter {
31
31
  //axios instance
32
32
  const url = `http://${config.host}/cm?cmnd=`;
33
33
  this.axiosInstance = axios.create({
34
- method: 'GET',
35
34
  baseURL: url,
36
- timeout: 6000,
35
+ timeout: 10000,
37
36
  withCredentials: config.auth,
38
37
  auth: {
39
38
  username: config.user,
@@ -65,7 +64,7 @@ class Switches extends EventEmitter {
65
64
  if (this.enableDebugMode) this.emit('debug', `Requesting status`);
66
65
  try {
67
66
  //power status
68
- const powerStatusData = await this.axiosInstance(ApiCommands.PowerStatus);
67
+ const powerStatusData = await this.axiosInstance.get(ApiCommands.PowerStatus);
69
68
  const powerStatus = powerStatusData.data ?? {};
70
69
  if (this.enableDebugMode) this.emit('debug', `Power status: ${JSON.stringify(powerStatus, null, 2)}`);
71
70
 
@@ -196,7 +195,7 @@ class Switches extends EventEmitter {
196
195
  const powerOff = this.switchesOutlets.length === 1 ? ApiCommands.PowerOff : `${ApiCommands.Power}${relayNr}${ApiCommands.Off}`;
197
196
  state = state ? powerOn : powerOff;
198
197
 
199
- await this.axiosInstance(state);
198
+ await this.axiosInstance.get(state);
200
199
  if (!this.disableLogInfo) this.emit('info', `${friendlyName}, set state: ${state ? 'ON' : 'OFF'}`);
201
200
  } catch (error) {
202
201
  this.emit('warn', `${friendlyName}, set state error: ${error}`);