How to use the sonos.Services function in sonos

To help you get started, we’ve selected a few sonos 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 Colorado4Wheeler / Homebridge / EPS Homebridge.indigoPlugin / Contents / Server Plugin / bin / hb / node-v8.4.0-darwin-x64 / lib / node_modules / homebridge-zp / lib / ZPPlatform.js View on Github external
SonosModule.search({timeout: this.searchTimeout}, function(zp, model) {
    const deviceProperties = new SonosModule.Services.DeviceProperties(zp.host, zp.port);
    const zoneGroupTopology = new SonosModule.Services.ZoneGroupTopology(zp.host, zp.port);
    const alarmClock = new SonosModule.Services.AlarmClock(zp.host, zp.port);
    zp.model = model;
    deviceProperties.GetZoneAttributes({}, function(err, attrs) {
      if (err) {
        this.log.error('%s:%s: error %s', zp.host, zp.port, err);
      } else {
        zp.zone = attrs.CurrentZoneName;
        // this.log.debug('%s: zone attrs %j', zp.zone, attrs);
        deviceProperties.GetZoneInfo({}, function(err, info) {
          if (err) {
            this.log.error('%s: error %s', zp.zone, err);
          } else {
            // this.log.debug('%s: info %j', zp.zone, info);
            zp.id = 'RINCON_' + info.MACAddress.replace(/:/g, '') +
                    ('00000' + zp.port).substr(-5, 5);
github Colorado4Wheeler / Homebridge / EPS Homebridge.indigoPlugin / Contents / Server Plugin / bin / hb / node-v8.4.0-darwin-x64 / lib / node_modules / homebridge-zp / lib / ZPPlatform.js View on Github external
SonosModule.search({timeout: this.searchTimeout}, function(zp, model) {
    const deviceProperties = new SonosModule.Services.DeviceProperties(zp.host, zp.port);
    const zoneGroupTopology = new SonosModule.Services.ZoneGroupTopology(zp.host, zp.port);
    const alarmClock = new SonosModule.Services.AlarmClock(zp.host, zp.port);
    zp.model = model;
    deviceProperties.GetZoneAttributes({}, function(err, attrs) {
      if (err) {
        this.log.error('%s:%s: error %s', zp.host, zp.port, err);
      } else {
        zp.zone = attrs.CurrentZoneName;
        // this.log.debug('%s: zone attrs %j', zp.zone, attrs);
        deviceProperties.GetZoneInfo({}, function(err, info) {
          if (err) {
            this.log.error('%s: error %s', zp.zone, err);
          } else {
            // this.log.debug('%s: info %j', zp.zone, info);
            zp.id = 'RINCON_' + info.MACAddress.replace(/:/g, '') +
                    ('00000' + zp.port).substr(-5, 5);
            zp.version = info.DisplaySoftwareVersion;
github Colorado4Wheeler / Homebridge / EPS Homebridge.indigoPlugin / Contents / Server Plugin / bin / hb / node-v8.4.0-darwin-x64 / lib / node_modules / homebridge-zp / lib / ZPAccessory.js View on Github external
this.alarms = {};
  if (this.platform.alarms) {
    for (let id in zp.alarms) {
      const alarm = zp.alarms[id];
      if (alarm && alarm.RoomUUID === this.uuid_base) {
        this.alarms[alarm.ID] = new ZPAlarm(this, alarm);
        this.services.push(this.alarms[alarm.ID].service);
      }
    }
  }

  this.avTransport = new SonosModule.Services.AVTransport(this.zp.host, this.zp.port);
  this.renderingControl = new SonosModule.Services.RenderingControl(this.zp.host, this.zp.port);
  this.groupRenderingControl = new SonosModule.Services.GroupRenderingControl(this.zp.host, this.zp.port);
  this.alarmClock = new SonosModule.Services.AlarmClock(this.zp.host, this.zp.port);

  this.on('GroupManagement', this.handleGroupManagementEvent);
  this.on('AVTransport', this.handleAVTransportEvent);
  this.on('RenderingControl', this.handleRenderingControlEvent);
  this.on('GroupRenderingControl', this.handleGroupRenderingControlEvent);
  this.on('AlarmClock', this.handleAlarmClockEvent);

  this.createSubscriptions();
}
github Colorado4Wheeler / Homebridge / EPS Homebridge.indigoPlugin / Contents / Server Plugin / bin / hb / node-v8.4.0-darwin-x64 / lib / node_modules / homebridge-zp / lib / ZPAccessory.js View on Github external
if (this.platform.speakers) {
    this.services.push(this.zoneService);
  }

  this.alarms = {};
  if (this.platform.alarms) {
    for (let id in zp.alarms) {
      const alarm = zp.alarms[id];
      if (alarm && alarm.RoomUUID === this.uuid_base) {
        this.alarms[alarm.ID] = new ZPAlarm(this, alarm);
        this.services.push(this.alarms[alarm.ID].service);
      }
    }
  }

  this.avTransport = new SonosModule.Services.AVTransport(this.zp.host, this.zp.port);
  this.renderingControl = new SonosModule.Services.RenderingControl(this.zp.host, this.zp.port);
  this.groupRenderingControl = new SonosModule.Services.GroupRenderingControl(this.zp.host, this.zp.port);
  this.alarmClock = new SonosModule.Services.AlarmClock(this.zp.host, this.zp.port);

  this.on('GroupManagement', this.handleGroupManagementEvent);
  this.on('AVTransport', this.handleAVTransportEvent);
  this.on('RenderingControl', this.handleRenderingControlEvent);
  this.on('GroupRenderingControl', this.handleGroupRenderingControlEvent);
  this.on('AlarmClock', this.handleAlarmClockEvent);

  this.createSubscriptions();
}