Skip to content

Instantly share code, notes, and snippets.

Avatar

Frédéric Barthelet fredericbarthelet

View GitHub Profile
View index.js
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)
View index.js
const Service, Characteristic;
module.exports = function (homebridge) {
 Service = homebridge.hap.Service;
 Characteristic = homebridge.hap.Characteristic;
 homebridge.registerAccessory(“switch-plugin”, “MyAwesomeSwitch”, mySwitch);
};