homebridge-deconz 1.0.18 → 1.0.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.
@@ -163,7 +163,6 @@ class Gateway extends AccessoryDelegate {
163
163
  await this.client.restart()
164
164
  this.values.search = false
165
165
  this.values.unlock = false
166
- return
167
166
  } catch (error) { this.warn(error) }
168
167
  }
169
168
  })
@@ -179,7 +178,6 @@ class Gateway extends AccessoryDelegate {
179
178
  await this.client.search()
180
179
  await timeout(120000)
181
180
  this.values.search = false
182
- return
183
181
  } catch (error) { this.warn(error) }
184
182
  }
185
183
  })
@@ -194,7 +192,6 @@ class Gateway extends AccessoryDelegate {
194
192
  await this.client.unlock()
195
193
  await timeout(60000)
196
194
  this.values.unlock = false
197
- return
198
195
  } catch (error) { this.warn(error) }
199
196
  }
200
197
  })
@@ -25,8 +25,22 @@ class Alarm extends DeconzService.SensorsResource {
25
25
  }
26
26
 
27
27
  updateState (state) {
28
- if (state.alarm != null || state.test != null) {
29
- this.values.alarm = state.alarm || state.test
28
+ if (state.test) {
29
+ if (this.testTimout) {
30
+ clearTimeout(this.testTimeout)
31
+ }
32
+ this.test = true
33
+ this.testTimout = setTimeout(() => {
34
+ delete this.testTimeout
35
+ this.test = false
36
+ }, 5000)
37
+ }
38
+ if (state.alarm) {
39
+ this.values.alarm = true
40
+ } else if (this.test) {
41
+ this.values.alarm = true
42
+ } else {
43
+ this.values.alarm = false
30
44
  }
31
45
  super.updateState(state)
32
46
  }
@@ -25,10 +25,22 @@ class CarbonMonoxide extends DeconzService.SensorsResource {
25
25
  }
26
26
 
27
27
  updateState (state) {
28
- if (state.carbonmonoxide != null || state.test != null) {
29
- this.values.carbonmonoxide = state.carbonmonoxide || state.test
30
- ? this.Characteristics.hap.CarbonMonoxideDetected.CO_LEVELS_ABNORMAL
31
- : this.Characteristics.hap.CarbonMonoxideDetected.CO_LEVELS_NORMAL
28
+ if (state.test) {
29
+ if (this.testTimout) {
30
+ clearTimeout(this.testTimeout)
31
+ }
32
+ this.test = true
33
+ this.testTimout = setTimeout(() => {
34
+ delete this.testTimeout
35
+ this.test = false
36
+ }, 5000)
37
+ }
38
+ if (state.carbonmonoxide) {
39
+ this.values.carbonmonoxide = this.Characteristics.hap.CarbonMonoxideDetected.CO_LEVELS_ABNORMAL
40
+ } else if (this.test) {
41
+ this.values.carbonmonoxide = this.Characteristics.hap.CarbonMonoxideDetected.CO_LEVELS_ABNORMAL
42
+ } else {
43
+ this.values.carbonmonoxide = this.Characteristics.hap.CarbonMonoxideDetected.CO_LEVELS_NORMAL
32
44
  }
33
45
  super.updateState(state)
34
46
  }
@@ -25,10 +25,22 @@ class Leak extends DeconzService.SensorsResource {
25
25
  }
26
26
 
27
27
  updateState (state) {
28
- if (state.water != null || state.test != null) {
29
- this.values.leak = state.water || state.test
30
- ? this.Characteristics.hap.LeakDetected.LEAK_DETECTED
31
- : this.Characteristics.hap.LeakDetected.LEAK_NOT_DETECTED
28
+ if (state.test) {
29
+ if (this.testTimout) {
30
+ clearTimeout(this.testTimeout)
31
+ }
32
+ this.test = true
33
+ this.testTimout = setTimeout(() => {
34
+ delete this.testTimeout
35
+ this.test = false
36
+ }, 5000)
37
+ }
38
+ if (state.water) {
39
+ this.values.leak = this.Characteristics.hap.LeakDetected.LEAK_DETECTED
40
+ } else if (this.test) {
41
+ this.values.leak = this.Characteristics.hap.LeakDetected.LEAK_DETECTED
42
+ } else {
43
+ this.values.leak = this.Characteristics.hap.LeakDetected.LEAK_NOT_DETECTED
32
44
  }
33
45
  super.updateState(state)
34
46
  }
@@ -327,6 +327,7 @@ class Light extends DeconzService.LightsResource {
327
327
  value: 'none',
328
328
  silent: true
329
329
  })
330
+ effectString.setMaxListeners(20)
330
331
  for (const id in this.resource.body.capabilities.color.effects) {
331
332
  const effect = this.resource.body.capabilities.color.effects[id]
332
333
  const characteristicName = effect[0].toUpperCase() + effect.slice(1) + 'Effect'
@@ -98,7 +98,7 @@ class SensorsResource extends DeconzService {
98
98
  return this._putConfig()
99
99
  }
100
100
 
101
- // Send the request (for the combined state changes) to the gateway.
101
+ // Send the request (for the combined config changes) to the gateway.
102
102
  async _putConfig () {
103
103
  try {
104
104
  if (this.platform.config.waitTimeUpdate > 0) {
@@ -30,19 +30,27 @@ class Smoke extends DeconzService.SensorsResource {
30
30
  }
31
31
 
32
32
  updateState (state) {
33
- if (state.fire != null || state.test != null) {
34
- this.values.smoke = state.fire
35
- ? this.Characteristics.hap.SmokeDetected.SMOKE_DETECTED
36
- : this.Characteristics.hap.SmokeDetected.SMOKE_NOT_DETECTED
37
- let status = 0
38
- if (state.fire) {
39
- status |= this.Characteristics.eve.ElgatoDeviceStatus.SMOKE_DETECTED
33
+ if (state.test) {
34
+ if (this.testTimout) {
35
+ clearTimeout(this.testTimeout)
40
36
  }
41
- if (state.test) {
42
- status |= this.Characteristics.eve.ElgatoDeviceStatus.ALARM_TEST_ACTIVE
43
- }
44
- this.values.deviceStatus = status
37
+ this.test = true
38
+ this.testTimout = setTimeout(() => {
39
+ delete this.testTimeout
40
+ this.test = false
41
+ }, 5000)
42
+ }
43
+ let status = 0
44
+ if (state.fire) {
45
+ this.values.smoke = this.Characteristics.hap.SmokeDetected.SMOKE_DETECTED
46
+ status |= this.Characteristics.eve.ElgatoDeviceStatus.SMOKE_DETECTED
47
+ } else if (this.test) {
48
+ this.values.smoke = this.Characteristics.hap.SmokeDetected.SMOKE_DETECTED
49
+ status |= this.Characteristics.eve.ElgatoDeviceStatus.ALARM_TEST_ACTIVE
50
+ } else {
51
+ this.values.smoke = this.Characteristics.hap.SmokeDetected.SMOKE_NOT_DETECTED
45
52
  }
53
+ this.values.deviceStatus = status
46
54
  super.updateState(state)
47
55
  }
48
56
  }
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "ebaauw"
8
8
  ],
9
9
  "license": "Apache-2.0",
10
- "version": "1.0.18",
10
+ "version": "1.0.21",
11
11
  "keywords": [
12
12
  "homebridge-plugin",
13
13
  "homekit",
@@ -28,11 +28,11 @@
28
28
  "engines": {
29
29
  "deCONZ": "2.28.1",
30
30
  "homebridge": "^1.8.4||^2.0.0-beta",
31
- "node": "^20||^18"
31
+ "node": "^22||^20||^18"
32
32
  },
33
33
  "dependencies": {
34
- "hb-deconz-tools": "~2.0.3",
35
- "homebridge-lib": "~7.0.8"
34
+ "hb-deconz-tools": "~2.0.4",
35
+ "homebridge-lib": "~7.0.9"
36
36
  },
37
37
  "scripts": {
38
38
  "prepare": "standard && rm -rf out && jsdoc -c jsdoc.json",