homebridge-deconz 0.0.12 → 0.0.13
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/lib/Deconz/Resource.js
    CHANGED
    
    | @@ -1187,9 +1187,9 @@ class Resource { | |
| 1187 1187 | 
             
                */
         | 
| 1188 1188 | 
             
              patchThermostat (gateway) {
         | 
| 1189 1189 | 
             
                if (this.manufacturer === 'ELKO' && this.model === 'Super TR') {
         | 
| 1190 | 
            -
                  this. | 
| 1190 | 
            +
                  this.capabilities.heatValue = 'heat'
         | 
| 1191 1191 | 
             
                } else {
         | 
| 1192 | 
            -
                  this. | 
| 1192 | 
            +
                  this.capabilities.heatValue = 'auto'
         | 
| 1193 1193 | 
             
                }
         | 
| 1194 1194 | 
             
              }
         | 
| 1195 1195 |  | 
| @@ -1197,7 +1197,8 @@ class Resource { | |
| 1197 1197 | 
             
              * @param {DeconzAccessory.Gateway} gateway - The gateway.
         | 
| 1198 1198 | 
             
                */
         | 
| 1199 1199 | 
             
              patchWindowCovering (gateway) {
         | 
| 1200 | 
            -
                if (this.manufacturer === ' | 
| 1200 | 
            +
                if (this.manufacturer === 'LUMI' && this.model === 'lumi.curtain.acn002') {
         | 
| 1201 | 
            +
                  this.capabilities.maxSpeed = 2
         | 
| 1201 1202 | 
             
                  this.capabilities.positionChange = true
         | 
| 1202 1203 | 
             
                }
         | 
| 1203 1204 | 
             
              }
         | 
| @@ -874,16 +874,17 @@ class Gateway extends homebridgeLib.AccessoryDelegate { | |
| 874 874 | 
             
                      name: 'homebridge-deconz',
         | 
| 875 875 | 
             
                      description: 'migration',
         | 
| 876 876 | 
             
                      classid: 1,
         | 
| 877 | 
            -
                      links: Object.keys(this. | 
| 877 | 
            +
                      links: Object.keys(this.accessoryByRpath).sort()
         | 
| 878 878 | 
             
                    })
         | 
| 879 879 | 
             
                    this.context.migration = '/resourcelinks/' + response.success.id
         | 
| 880 880 | 
             
                  } else {
         | 
| 881 881 | 
             
                    await this.client.put(this.context.migration, {
         | 
| 882 | 
            -
                      links: Object.keys(this. | 
| 882 | 
            +
                      links: Object.keys(this.accessoryByRpath).sort()
         | 
| 883 883 | 
             
                    })
         | 
| 884 884 | 
             
                  }
         | 
| 885 885 | 
             
                  this.log(
         | 
| 886 | 
            -
                    'migration: %s: %d resources', | 
| 886 | 
            +
                    'migration: %s: %d resources',
         | 
| 887 | 
            +
                    this.context.migration, this.nResourcesMonitored
         | 
| 887 888 | 
             
                  )
         | 
| 888 889 | 
             
                }
         | 
| 889 890 | 
             
              }
         | 
| @@ -12,7 +12,7 @@ const DeconzService = require('../DeconzService') | |
| 12 12 | 
             
              */
         | 
| 13 13 | 
             
            class Thermostat extends DeconzService.SensorsResource {
         | 
| 14 14 | 
             
              constructor (accessory, resource, params = {}) {
         | 
| 15 | 
            -
                params.Service = accessory.Services.hap. | 
| 15 | 
            +
                params.Service = accessory.Services.hap.Thermostat
         | 
| 16 16 | 
             
                super(accessory, resource, params)
         | 
| 17 17 |  | 
| 18 18 | 
             
                this.addCharacteristicDelegate({
         | 
| @@ -63,6 +63,25 @@ class WindowCovering extends DeconzService.LightsResource { | |
| 63 63 | 
             
                  })
         | 
| 64 64 | 
             
                }
         | 
| 65 65 |  | 
| 66 | 
            +
                if (resource.capabilities.maxSpeed != null) {
         | 
| 67 | 
            +
                  this.addCharacteristicDelegate({
         | 
| 68 | 
            +
                    key: 'motorSpeed',
         | 
| 69 | 
            +
                    Characteristic: this.Characteristics.my.MotorSpeed,
         | 
| 70 | 
            +
                    unit: '',
         | 
| 71 | 
            +
                    props: {
         | 
| 72 | 
            +
                      unit: '',
         | 
| 73 | 
            +
                      minValue: 0,
         | 
| 74 | 
            +
                      maxValue: resource.capabilities.maxSpeed,
         | 
| 75 | 
            +
                      minStep: 1
         | 
| 76 | 
            +
                    }
         | 
| 77 | 
            +
                  }).on('didSet', async (value, fromHomeKit) => {
         | 
| 78 | 
            +
                    if (!fromHomeKit) {
         | 
| 79 | 
            +
                      return
         | 
| 80 | 
            +
                    }
         | 
| 81 | 
            +
                    await this.put({ speed: value })
         | 
| 82 | 
            +
                  })
         | 
| 83 | 
            +
                }
         | 
| 84 | 
            +
             | 
| 66 85 | 
             
                if (resource.capabilities.positionChange) {
         | 
| 67 86 | 
             
                  this.addCharacteristicDelegate({
         | 
| 68 87 | 
             
                    key: 'positionChange',
         | 
| @@ -80,9 +99,10 @@ class WindowCovering extends DeconzService.LightsResource { | |
| 80 99 | 
             
                this.addCharacteristicDelegates()
         | 
| 81 100 |  | 
| 82 101 | 
             
                this.update(resource.body, resource.rpath)
         | 
| 102 | 
            +
                this.values.targetPosition = this.values.currentPosition
         | 
| 83 103 | 
             
              }
         | 
| 84 104 |  | 
| 85 | 
            -
              setPosition () {
         | 
| 105 | 
            +
              async setPosition () {
         | 
| 86 106 | 
             
                if (this.timer != null) {
         | 
| 87 107 | 
             
                  clearTimeout(this.timer)
         | 
| 88 108 | 
             
                  delete this.timer
         | 
| @@ -101,14 +121,14 @@ class WindowCovering extends DeconzService.LightsResource { | |
| 101 121 | 
             
                  this.values.targetPosition > this.values.currentPosition
         | 
| 102 122 | 
             
                    ? this.Characteristics.hap.PositionState.INCREASING
         | 
| 103 123 | 
             
                    : this.Characteristics.hap.PositionState.DECREASING
         | 
| 104 | 
            -
                this.put({ lift: lift })
         | 
| 124 | 
            +
                await this.put({ lift: lift })
         | 
| 105 125 | 
             
                this.timer = setTimeout(() => {
         | 
| 106 126 | 
             
                  this.values.positionState =
         | 
| 107 127 | 
             
                    this.Characteristics.hap.PositionState.STOPPED
         | 
| 108 128 | 
             
                }, 15000)
         | 
| 109 129 | 
             
              }
         | 
| 110 130 |  | 
| 111 | 
            -
              updateState (state | 
| 131 | 
            +
              updateState (state) {
         | 
| 112 132 | 
             
                if (state.lift != null) {
         | 
| 113 133 | 
             
                  let position = Math.round(state.lift / 5) * 5
         | 
| 114 134 | 
             
                  let closeUpwards
         | 
| @@ -121,16 +141,19 @@ class WindowCovering extends DeconzService.LightsResource { | |
| 121 141 | 
             
                    }
         | 
| 122 142 | 
             
                  }
         | 
| 123 143 | 
             
                  position = 100 - position // % open -> % closed
         | 
| 144 | 
            +
                  this.values.currentPosition = position
         | 
| 145 | 
            +
                  if (closeUpwards != null) {
         | 
| 146 | 
            +
                    this.values.closeUpwards = closeUpwards
         | 
| 147 | 
            +
                  }
         | 
| 124 148 | 
             
                  if (
         | 
| 125 149 | 
             
                    position === this.values.targetPosition &&
         | 
| 126 150 | 
             
                    (closeUpwards == null || closeUpwards === this.targetCloseUpwards)
         | 
| 127 151 | 
             
                  ) {
         | 
| 128 152 | 
             
                    this.values.positionState = this.Characteristics.hap.PositionState.STOPPED
         | 
| 129 153 | 
             
                  }
         | 
| 130 | 
            -
             | 
| 131 | 
            -
             | 
| 132 | 
            -
             | 
| 133 | 
            -
                  }
         | 
| 154 | 
            +
                }
         | 
| 155 | 
            +
                if (state.speed != null) {
         | 
| 156 | 
            +
                  this.values.motorSpeed = state.speed
         | 
| 134 157 | 
             
                }
         | 
| 135 158 | 
             
                super.updateState(state)
         | 
| 136 159 | 
             
              }
         | 
    
        package/package.json
    CHANGED
    
    | @@ -4,7 +4,7 @@ | |
| 4 4 | 
             
              "displayName": "Homebridge deCONZ",
         | 
| 5 5 | 
             
              "author": "Erik Baauw",
         | 
| 6 6 | 
             
              "license": "Apache-2.0",
         | 
| 7 | 
            -
              "version": "0.0. | 
| 7 | 
            +
              "version": "0.0.13",
         | 
| 8 8 | 
             
              "keywords": [
         | 
| 9 9 | 
             
                "homebridge-plugin",
         | 
| 10 10 | 
             
                "homekit",
         | 
| @@ -28,7 +28,7 @@ | |
| 28 28 | 
             
                "@homebridge/plugin-ui-utils": "~0.0.19",
         | 
| 29 29 | 
             
                "homebridge-lib": "~5.2.3",
         | 
| 30 30 | 
             
                "semver": "^7.3.5",
         | 
| 31 | 
            -
                "ws": "^8. | 
| 31 | 
            +
                "ws": "^8.5.0",
         | 
| 32 32 | 
             
                "xml2js": "~0.4.23"
         | 
| 33 33 | 
             
              },
         | 
| 34 34 | 
             
              "scripts": {
         |