diff --git a/lib/HueSensor.js b/lib/HueSensor.js index a5e7d8a8..43ffbbb4 100644 --- a/lib/HueSensor.js +++ b/lib/HueSensor.js @@ -368,9 +368,9 @@ function HueSensor (accessory, id, obj) { ) { // Ikea Symfonisk sound controller this.createLabel(Characteristic.ServiceLabelNamespace.ARABIC_NUMERALS) - this.createButton(1, 'Click', SINGLE_DOUBLE_LONG) - this.createButton(2, 'Turn Left', LONG) - this.createButton(3, 'Turn Right', LONG) + this.createButton(1, 'Button', SINGLE_DOUBLE_LONG) + this.createButton(2, 'Turn Right', LONG) + this.createButton(3, 'Turn Left', LONG) this.type = { key: 'buttonevent', homekitValue: function (v) { return Math.floor(v / 1000) }, @@ -584,8 +584,8 @@ function HueSensor (accessory, id, obj) { } } } else if (this.endpoint === '03') { - this.createButton(8, 'Right', SINGLE_DOUBLE_LONG) - this.createButton(9, 'Left', SINGLE_DOUBLE_LONG) + this.createButton(8, 'Turn Right', SINGLE_DOUBLE_LONG) + this.createButton(9, 'Turn Left', SINGLE_DOUBLE_LONG) this.type = { key: 'buttonevent', homekitValue: function (v) { return v > 0 ? 8 : 9 }, @@ -683,7 +683,13 @@ function HueSensor (accessory, id, obj) { ) { // Lutron Aurora, see #522. this.createLabel(Characteristic.ServiceLabelNamespace.ARABIC_NUMERALS) - this.createButton(1, 'Button', SINGLE_LONG) + if (this.bridge.isHue) { + this.createButton(1, 'Button', SINGLE_LONG) + } else { + this.createButton(1, 'Button', SINGLE) + this.createButton(2, 'Turn Right', SINGLE) + this.createButton(3, 'Turn Left', SINGLE) + } this.type = { key: 'buttonevent', homekitValue: function (v) { return Math.floor(v / 1000) }, @@ -748,6 +754,28 @@ function HueSensor (accessory, id, obj) { } break case 'ZLLRelativeRotary': + // Lutron Aurora, see #522. + if ( + this.obj.manufacturername === 'Lutron' && + this.obj.modelid === 'Z3-1BRL' + ) { + this.createLabel(Characteristic.ServiceLabelNamespace.ARABIC_NUMERALS) + this.createButton(2, 'Turn Right', SINGLE) + this.createButton(3, 'Turn Left', SINGLE) + this.type = { + key: 'expectedrotation', + homekitValue: function (v) { return v > 0 ? 2 : 3 }, + homekitAction: function () { + return Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS + } + } + } else { + this.log.warn( + '%s: %s: warning: ignoring unknown %s sensor %j', + this.bridge.name, this.resource, this.obj.type, this.obj + ) + } + break case 'CLIPSwitch': // 2.1 // We'd need a way to specify the number of buttons, cf. max value for // a CLIPGenericStatus sensor. @@ -1574,6 +1602,12 @@ HueSensor.prototype.checkState = function (state, event) { case 'daylight': this.checkDaylight(state.daylight) break + case 'eventduration': + case 'expectedeventduration': + break + case 'expectedrotation': + this.checkButtonevent(state.expectedrotation, state.lastupdated, event) + break case 'gesture': break case 'lastupdated': @@ -1588,6 +1622,8 @@ HueSensor.prototype.checkState = function (state, event) { break case 'orientation': break + case 'rotaryevent': + break case 'sunrise': this.checkSunrise(state.sunrise) break @@ -1799,7 +1835,7 @@ HueSensor.prototype.checkButtonevent = function ( ) { if (event || this.obj.state.lastupdated !== lastupdated) { this.log.debug( - '%s: sensor buttonevent %j on %s', this.name, + '%s: sensor %s %j on %s', this.name, this.type.key, buttonevent, this.obj.state.lastupdated ) const buttonIndex = this.type.homekitValue(buttonevent)