mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
Add a example to use "identify" event
This commit is contained in:
@@ -74,6 +74,10 @@ SamplePlatform.prototype.configureAccessory = function(accessory) {
|
||||
// accessory.updateReachability()
|
||||
accessory.reachable = true;
|
||||
|
||||
accessory.on('identify', function() {
|
||||
console.log("Identify!!!");
|
||||
});
|
||||
|
||||
if (accessory.getService(Service.Lightbulb)) {
|
||||
accessory.getService(Service.Lightbulb)
|
||||
.getCharacteristic(Characteristic.On)
|
||||
@@ -178,7 +182,9 @@ SamplePlatform.prototype.addAccessory = function(accessoryName) {
|
||||
uuid = UUIDGen.generate(accessoryName);
|
||||
|
||||
var newAccessory = new Accessory(accessoryName, uuid);
|
||||
|
||||
newAccessory.on('identify', function() {
|
||||
console.log("Identify!!!");
|
||||
});
|
||||
// Plugin can save context on accessory
|
||||
// To help restore accessory in configureAccessory()
|
||||
// newAccessory.context.something = "Something"
|
||||
|
||||
Reference in New Issue
Block a user