homebridge-tasmota-control 1.7.0 → 1.7.1

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.7.0",
4
+ "version": "1.7.1",
5
5
  "description": "Homebridge plugin to control Tasmota flashed devices.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -30,11 +30,11 @@
30
30
  "LICENSE"
31
31
  ],
32
32
  "engines": {
33
- "homebridge": "^1.9.0 || ^2.0.0 || ^2.0.0-beta.29 || ^2.0.0-alpha.6",
33
+ "homebridge": "^1.9.0 || ^2.0.0 || ^2.0.0-beta.30 || ^2.0.0-alpha.40",
34
34
  "node": "^20 || ^22 || ^24"
35
35
  },
36
36
  "dependencies": {
37
- "axios": "^1.12.1"
37
+ "axios": "^1.12.2"
38
38
  },
39
39
  "keywords": [
40
40
  "homebridge",
package/src/lights.js CHANGED
@@ -41,11 +41,9 @@ class Lights extends EventEmitter {
41
41
  });
42
42
 
43
43
  //lock flags
44
- this.locks = {
45
- checkState: false,
46
- };
44
+ this.locks = false;
47
45
  this.impulseGenerator = new ImpulseGenerator()
48
- .on('checkState', () => this.handleWithLock('checkState', async () => {
46
+ .on('checkState', () => this.handleWithLock(async () => {
49
47
  await this.checkState();
50
48
  }))
51
49
  .on('state', (state) => {
@@ -53,16 +51,16 @@ class Lights extends EventEmitter {
53
51
  });
54
52
  }
55
53
 
56
- async handleWithLock(lockKey, fn) {
57
- if (this.locks[lockKey]) return;
54
+ async handleWithLock(fn) {
55
+ if (this.locks) return;
58
56
 
59
- this.locks[lockKey] = true;
57
+ this.locks = true;
60
58
  try {
61
59
  await fn();
62
60
  } catch (error) {
63
61
  this.emit('error', `Inpulse generator error: ${error}`);
64
62
  } finally {
65
- this.locks[lockKey] = false;
63
+ this.locks = false;
66
64
  }
67
65
  }
68
66
 
@@ -72,7 +70,6 @@ class Lights extends EventEmitter {
72
70
  //power status
73
71
  const powerStatusData = await this.axiosInstance(ApiCommands.PowerStatus);
74
72
  const powerStatus = powerStatusData.data ?? {};
75
- const powerStatusKeys = Object.keys(powerStatus);
76
73
  if (this.enableDebugMode) this.emit('debug', `Power status: ${JSON.stringify(powerStatus, null, 2)}`);
77
74
 
78
75
  //sensor status
package/src/sensors.js CHANGED
@@ -43,11 +43,9 @@ class Sensors extends EventEmitter {
43
43
  });
44
44
 
45
45
  //lock flags
46
- this.locks = {
47
- checkState: false,
48
- };
46
+ this.locks = false;
49
47
  this.impulseGenerator = new ImpulseGenerator()
50
- .on('checkState', () => this.handleWithLock('checkState', async () => {
48
+ .on('checkState', () => this.handleWithLock(async () => {
51
49
  await this.checkState();
52
50
  }))
53
51
  .on('state', (state) => {
@@ -55,16 +53,16 @@ class Sensors extends EventEmitter {
55
53
  });
56
54
  }
57
55
 
58
- async handleWithLock(lockKey, fn) {
59
- if (this.locks[lockKey]) return;
56
+ async handleWithLock(fn) {
57
+ if (this.locks) return;
60
58
 
61
- this.locks[lockKey] = true;
59
+ this.locks = true;
62
60
  try {
63
61
  await fn();
64
62
  } catch (error) {
65
63
  this.emit('error', `Inpulse generator error: ${error}`);
66
64
  } finally {
67
- this.locks[lockKey] = false;
65
+ this.locks = false;
68
66
  }
69
67
  }
70
68
 
package/src/switches.js CHANGED
@@ -42,11 +42,9 @@ class Switches extends EventEmitter {
42
42
  });
43
43
 
44
44
  //lock flags
45
- this.locks = {
46
- checkState: false,
47
- };
45
+ this.locks = false;
48
46
  this.impulseGenerator = new ImpulseGenerator()
49
- .on('checkState', () => this.handleWithLock('checkState', async () => {
47
+ .on('checkState', () => this.handleWithLock(async () => {
50
48
  await this.checkState();
51
49
  }))
52
50
  .on('state', (state) => {
@@ -54,16 +52,16 @@ class Switches extends EventEmitter {
54
52
  });
55
53
  }
56
54
 
57
- async handleWithLock(lockKey, fn) {
58
- if (this.locks[lockKey]) return;
55
+ async handleWithLock(fn) {
56
+ if (this.locks) return;
59
57
 
60
- this.locks[lockKey] = true;
58
+ this.locks = true;
61
59
  try {
62
60
  await fn();
63
61
  } catch (error) {
64
62
  this.emit('error', `Inpulse generator error: ${error}`);
65
63
  } finally {
66
- this.locks[lockKey] = false;
64
+ this.locks = false;
67
65
  }
68
66
  }
69
67