How to use the hap-nodejs.Accessory.Categories function in hap-nodejs

To help you get started, we’ve selected a few hap-nodejs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github htreu / OpenHAB-HomeKit-Bridge / lib / openHABBridge.js View on Github external
function publishOpenHABBridgeAccessory(bridgeName, openHABWidgets) {
  let accessoryProvider = new AccessoryProvider();
  let homeKitAccessories = accessoryProvider.createHomeKitAccessories(openHABWidgets);
  let openHabBridge = new Bridge(bridgeName, uuid.generate(bridgeName));

  homeKitAccessories.forEach(function(accessory) {
    openHabBridge.addBridgedAccessory(accessory);
  });

  // Publish the Bridge on the local network.
  openHabBridge.publish({
    username: generateUniqueUsername(bridgeName),
    port: parseInt(targetPort),
    pincode: pincode,
    category: Accessory.Categories.OTHER
  });
};
github Capevace / halbert / system / home-kit.js View on Github external
const modules = moduleRegistry.getRegisteredModules();
  Object.keys(modules).forEach(moduleKey => {
    if (!modules[moduleKey].accessories) return;

    modules[
      moduleKey
    ].accessories.forEach(accessory => bridge.addBridgedAccessory(accessory));
  });

  //
  // bridge.addBridgedAccessory(outlet);
  bridge.publish({
    username: 'CC:22:3D:E3:CE:F6',
    port: 51826,
    pincode: '012-34-567',
    category: Accessory.Categories.BRIDGE
  });
}
github nfarina / homebridge / lib / platformAccessory.js View on Github external
function PlatformAccessory(displayName, UUID, category) {
  if (!displayName) throw new Error("Accessories must be created with a non-empty displayName.");
  if (!UUID) throw new Error("Accessories must be created with a valid UUID.");
  if (!uuid.isValid(UUID)) throw new Error("UUID '" + UUID + "' is not a valid UUID. Try using the provided 'generateUUID' function to create a valid UUID from any arbitrary string, like a serial number.");

  this.displayName = displayName;
  this.UUID = UUID;
  this.category = category || Accessory.Categories.OTHER;
  this.services = [];
  this.reachable = false;
  this.context = {};

  this._associatedPlugin;
  this._associatedPlatform;
  this._associatedHAPAccessory;

  this
    .addService(Service.AccessoryInformation)
    .setCharacteristic(Characteristic.Name, displayName)
    .setCharacteristic(Characteristic.Manufacturer, "Default-Manufacturer")
    .setCharacteristic(Characteristic.Model, "Default-Model")
    .setCharacteristic(Characteristic.SerialNumber, "Default-SerialNumber");
}
github nfarina / homebridge / lib / server.js View on Github external
var info = this._bridge.getService(Service.AccessoryInformation);
  info.setCharacteristic(Characteristic.Manufacturer, `${toTitleCase(require('../package.json').author.name)}`);
  info.setCharacteristic(Characteristic.Model, `${toTitleCase(require('../package.json').name)}`);
  info.setCharacteristic(Characteristic.SerialNumber, bridgeConfig.username);
  info.setCharacteristic(Characteristic.FirmwareRevision, require('../package.json').version);

  this._bridge.on('listening', function(port) {
    log.info("Homebridge is running on port %s.", port);
  });

  var publishInfo = {
    username: bridgeConfig.username || "CC:22:3D:E3:CE:30",
    port: bridgeConfig.port || 0,
    pincode: bridgeConfig.pin || "031-45-154",
    category: Accessory.Categories.BRIDGE,
    mdns: this._config.mdns
  };

  if (bridgeConfig.setupID && bridgeConfig.setupID.length === 4) {
    publishInfo['setupID'] = bridgeConfig.setupID;
  }

  this._bridge.publish(publishInfo, this._allowInsecureAccess);

  this._printSetupInfo();
  this._printPin(publishInfo.pincode);
}
github adafruit / adafruit-io-node / cli / homekit.js View on Github external
bridge.on('identify', (paired, cb) => cb());

    const light = new Accessories.light(name, this.client);

    bridge.addBridgedAccessory(light);

    this.logo();
    this.info('advertising homekit light accessory...');
    this.info('PIN: 100-11-100');

    bridge.publish({
      username: 'AD:A0:AD:A0:AD:A0',
      port: 60000,
      pincode: '100-11-100',
      category: Accessory.Categories.BRIDGE
    });

  }