Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

Commit

Permalink
Merge pull request #59 from ygageot/master
Browse files Browse the repository at this point in the history
Identify activation
  • Loading branch information
rthewhite committed Feb 2, 2017
2 parents ea258d0 + 551528e commit dd3fbbc
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -145,6 +145,7 @@ the accessories folder. See for example [switch](src/accessories/switch.js) or [
the accessories factory in `accessories.js` aware of you new device type. The factory receives the entire response of the get-sensors call from the HomeWizard which lists all devices.

# Changelog
- 0.0.58 - Identity activation for lights and switches
- 0.0.57 - Fix issue where dimmers would go in dim mode when you turn them on again
- 0.0.56 - Doorbell like a switch
- 0.0.55 - eslint reactivation and push request activated by default
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "homebridge-homewizard",
"version": "0.0.57",
"version": "0.0.58",
"description": "Plugin for Homebridge to communicate with HomeWizard",
"author": "Raymond de Wit",
"license": "ISC",
Expand Down
3 changes: 2 additions & 1 deletion src/accessories/accessory.js
Expand Up @@ -24,7 +24,8 @@ export class HomeWizardBaseAccessory {
informationService
.setCharacteristic(this.hap.Characteristic.Manufacturer, this.manufacturer)
.setCharacteristic(this.hap.Characteristic.Model, this.model)
.setCharacteristic(this.hap.Characteristic.SerialNumber, this.serialNumber);
.setCharacteristic(this.hap.Characteristic.SerialNumber, this.serialNumber)
.setCharacteristic(this.hap.Characteristic.Identify, true);
this.services.push(informationService);
}

Expand Down
14 changes: 12 additions & 2 deletions src/accessories/philips-hue.js
Expand Up @@ -15,8 +15,8 @@ export class HomeWizardPhilipsHue extends HomeWizardBaseAccessory {
setupServices() {
// Setup services
const lightbulbService = new this.hap.Service.Lightbulb();
lightbulbService
.getCharacteristic(this.hap.Characteristic.On)
this.onChar = lightbulbService.getCharacteristic(this.hap.Characteristic.On);
this.onChar
.on('set', this.setPowerState.bind(this))
.on('get', this.getPowerState.bind(this));

Expand Down Expand Up @@ -120,4 +120,14 @@ export class HomeWizardPhilipsHue extends HomeWizardBaseAccessory {
callback(error, 100);
});
}

identify(callback) {
this.log(`Identify ${this.name}...`);
const previous = this.onChar.value;
this.onChar.setValue(1 - previous);
setTimeout(function (me, value) {
me.onChar.setValue(value);
}, 1000, this, previous);
callback();
}
}
5 changes: 4 additions & 1 deletion src/accessories/radiator-valve.js
Expand Up @@ -32,7 +32,10 @@ export class HomeWizardRadiatorValve extends HomeWizardBaseAccessory {
.setCharacteristic(this.hap.Characteristic.CurrentHeatingCoolingState, this.hap.Characteristic.CurrentHeatingCoolingState.HEAT);

valveService
.setCharacteristic(this.hap.Characteristic.TargetHeatingCoolingState, this.hap.Characteristic.TargetHeatingCoolingState.AUTO);
.setCharacteristic(this.hap.Characteristic.TargetHeatingCoolingState, this.hap.Characteristic.TargetHeatingCoolingState.HEAT);

valveService
.getCharacteristic(this.hap.Characteristic.TargetHeatingCoolingState).props.validValues = [this.hap.Characteristic.TargetHeatingCoolingState.HEAT];

valveService
.setCharacteristic(this.hap.Characteristic.TemperatureDisplayUnits, this.hap.Characteristic.TemperatureDisplayUnits.CELSIUS);
Expand Down
14 changes: 12 additions & 2 deletions src/accessories/switch.js
Expand Up @@ -45,8 +45,8 @@ export class HomeWizardSwitch extends HomeWizardBaseAccessory {
break;
}

service
.getCharacteristic(this.hap.Characteristic.On)
this.onChar = service.getCharacteristic(this.hap.Characteristic.On);
this.onChar
.on('set', this.setPowerState.bind(this))
.on('get', this.getPowerState.bind(this));

Expand Down Expand Up @@ -123,4 +123,14 @@ export class HomeWizardSwitch extends HomeWizardBaseAccessory {
callback(error);
});
}

identify(callback) {
this.log(`Identify ${this.name}...`);
const previous = this.onChar.value;
this.onChar.setValue(1 - previous);
setTimeout(function (me, value) {
me.onChar.setValue(value);
}, 1000, this, previous);
callback();
}
}

0 comments on commit dd3fbbc

Please sign in to comment.