gotwalt / sonos

Control Sonos speakers with Ruby
MIT License
383 stars 77 forks source link

BR200 not supported #50

Open paulwakeford opened 9 years ago

paulwakeford commented 9 years ago

FYI - BR200 is the Boost.

sonos devices /Library/Ruby/Gems/2.0.0/gems/sonos-0.3.6/lib/sonos/device/base.rb:21:in detect': BR200 not supported (ArgumentError) from /Library/Ruby/Gems/2.0.0/gems/sonos-0.3.6/lib/sonos/topology_node.rb:18:indevice' from /Library/Ruby/Gems/2.0.0/gems/sonos-0.3.6/lib/sonos/system.rb:76:in collect' from /Library/Ruby/Gems/2.0.0/gems/sonos-0.3.6/lib/sonos/system.rb:76:inrescan' from /Library/Ruby/Gems/2.0.0/gems/sonos-0.3.6/lib/sonos/system.rb:12:in initialize' from /Library/Ruby/Gems/2.0.0/gems/sonos-0.3.6/lib/sonos/cli.rb:94:innew' from /Library/Ruby/Gems/2.0.0/gems/sonos-0.3.6/lib/sonos/cli.rb:94:in system' from /Library/Ruby/Gems/2.0.0/gems/sonos-0.3.6/lib/sonos/cli.rb:8:indevices' from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:27:in run' from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:ininvoke_command' from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor.rb:359:in dispatch' from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/base.rb:440:instart' from /Library/Ruby/Gems/2.0.0/gems/sonos-0.3.6/bin/sonos:7:in <top (required)>' from /usr/bin/sonos:23:inload' from /usr/bin/sonos:23:in `

'

I had a quick look and can't really see why - it should be detected as an Accessory.

DeviceDescription:

1 0 urn:schemas-upnp-org:device:ZonePlayer:1 192.168.1.14 - Sonos BOOST Sonos, Inc. http://www.sonos.com BR200 Sonos BOOST Sonos BOOST http://www.sonos.com/store/products/BR200 29.5-90191 1.12.1.2-2 REDACTED uuid:RINCON_REDACTED ... 28.0-00000 24.0-0000 5.4 BOOST BOOST 11 0x00000000 0x00008173 0x00030000 -1 64 16 ...
jasperla commented 8 years ago

Would it be possible for you to capture the full device description?

Based on urn:schemas-upnp-org:device:MediaRenderer:1 it's decided if a device is a speaker or accessory but I don't see that node in your output.

paulwakeford commented 8 years ago

Ah, the editor here mangled the xml. I'll attach it here. BOOST-device_description.xml.txt

jasperla commented 8 years ago

For reference:

<?xml version="1.0" encoding="utf-8" ?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <device>
    <deviceType>urn:schemas-upnp-org:device:ZonePlayer:1</deviceType>
    <friendlyName>192.168.1.2 - Sonos BOOST</friendlyName>
    <manufacturer>Sonos, Inc.</manufacturer>
    <manufacturerURL>http://www.sonos.com</manufacturerURL>
    <modelNumber>BR200</modelNumber>
    <modelDescription>Sonos BOOST</modelDescription>
    <modelName>Sonos BOOST</modelName>
    <modelURL>http://www.sonos.com/store/products/BR200</modelURL>
    <softwareVersion>31.3-22220</softwareVersion>
    <hardwareVersion>1.12.1.2-2</hardwareVersion>
    <serialNum>redacted</serialNum>
    <UDN>redacted</UDN>
    <iconList>
      <icon>
        <id>0</id>
        <mimetype>image/png</mimetype>
        <width>48</width>
        <height>48</height>
        <depth>24</depth>
        <url>/img/icon-BR200.png</url>
      </icon>
    </iconList>
    <minCompatibleVersion>29.0-00000</minCompatibleVersion>
    <legacyCompatibleVersion>24.0-00000</legacyCompatibleVersion>
    <displayVersion>6.0</displayVersion>
    <extraVersion></extraVersion>
    <roomName>BOOST</roomName>
    <displayName>BOOST</displayName>
    <zoneType>11</zoneType>
    <feature1>0x00000000</feature1>
    <feature2>0x00008173</feature2>
    <feature3>0x00030000</feature3>
    <internalSpeakerSize>-1</internalSpeakerSize>
    <memory>64</memory>
    <flash>16</flash>
    <serviceList>
      <service>
        <serviceType>urn:schemas-upnp-org:service:DeviceProperties:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:DeviceProperties</serviceId>
        <controlURL>/DeviceProperties/Control</controlURL>
        <eventSubURL>/DeviceProperties/Event</eventSubURL>
        <SCPDURL>/xml/DeviceProperties1.xml</SCPDURL>
      </service>
      <service>
        <serviceType>urn:schemas-upnp-org:service:SystemProperties:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:SystemProperties</serviceId>
        <controlURL>/SystemProperties/Control</controlURL>
        <eventSubURL>/SystemProperties/Event</eventSubURL>
        <SCPDURL>/xml/SystemProperties1.xml</SCPDURL>
      </service>
      <service>
        <serviceType>urn:schemas-upnp-org:service:ZoneGroupTopology:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:ZoneGroupTopology</serviceId>
        <controlURL>/ZoneGroupTopology/Control</controlURL>
        <eventSubURL>/ZoneGroupTopology/Event</eventSubURL>
        <SCPDURL>/xml/ZoneGroupTopology1.xml</SCPDURL>
      </service>
      <service>
        <serviceType>urn:schemas-upnp-org:service:GroupManagement:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:GroupManagement</serviceId>
        <controlURL>/GroupManagement/Control</controlURL>
        <eventSubURL>/GroupManagement/Event</eventSubURL>
        <SCPDURL>/xml/GroupManagement1.xml</SCPDURL>
      </service>
    </serviceList>
    <deviceList>
    </deviceList>
  </device>
</root>

and indeed it's lacking MediaRenderer; I don't have such a device myself but I'll try to have a look at the issue.

fahrberg commented 8 years ago

The issue with identifying this problem seem to be that the version we get from rubygems differ from the version here at GitHub.

In the version we get from RubyGems, simply adding the BR200 to accessory.rb solves this problem. Whereas the version on git doesn't have this list of accessories.

MODELS = {
  :'CR100' => 'CR100',   # Released Jan 2005
  :'CR200' => 'CONTROL', # Released Jul 2009
  :'WD100' => 'DOCK',
  :'ZB100' => 'BRIDGE',   # Released Oct 2007
  :'BR200' => 'BOOST'
}.freeze

There is also a noticeable difference in the base.rb

  # TODO: Clean up
  if Accessory.models.keys.include?(model_number.to_sym)
    Accessory.new(ip, data)
  elsif Speaker.models.keys.include?(model_number.to_sym)
    Speaker.new(ip, data)
  else
    raise ArgumentError.new("#{data[:model_number]} not supported")
  end
end

Or you could specify in your gemfile to use the version on github instead.