homebridge-deconz 0.0.10 → 0.0.11

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.
Files changed (47) hide show
  1. package/cli/deconz.js +12 -0
  2. package/lib/Deconz/ApiClient.js +34 -1
  3. package/lib/Deconz/ApiResponse.js +1 -1
  4. package/lib/Deconz/Device.js +0 -7
  5. package/lib/Deconz/Resource.js +749 -24
  6. package/lib/DeconzAccessory/Contact.js +54 -0
  7. package/lib/DeconzAccessory/Gateway.js +83 -61
  8. package/lib/DeconzAccessory/Light.js +42 -37
  9. package/lib/DeconzAccessory/Motion.js +51 -0
  10. package/lib/DeconzAccessory/Sensor.js +35 -0
  11. package/lib/DeconzAccessory/Temperature.js +63 -0
  12. package/lib/DeconzAccessory/Thermostat.js +50 -0
  13. package/lib/DeconzAccessory/WarningDevice.js +56 -0
  14. package/lib/DeconzAccessory/WindowCovering.js +47 -0
  15. package/lib/DeconzAccessory/index.js +142 -2
  16. package/lib/DeconzPlatform.js +5 -0
  17. package/lib/DeconzService/AirPressure.js +43 -0
  18. package/lib/DeconzService/AirQuality.js +17 -10
  19. package/lib/DeconzService/Alarm.js +13 -9
  20. package/lib/DeconzService/Battery.js +43 -0
  21. package/lib/DeconzService/Button.js +9 -2
  22. package/lib/DeconzService/CarbonMonoxide.js +38 -0
  23. package/lib/DeconzService/Consumption.js +65 -0
  24. package/lib/DeconzService/Contact.js +60 -0
  25. package/lib/DeconzService/Daylight.js +132 -0
  26. package/lib/DeconzService/DeviceSettings.js +11 -0
  27. package/lib/DeconzService/Flag.js +52 -0
  28. package/lib/DeconzService/Humidity.js +37 -0
  29. package/lib/DeconzService/Leak.js +38 -0
  30. package/lib/DeconzService/Light.js +12 -164
  31. package/lib/DeconzService/LightLevel.js +54 -0
  32. package/lib/DeconzService/LightsResource.js +112 -0
  33. package/lib/DeconzService/Motion.js +101 -0
  34. package/lib/DeconzService/Outlet.js +76 -0
  35. package/lib/DeconzService/Power.js +83 -0
  36. package/lib/DeconzService/SensorsResource.js +96 -0
  37. package/lib/DeconzService/Smoke.js +38 -0
  38. package/lib/DeconzService/Status.js +53 -0
  39. package/lib/DeconzService/Switch.js +93 -0
  40. package/lib/DeconzService/Temperature.js +63 -0
  41. package/lib/DeconzService/Thermostat.js +175 -0
  42. package/lib/DeconzService/WarningDevice.js +68 -0
  43. package/lib/DeconzService/WindowCovering.js +139 -0
  44. package/lib/DeconzService/index.js +76 -25
  45. package/package.json +2 -2
  46. package/lib/DeconzAccessory/Device.js +0 -69
  47. package/lib/DeconzService/Sensor.js +0 -61
@@ -1,61 +0,0 @@
1
- // homebridge-deconz/lib/DeconzService/Sensor.js
2
- // Copyright © 2022 Erik Baauw. All rights reserved.
3
- //
4
- // Homebridge plugin for deCONZ.
5
-
6
- 'use strict'
7
-
8
- const homebridgeLib = require('homebridge-lib')
9
- const Deconz = require('../Deconz')
10
-
11
- /**
12
- * @memberof DeconzService
13
- */
14
- class Sensor extends homebridgeLib.ServiceDelegate {
15
- constructor (device, params = {}) {
16
- super(device, params)
17
- this.id = params.id
18
- this.platform = device.platform
19
- this.gateway = device.gateway
20
- this.client = device.client
21
- this.rtype = '/sensors'
22
- this.rid = params.rid
23
- this.resouce = this.rtype + '/' + this.rid
24
- }
25
-
26
- addCharacteristicDelegates (params = {}) {
27
- this.addCharacteristicDelegate({
28
- key: 'lastUpdated',
29
- Characteristic: this.Characteristics.my.LastUpdated,
30
- silent: true
31
- })
32
- this.addCharacteristicDelegate({
33
- key: 'enabled',
34
- Characteristic: this.Characteristics.my.Enabled
35
- }).on('didSet', (value) => {
36
- this.values.statusActive = value
37
- })
38
- this.addCharacteristicDelegate({
39
- key: 'statusActive',
40
- Characteristic: this.Characteristics.hap.StatusActive
41
- })
42
- this.addCharacteristicDelegate({
43
- key: 'statusFault',
44
- Characteristic: this.Characteristics.hap.StatusFault
45
- })
46
- }
47
-
48
- update (sensor) {
49
- this.values.lastUpdated = Deconz.Client.dateToString(sensor.state.lastupdated)
50
- this.values.enabled = sensor.config.on
51
- this.values.statusFault = sensor.config.reachable === false
52
- ? this.Characteristics.hap.StatusFault.GENERAL_FAULT
53
- : this.Characteristics.hap.StatusFault.NO_FAULT
54
- }
55
-
56
- async put (resource, body) {
57
- return this.client.put(this.resource + resource, body)
58
- }
59
- }
60
-
61
- module.exports = Sensor