Skip to content

Instantly share code, notes, and snippets.

@fredericbarthelet
Created November 5, 2017 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredericbarthelet/8cc64c508871265ee7f5b3c4e5ebb9ea to your computer and use it in GitHub Desktop.
Save fredericbarthelet/8cc64c508871265ee7f5b3c4e5ebb9ea to your computer and use it in GitHub Desktop.
mySwitch.prototype = {
 getServices: function () {
 let informationService = new Service.AccessoryInformation();
 informationService
 .setCharacteristic(Characteristic.Manufacturer, “My switch manufacturer”)
 .setCharacteristic(Characteristic.Model, “My switch model”)
 .setCharacteristic(Characteristic.SerialNumber, “123–456–789”);
let switchService = new Service.Switch(“My switch”);
 switchService
 .getCharacteristic(Characteristic.On)
 .on(‘get’, this.getSwitchOnCharacteristic.bind(this))
 .on(‘set’, this.setSwitchOnCharacteristic.bind(this));
this.informationService = informationService;
 this.switchService = switchService;
 return [informationService, switchService];
 }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment