homebridge-tasmota-control 0.7.2-beta.2 → 0.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Tasmota Control",
3
3
  "name": "homebridge-tasmota-control",
4
- "version": "0.7.2-beta.2",
4
+ "version": "0.7.2",
5
5
  "description": "Homebridge plugin to control Tasmota flashed devices.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/constans.json CHANGED
@@ -40,6 +40,8 @@
40
40
  "Humidity",
41
41
  "DewPoint",
42
42
  "Pressure",
43
- "Gas"
43
+ "Gas",
44
+ "CarbonDioxyde",
45
+ "Ambient"
44
46
  ]
45
47
  }
@@ -44,8 +44,6 @@ class TasmotaDevice {
44
44
  this.sensorsDewPointCount = 0;
45
45
  this.sensorsPressureCount = 0;
46
46
  this.sensorsGasCount = 0;
47
- this.sensorsCarbonDioxydeCount = 0;
48
- this.sensorsAmbientLightCount = 0;
49
47
 
50
48
  //variable
51
49
  this.startPrepareAccessory = true;
@@ -207,8 +205,6 @@ class TasmotaDevice {
207
205
  this.sensorsDewPoint = [];
208
206
  this.sensorsPressure = [];
209
207
  this.sensorsGas = [];
210
- this.sensorsCarbonDioxyde = [];
211
- this.sensorsAmbientLight = [];
212
208
 
213
209
  const sensorsStatusData = await this.axiosInstance(CONSTANS.ApiCommands.Status);
214
210
  const sensorsStatus = sensorsStatusData.data.StatusSNS;
@@ -231,8 +227,6 @@ class TasmotaDevice {
231
227
  const push3 = dewPoint !== false && dewPoint !== undefined && dewPoint !== null ? this.sensorsDewPoint.push(dewPoint) : false;
232
228
  const push4 = pressure !== false && pressure !== undefined && pressure !== null ? this.sensorsPressure.push(pressure) : false;
233
229
  const push5 = gas !== false && gas !== undefined && gas !== null ? this.sensorsGas.push(gas) : false;
234
- const push6 = carbonDioxyde !== false && carbonDioxyde !== undefined && carbonDioxyde !== null ? this.sensorsCarbonDioxyde.push(carbonDioxyde) : false;
235
- const push7 = ambientLight !== false && ambientLight !== undefined && ambientLight !== null ? this.sensorsAmbientLight.push(ambientLight) : false;
236
230
  };
237
231
 
238
232
  this.sensorsTemperatureCount = this.sensorsTemperature.length;
@@ -240,8 +234,6 @@ class TasmotaDevice {
240
234
  this.sensorsDewPointCount = this.sensorsDewPoint.length;
241
235
  this.sensorsPressureCount = this.sensorsPressure.length;
242
236
  this.sensorsGasCount = this.sensorsGas.length;
243
- this.sensorsCarbonDioxydeCount = this.sensorsCarbonDioxyde.length;
244
- this.sensorsAmbientLightCount = this.sensorsAmbientLight.length;
245
237
  this.tempUnit = sensorsStatus.TempUnit ?? 'C';
246
238
  this.pressureUnit = sensorsStatus.PressureUnit ?? 'hPa';
247
239
 
@@ -270,25 +262,6 @@ class TasmotaDevice {
270
262
  .updateCharacteristic(Characteristic.CurrentTemperature, dewPoint);
271
263
  };
272
264
  };
273
-
274
- if (this.sensorCarbonDioxydeServices && this.sensorsCarbonDioxydeCount > 0) {
275
- for (let i = 0; i < this.sensorsCarbonDioxydeCount; i++) {
276
- const carbonDioxydeDetected = this.sensorsCarbonDioxyde[i] > 1000;
277
- const carbonDioxydeLevel = this.sensorsCarbonDioxyde[i];
278
- this.sensorCarbonDioxydeServices[i]
279
- .updateCharacteristic(Characteristic.CarbonDioxideDetected, carbonDioxydeDetected)
280
- .updateCharacteristic(Characteristic.CarbonDioxideLevel, carbonDioxydeLevel)
281
- .updateCharacteristic(Characteristic.CarbonDioxidePeakLevel, carbonDioxydeLevel);
282
- };
283
- };
284
-
285
- if (this.sensorAmbientLightServices && this.sensorsAmbientLightCount > 0) {
286
- for (let i = 0; i < this.sensorsAmbientLightCount; i++) {
287
- const ambientLight = this.sensorsAmbientLight[i];
288
- this.sensorAmbientLightServices[i]
289
- .updateCharacteristic(Characteristic.CurrentAmbientLightLevel, ambientLight);
290
- };
291
- };
292
265
  };
293
266
 
294
267
  resolve();
@@ -417,7 +390,7 @@ class TasmotaDevice {
417
390
  sensorDewPointService.getCharacteristic(Characteristic.CurrentTemperature)
418
391
  .onGet(async () => {
419
392
  const value = this.sensorsDewPoint[i];
420
- const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host}, ${accessoryName}, sensor:${sensorName} dew point: ${value} °${this.tempUnit}`);
393
+ const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host}, ${accessoryName}, sensor: ${sensorName} dew point: ${value} °${this.tempUnit}`);
421
394
  return value;
422
395
  });
423
396
  this.sensorDewPointServices.push(sensorDewPointService);
@@ -430,61 +403,8 @@ class TasmotaDevice {
430
403
  //gas
431
404
 
432
405
  //carbon dioxyde
433
- const sensorsCarbonDioxydeCount = this.sensorsCarbonDioxydeCount;
434
- if (sensorsCarbonDioxydeCount > 0) {
435
- const debug = this.enableDebugMode ? this.log('Prepare Carbon Dioxyde Sensor Services') : false;
436
- this.sensorCarbonDioxydeServices = [];
437
- for (let i = 0; i < sensorsCarbonDioxydeCount; i++) {
438
- const sensorName = this.sensorsName[i];
439
- const serviceName = `${accessoryName} ${sensorName} Carbon Dioxyde`;
440
- const sensorCarbonDioxydeService = new Service.CarbonDioxideSensor(serviceName, `Carbon Dioxyde Sensor${i}`);
441
- sensorCarbonDioxydeService.addOptionalCharacteristic(Characteristic.ConfiguredName);
442
- sensorCarbonDioxydeService.setCharacteristic(Characteristic.ConfiguredName, serviceName);
443
- sensorCarbonDioxydeService.getCharacteristic(Characteristic.CarbonDioxideDetected)
444
- .onGet(async () => {
445
- const state = this.sensorsCarbonDioxyde[i] > 1000;
446
- const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host}, ${accessoryName}, sensor:${sensorName} carbon dioxyde detected: ${state ? 'Yes' : 'No'}`);
447
- return state;
448
- });
449
- sensorCarbonDioxydeService.getCharacteristic(Characteristic.CarbonDioxideLevel)
450
- .onGet(async () => {
451
- const value = this.sensorsCarbonDioxyde[i];
452
- const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host}, ${accessoryName}, sensor:${sensorName} carbon dioxyde level: ${value} ppm`);
453
- return value;
454
- });
455
- sensorCarbonDioxydeService.getCharacteristic(Characteristic.CarbonDioxidePeakLevel)
456
- .onGet(async () => {
457
- const value = this.sensorsCarbonDioxyde[i];
458
- const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host}, ${accessoryName}, sensor:${sensorName} carbon dioxyde peak level: ${value} ppm`);
459
- return value;
460
- });
461
- this.sensorCarbonDioxydeServices.push(sensorCarbonDioxydeService);
462
- accessory.addService(sensorCarbonDioxydeService);
463
- };
464
- }
465
- };
466
406
 
467
- //ambient light
468
- const sensorsAmbientLightCount = this.sensorsAmbientLightCount;
469
- if (sensorsAmbientLightCount > 0) {
470
- const debug = this.enableDebugMode ? this.log('Prepare Ambient Light Sensor Services') : false;
471
- this.sensorAmbientLightServices = [];
472
- for (let i = 0; i < sensorsAmbientLightCount; i++) {
473
- const sensorName = this.sensorsName[i];
474
- const serviceName = `${accessoryName} ${sensorName} Ambient Light`;
475
- const sensorAmbientLightService = new Service.LightSensor(serviceName, `Ambient Light Sensor${i}`);
476
- sensorAmbientLightService.addOptionalCharacteristic(Characteristic.ConfiguredName);
477
- sensorAmbientLightService.setCharacteristic(Characteristic.ConfiguredName, serviceName);
478
- sensorAmbientLightService.getCharacteristic(Characteristic.CurrentAmbientLightLevel)
479
- .onGet(async () => {
480
- const value = this.sensorsAmbientLight[i];
481
- const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host}, ${accessoryName}, sensor:${sensorName} ambient light: ${value} lx`);
482
- return value;
483
- });
484
- this.sensorAmbientLightServices.push(sensorAmbientLightService);
485
- accessory.addService(sensorAmbientLightService);
486
- };
487
- }
407
+ };
488
408
 
489
409
  resolve(accessory);
490
410
  } catch (error) {