openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.88k stars 3.59k forks source link

[Sonos] Thing type for Sonos Amp #7549

Closed Graefer closed 4 years ago

Graefer commented 4 years ago

PaperUI auto detects Sonos Amp as zoneplayer. Please add thing type to support Amp!

lolodomo commented 4 years ago

Please provide the XML description of the device.

lolodomo commented 4 years ago

And please inform if the new amp has the same features as the old connect:smp (same channels to offer).

bobadair commented 4 years ago

How do you retrieve the XML description? I can grab it from mine.

bobadair commented 4 years ago

Never mind. I figured it out. Here it is:

<?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.52 - Sonos Amp</friendlyName>
    <manufacturer>Sonos, Inc.</manufacturer>
    <manufacturerURL>http://www.sonos.com</manufacturerURL>
    <modelNumber>S16</modelNumber>
    <modelDescription>Sonos Amp</modelDescription>
    <modelName>Sonos Amp</modelName>
    <modelURL>http://www.sonos.com/products/zoneplayers/S16</modelURL>
    <softwareVersion>56.0-76060</softwareVersion>
    <swGen>1</swGen>
    <hardwareVersion>1.24.1.12-1</hardwareVersion>
    <serialNum>48-A6-B8-00-00-00:C</serialNum>
    <MACAddress>48:A6:B8:00:00:00</MACAddress>
    <UDN>uuid:RINCON_48A6B800000001400</UDN>
    <iconList>
      <icon>
        <id>0</id>
        <mimetype>image/png</mimetype>
        <width>48</width>
        <height>48</height>
        <depth>24</depth>
        <url>/img/icon-S16.png</url>
      </icon>
    </iconList>
    <minCompatibleVersion>55.0-00000</minCompatibleVersion>
    <legacyCompatibleVersion>36.0-00000</legacyCompatibleVersion>
    <apiVersion>1.18.6</apiVersion>
    <minApiVersion>1.1.0</minApiVersion>
    <displayVersion>11.1</displayVersion>
    <extraVersion></extraVersion>
    <roomName>TV Room</roomName>
    <displayName>Amp</displayName>
    <zoneType>18</zoneType>
    <feature1>0x05004001</feature1>
    <feature2>0x11218772</feature2>
    <feature3>0x0001123c</feature3>
    <seriesid>A101</seriesid>
    <variant>2</variant>
    <internalSpeakerSize>1</internalSpeakerSize>
    <bassExtension>40.000</bassExtension>
    <satGainOffset>-9.000</satGainOffset>
    <memory>1024</memory>
    <flash>1024</flash>

    <ampOnTime>115</ampOnTime>
    <retailMode>0</retailMode>
    <serviceList>
      <service>
        <serviceType>urn:schemas-upnp-org:service:AlarmClock:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:AlarmClock</serviceId>
        <controlURL>/AlarmClock/Control</controlURL>
        <eventSubURL>/AlarmClock/Event</eventSubURL>
        <SCPDURL>/xml/AlarmClock1.xml</SCPDURL>
      </service>
      <service>
        <serviceType>urn:schemas-upnp-org:service:MusicServices:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:MusicServices</serviceId>
        <controlURL>/MusicServices/Control</controlURL>
        <eventSubURL>/MusicServices/Event</eventSubURL>
        <SCPDURL>/xml/MusicServices1.xml</SCPDURL>
      </service>
      <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>
      <service>
        <serviceType>urn:schemas-upnp-org:service:HTControl:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:HTControl</serviceId>
        <controlURL>/HTControl/Control</controlURL>
        <eventSubURL>/HTControl/Event</eventSubURL>
        <SCPDURL>/xml/HTControl1.xml</SCPDURL>
      </service>
      <service>
        <serviceType>urn:schemas-tencent-com:service:QPlay:1</serviceType>
        <serviceId>urn:tencent-com:serviceId:QPlay</serviceId>
        <controlURL>/QPlay/Control</controlURL>
        <eventSubURL>/QPlay/Event</eventSubURL>
        <SCPDURL>/xml/QPlay1.xml</SCPDURL>
      </service>
      <service>
        <serviceType>urn:schemas-upnp-org:service:AudioIn:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:AudioIn</serviceId>
        <controlURL>/AudioIn/Control</controlURL>
        <eventSubURL>/AudioIn/Event</eventSubURL>
        <SCPDURL>/xml/AudioIn1.xml</SCPDURL>
      </service>
    </serviceList>
    <deviceList>
      <device>
  <deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>
  <friendlyName>192.168.1.52 - Sonos Amp Media Server</friendlyName>
  <manufacturer>Sonos, Inc.</manufacturer>
  <manufacturerURL>http://www.sonos.com</manufacturerURL>
  <modelNumber>S16</modelNumber>
  <modelDescription>Sonos Amp Media Server</modelDescription>
  <modelName>Sonos Amp</modelName>
  <modelURL>http://www.sonos.com/products/zoneplayers/S16</modelURL>
  <UDN>uuid:RINCON_48A6B86132AE01400_MS</UDN>
  <serviceList>
    <service>
      <serviceType>urn:schemas-upnp-org:service:ContentDirectory:1</serviceType>
      <serviceId>urn:upnp-org:serviceId:ContentDirectory</serviceId>
      <controlURL>/MediaServer/ContentDirectory/Control</controlURL>
      <eventSubURL>/MediaServer/ContentDirectory/Event</eventSubURL>
      <SCPDURL>/xml/ContentDirectory1.xml</SCPDURL>
    </service>
    <service>
      <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
            <serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
            <controlURL>/MediaServer/ConnectionManager/Control</controlURL>
            <eventSubURL>/MediaServer/ConnectionManager/Event</eventSubURL>
            <SCPDURL>/xml/ConnectionManager1.xml</SCPDURL>
          </service>
        </serviceList>
      </device>
      <device>
        <deviceType>urn:schemas-upnp-org:device:MediaRenderer:1</deviceType>
  <friendlyName>TV Room - Sonos Amp Media Renderer</friendlyName>
  <manufacturer>Sonos, Inc.</manufacturer>
  <manufacturerURL>http://www.sonos.com</manufacturerURL>
  <modelNumber>S16</modelNumber>
  <modelDescription>Sonos Amp Media Renderer</modelDescription>
  <modelName>Sonos Amp</modelName>
  <modelURL>http://www.sonos.com/products/zoneplayers/S16</modelURL>
        <UDN>uuid:RINCON_48A6B86132AE01400_MR</UDN>
        <serviceList>
          <service>
            <serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType>
            <serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
            <controlURL>/MediaRenderer/RenderingControl/Control</controlURL>
            <eventSubURL>/MediaRenderer/RenderingControl/Event</eventSubURL>
            <SCPDURL>/xml/RenderingControl1.xml</SCPDURL>
          </service>
          <service>
            <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
            <serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
            <controlURL>/MediaRenderer/ConnectionManager/Control</controlURL>
            <eventSubURL>/MediaRenderer/ConnectionManager/Event</eventSubURL>
            <SCPDURL>/xml/ConnectionManager1.xml</SCPDURL>
          </service>
          <service>
            <serviceType>urn:schemas-upnp-org:service:AVTransport:1</serviceType>
            <serviceId>urn:upnp-org:serviceId:AVTransport</serviceId>
            <controlURL>/MediaRenderer/AVTransport/Control</controlURL>
            <eventSubURL>/MediaRenderer/AVTransport/Event</eventSubURL>
            <SCPDURL>/xml/AVTransport1.xml</SCPDURL>
          </service>
          <service>
            <serviceType>urn:schemas-sonos-com:service:Queue:1</serviceType>
            <serviceId>urn:sonos-com:serviceId:Queue</serviceId>
            <controlURL>/MediaRenderer/Queue/Control</controlURL>
            <eventSubURL>/MediaRenderer/Queue/Event</eventSubURL>
            <SCPDURL>/xml/Queue1.xml</SCPDURL>
          </service>
      <service>
        <serviceType>urn:schemas-upnp-org:service:GroupRenderingControl:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:GroupRenderingControl</serviceId>
        <controlURL>/MediaRenderer/GroupRenderingControl/Control</controlURL>
        <eventSubURL>/MediaRenderer/GroupRenderingControl/Event</eventSubURL>
        <SCPDURL>/xml/GroupRenderingControl1.xml</SCPDURL>
      </service>
      <service>
        <serviceType>urn:schemas-upnp-org:service:VirtualLineIn:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:VirtualLineIn</serviceId>
        <controlURL>/MediaRenderer/VirtualLineIn/Control</controlURL>
        <eventSubURL>/MediaRenderer/VirtualLineIn/Event</eventSubURL>
        <SCPDURL>/xml/VirtualLineIn1.xml</SCPDURL>
    </service>
        </serviceList>
        <X_Rhapsody-Extension xmlns="http://www.real.com/rhapsody/xmlns/upnp-1-0">
          <deviceID>urn:rhapsody-real-com:device-id-1-0:sonos_1:RINCON_48A6B86132AE01400</deviceID>
            <deviceCapabilities>
              <interactionPattern type="real-rhapsody-upnp-1-0"/>
            </deviceCapabilities>
        </X_Rhapsody-Extension>
        <qq:X_QPlay_SoftwareCapability xmlns:qq="http://www.tencent.com">QPlay:2</qq:X_QPlay_SoftwareCapability>
        <iconList>
          <icon>
            <mimetype>image/png</mimetype>
            <width>48</width>
            <height>48</height>
            <depth>24</depth>
            <url>/img/icon-S16.png</url>
          </icon>
        </iconList>
      </device>
    </deviceList>
  </device>
</root>
bobadair commented 4 years ago

And please inform if the new amp has the same features as the old connect:smp (same channels to offer).

I believe it should be pretty similar to the older Connect:Amp. The new Amp supports HDMI ARC, which the old one did not (in addition to analog line-in), as well as the features all of the newer Sonos hardware is supporting like AirPlay. I'm don't know if any of that results in additional software controls, though.

lolodomo commented 4 years ago

So this is the first model with several audio inputs. Please enable temporarly the TRACE level logs for the Sonos binding. I am interested by this line:

14:19:02.139 [TRACE] [os.internal.handler.ZonePlayerHandler] - Received pair 'AVTransportURI':'x-rincon-stream:RINCON_949123410A6801400' (service 'AVTransport') for thing 'sonos:CONNECTAMP:bureau'

just after you select the analog audio input and just after you select the HDMI input.

I am also interested by the same kind of lines containing either LineInConnected, TOSLinkConnected or HTAudioIn

bobadair commented 4 years ago

Ok, I'll try to increase the log level tonight and see what I get. There is no TOSLink input, though. Just analog line-in and HDMI ARC. Although I believe that a TOSLink to HDMI adapter is available, so maybe if you use that it detects it. BTW - It also has an IR receiver that can learn IR codes from a remote, which the Connect:Amp does not.

In the meantime, here are the settings available for it in the Sonos app: Sound: EQ, Sub Audio, Volume Limit, Stereo/Mono Line-In: Source Name, Source Level, Audio Delay, Autoplay Home Theater: TV Autoplay (on/off), Ungroup on Autoplay (on/off), TV Dialog Sync (delay), Group Audio Delay (low/medium/high/max), TV Setup (? - I assume this configures HDMI ARC), Use IR (on/off), Remote Control Setup (learns IR codes). Hardware: Status Light (on/off), Touch Controls (on/off)

bobadair commented 4 years ago

First, here are the log messages I get when connecting line-in to the Sonos Amp, plus the polls right before and after. I don't have a TV that provides HDMI ARC, so I couldn't test that. Maybe someone else can?

Poll before
12:30:49.790 [-thingHandler-2] DEBUG o.o.b.s.i.handler.ZonePlayerHandler:151 - Polling job
12:30:49.828 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'CurrentZoneName':'TV Room' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:30:49.828 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'SoftwareVersion':'56.0-76060' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:30:49.828 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'DisplaySoftwareVersion':'11.1' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:30:49.828 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'MACAddress':'48:A6:B8:61:32:AE' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:30:49.828 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'SerialNumber':'48-A6-B8-61-32-AE:C' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:30:49.828 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'CurrentConfiguration':'1' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:30:49.828 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'CurrentIcon':'x-rincon-roomicon:tvroom' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:30:49.828 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'Flags':'0' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:30:49.828 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'IPAddress':'192.168.1.52' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:30:49.829 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'HardwareVersion':'1.24.1.12-1' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:30:49.829 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'CopyrightInfo':'© 2003-2019, Sonos, Inc. All rights reserved.' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:30:49.829 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'HTAudioIn':'21' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:30:49.840 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'CurrentLEDState':'Off' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:30:49.853 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'CurrentSleepTimerGeneration':'0' (service 'AVTransport') for thing 'sonos:CONNECTAMP:1'

Connect line-in
12:31:40.837 [upnp-main-129] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'LeftLineInLevel':'1' (service 'AudioIn') for thing 'sonos:CONNECTAMP:1'
12:31:40.837 [upnp-main-129] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'RightLineInLevel':'1' (service 'AudioIn') for thing 'sonos:CONNECTAMP:1'
12:31:40.837 [upnp-main-129] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'AudioInputName':'Audio Component' (service 'AudioIn') for thing 'sonos:CONNECTAMP:1'
12:31:40.837 [upnp-main-129] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'Icon':'AudioComponent' (service 'AudioIn') for thing 'sonos:CONNECTAMP:1'
12:31:40.837 [upnp-main-129] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'LineInConnected':'true' (service 'AudioIn') for thing 'sonos:CONNECTAMP:1'
12:31:40.908 [upnp-main-129] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'SystemUpdateID':'8' (service 'ContentDirectory') for thing 'sonos:CONNECTAMP:1'
12:31:40.909 [upnp-main-129] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'ContainerUpdateIDs':'AI:,1' (service 'ContentDirectory') for thing 'sonos:CONNECTAMP:1'
12:31:40.909 [upnp-main-129] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'ShareIndexInProgress':'false' (service 'ContentDirectory') for thing 'sonos:CONNECTAMP:1'
12:31:40.909 [upnp-main-129] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'ShareListUpdateID':'RINCON_000E5898B51801400,1055' (service 'ContentDirectory') for thing 'sonos:CONNECTAMP:1'
12:31:40.909 [upnp-main-129] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'FavoritesUpdateID':'RINCON_000E58294D3601400,50' (service 'ContentDirectory') for thing 'sonos:CONNECTAMP:1'
12:31:40.909 [upnp-main-129] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'SavedQueuesUpdateID':'RINCON_000E585405AE01400,169' (service 'ContentDirectory') for thing 'sonos:CONNECTAMP:1'
12:31:40.909 [upnp-main-129] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'FavoritePresetsUpdateID':'RINCON_000E58294D3601400,50' (service 'ContentDirectory') for thing 'sonos:CONNECTAMP:1'

Poll after
12:31:49.855 [-thingHandler-2] DEBUG o.o.b.s.i.handler.ZonePlayerHandler:151 - Polling job
12:31:49.892 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'CurrentZoneName':'TV Room' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:31:49.892 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'SoftwareVersion':'56.0-76060' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:31:49.892 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'DisplaySoftwareVersion':'11.1' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:31:49.892 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'MACAddress':'48:A6:B8:61:32:AE' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:31:49.892 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'SerialNumber':'48-A6-B8-61-32-AE:C' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:31:49.892 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'CurrentConfiguration':'1' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:31:49.892 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'CurrentIcon':'x-rincon-roomicon:tvroom' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:31:49.892 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'Flags':'0' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:31:49.892 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'IPAddress':'192.168.1.52' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:31:49.892 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'HardwareVersion':'1.24.1.12-1' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:31:49.892 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'CopyrightInfo':'© 2003-2019, Sonos, Inc. All rights reserved.' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:31:49.892 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'HTAudioIn':'21' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:31:49.904 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'CurrentLEDState':'Off' (service 'DeviceProperties') for thing 'sonos:CONNECTAMP:1'
12:31:49.916 [-thingHandler-2] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'CurrentSleepTimerGeneration':'0' (service 'AVTransport') for thing 'sonos:CONNECTAMP:1'
bobadair commented 4 years ago

When switching inputs, I got these messages:

switch.log:13:24:27.153 [upnp-main-30] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'AVTransportURI':'x-sonos-htastream:RINCON_48A6B86132AE01400:spdif' (service 'AVTransport') for thing 'sonos:CONNECTAMP:1'
switch.log:13:24:27.153 [upnp-main-30] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'AVTransportURIMetaData':'' (service 'AVTransport') for thing 'sonos:CONNECTAMP:1'
bobadair commented 4 years ago

BTW - When using the TV (HDMI ARC) input, the Amp supports night mode and speech enhancement, like some of the other new Sonos devices.

bobadair commented 4 years ago

And one other thing. When switching inputs, I saw some XML parsing errors in the log like the following:

13:23:46.233 [upnp-main-22] ERROR o.o.b.sonos.internal.SonosXMLParser:210 - Could not parse AV Transport from string '<Event xmlns="urn:schemas-upnp-org:metadata-1-0/AVT/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/"><InstanceID val="0"><TransportState val="PLAYING"/><Curr
entPlayMode val="NORMAL"/><CurrentCrossfadeMode val="0"/><NumberOfTracks val="1"/><CurrentTrack val="1"/><CurrentSection val="0"/><CurrentTrackURI val="x-rincon-stream:RINCON_48A6B86132AE01400"/><CurrentTrackDuration val=""/><CurrentTrackMetaData val="&lt;DIDL-Lite xmlns:dc=&quot;ht
tp://purl.org/dc/elements/1.1/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot; xmlns:r=&quot;urn:schemas-rinconnetworks-com:metadata-1-0/&quot; xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot;&gt;&lt;item id=&quot;-1&quot; parentID=&quot;-1&quot; r
estricted=&quot;true&quot;&gt;&lt;res protocolInfo=&quot;x-rincon-stream:*:*:*&quot;&gt;x-rincon-stream:RINCON_48A6B86132AE01400&lt;/res&gt;&lt;r:audioInputIcon&gt;&lt;/r:audioInputIcon&gt;&lt;dc:title&gt; &lt;/dc:title&gt;&lt;upnp:class&gt;object.item&lt;/upnp:class&gt;&lt;r:episod
eNumber&gt;0&lt;/r:episodeNumber&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;"/><r:NextTrackURI val=""/><r:NextTrackMetaData val=""/><r:EnqueuedTransportURI val=""/><r:EnqueuedTransportURIMetaData val=""/></InstanceID></Event>'
13:23:46.233 [upnp-main-22] ERROR o.o.b.sonos.internal.SonosXMLParser:225 - Could not parse MetaData from string '<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns=
"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="-1" parentID="-1" restricted="true"><res protocolInfo="x-sonos-htastream:*:*:*">x-sonos-htastream:RINCON_48A6B86132AE01400:spdif</res><r:audioInputIcon></r:audioInputIcon><r:streamInfo>0</r:streamInfo><dc:title> </dc:title><up
np:class>object.item</upnp:class><r:episodeNumber>0</r:episodeNumber></item></DIDL-Lite>'
lolodomo commented 4 years ago

Looking first at your device description, I discovered new services are now existing, they also exist on my devices, like for example urn:schemas-upnp-org:service:VirtualLineIn:1 or urn:schemas-sonos-com:service:Queue:1. This is something I should try to invcestiguate, I am not sure at all they were existing in the past. I have no idea what is this VirtualLineIn.

When switching inputs, I got these messages:

switch.log:13:24:27.153 [upnp-main-30] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'AVTransportURI':'x-sonos-htastream:RINCON_48A6B86132AE01400:spdif' (service 'AVTransport') for thing 'sonos:CONNECTAMP:1'
switch.log:13:24:27.153 [upnp-main-30] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'AVTransportURIMetaData':'' (service 'AVTransport') for thing 'sonos:CONNECTAMP:1'

This was for the HDMI input I guess ? You only provided the information once, not for each of both line inputs. I can guess what will be the result of the analog audio input but it would have been better to have it confirmed. With two line inputs, I think I need to consider two different channels, one per line-in.

lolodomo commented 4 years ago

Ok, I pushed a first version so that you can test (jar in the PR). Considering the logs you provided, I have a big doubt that the connection with HDMI line-in will be correctly detected. But let's try and see. PS: I forgot to check the XML parsing problem.

lolodomo commented 4 years ago

Regading your XML parsing errors, I added these two lines of code in the thing handler initialization, copying the XML from your message:

            SonosXMLParser.getAVTransportFromXML(
                    "<Event xmlns=\"urn:schemas-upnp-org:metadata-1-0/AVT/\" xmlns:r=\"urn:schemas-rinconnetworks-com:metadata-1-0/\"><InstanceID val=\"0\"><TransportState val=\"PLAYING\"/><CurrentPlayMode val=\"NORMAL\"/><CurrentCrossfadeMode val=\"0\"/><NumberOfTracks val=\"1\"/><CurrentTrack val=\"1\"/><CurrentSection val=\"0\"/><CurrentTrackURI val=\"x-rincon-stream:RINCON_48A6B86132AE01400\"/><CurrentTrackDuration val=\"\"/><CurrentTrackMetaData val=\"&lt;DIDL-Lite xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot; xmlns:r=&quot;urn:schemas-rinconnetworks-com:metadata-1-0/&quot; xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot;&gt;&lt;item id=&quot;-1&quot; parentID=&quot;-1&quot; restricted=&quot;true&quot;&gt;&lt;res protocolInfo=&quot;x-rincon-stream:*:*:*&quot;&gt;x-rincon-stream:RINCON_48A6B86132AE01400&lt;/res&gt;&lt;r:audioInputIcon&gt;&lt;/r:audioInputIcon&gt;&lt;dc:title&gt; &lt;/dc:title&gt;&lt;upnp:class&gt;object.item&lt;/upnp:class&gt;&lt;r:episodeNumber&gt;0&lt;/r:episodeNumber&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;\"/><r:NextTrackURI val=\"\"/><r:NextTrackMetaData val=\"\"/><r:EnqueuedTransportURI val=\"\"/><r:EnqueuedTransportURIMetaData val=\"\"/></InstanceID></Event>");
            SonosXMLParser.getMetaDataFromXML(
                    "<DIDL-Lite xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\" xmlns:r=\"urn:schemas-rinconnetworks-com:metadata-1-0/\" xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\"><item id=\"-1\" parentID=\"-1\" restricted=\"true\"><res protocolInfo=\"x-sonos-htastream:*:*:*\">x-sonos-htastream:RINCON_48A6B86132AE01400:spdif</res><r:audioInputIcon></r:audioInputIcon><r:streamInfo>0</r:streamInfo><dc:title> </dc:title><upnp:class>object.item</upnp:class><r:episodeNumber>0</r:episodeNumber></item></DIDL-Lite>");

And they produces no errors in my logs. So, sorry, I don't understand your XML parsing errors.

lolodomo commented 4 years ago

I don't have a TV that provides HDMI ARC

But you use the optical adapter to connect the Amp to your TV ?

lolodomo commented 4 years ago

In fact, my solution is ok to validate the Sonos Amp features but is not yet perfect. Because if you use the playlinein channel of another Sonos device with the UDN of the Sonos Amp device as command, the analog line-in will be considered in case both line-ins are connected. As the command is only the UDN (so a Sonos device), we have nothing to know the kind of line-in the user would like and the user will not be able to choose the kind of line-in he would like.

lolodomo commented 4 years ago

One solution could be to add the channels playanaloglinein and playdigitallinein to all Sonos devices, keeping the existinng playlinein channel to not break any current user setup with the Sonos binding.

lolodomo commented 4 years ago

Another solution that would avoid adding one channel for each kind of line inputs would be to accept an extended command format for the playlinein channel so that the user can define/select the Sonos device and the line input. It could be for example Analog,UDN for the analog line-in, Digital,UDN for the digital line-in. UDN as command would still consider one of the connected line-inputs and for a Sonos Amp, the analog line-in will be considered if both line-ins are connected.

This solution has the advantage that there is no need to add new channels on all Sonos things, even if in the future a new Sonos device is introduced with 3 or more line-inputs,

lolodomo commented 4 years ago

I finally implemented the second solution. The jar is in the PR for testing.

Just to clarify what needs to be tested:

  1. channel analoglinein (read only) : switch should be ON when your Sonos Amp analog line-in is connected. Without this working, the other channels relative to the analog line-in will not work.
  2. channel digitallinein (read only): switch should be ON when your Sonos Amp HDMI line-in is connected. Without this working, the other channels relative to the HDMI line-in will not work.
  3. channel playlinein of any Sonos thing including your Sonos Amp thing: pushing "Analog,RINCON_XXXXXX" or "RINCON_XXXXXX" as command should switch the source to your Sonos Amp analog line-in if connected. Pushing "Digital,RINCON_XXXXXX" as command should switch the source to your Sonos Amp HDMI line-in if connected.
  4. channel publicanalogaddress: pushing ON or OFF command to this channel should make all Sonos devices playing your Sonos Amp analog line-in
  5. channel publicdigitaladdress: pushing ON or OFF command to this channel should make all Sonos devices playing your Sonos Amp HDMI line-in
  6. Notification when your Sonos Amp analog line-in is playing. Analog line-in should be restored after the playback of the notification
  7. Notification when your Sonos Amp HDMI line-in is playing. HDMI line-in should be restored after the playback of the notification
  8. channels nightmode and speechenhancement: should be updated in openHAB when changed in the Sonos app; can be used as command too
bobadair commented 4 years ago

Thanks @lolodomo! I loaded the test jar on to my production system, which has 2.5.1 installed, and ran a quick test. Discovery properly detected the Amp, so I configured it in paper UI. The basic functions (play from the queue, etc.) worked as expected. Unfortunately, the analoglinein switch stayed off with the analog line-in input connected, even when I was playing audio from it. I don't have an HDMI ARC source (or the TOSLink adapter), so I wasn't able to test that, but I updated the thread on the forum yesterday asking if someone else could test the HDMI input.

bobadair commented 4 years ago

Regading your XML parsing errors, I added these two lines of code in the thing handler initialization, copying the XML from your message: And they produces no errors in my logs. So, sorry, I don't understand your XML parsing errors.

That is odd! I don't see those messages in the log with the test version, though, so let's just ignore it. That was running under Eclipse in my dev environment, so maybe there was some strangeness there.

lolodomo commented 4 years ago

Unfortunately, the analoglinein switch stayed off with the analog line-in input connected, even when I was playing audio from it.

I see this line in your logs:

12:31:40.837 [upnp-main-129] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'LineInConnected':'true' (service 'AudioIn') for thing 'sonos:CONNECTAMP:1'

This is what should set the channel analoglinein to ON. I have to check if I made a stupid mistake.

I don't have an HDMI ARC source (or the TOSLink adapter), so I wasn't able to test that,

So when you got that log, it was with the analog line-in ???

switch.log:13:24:27.153 [upnp-main-30] TRACE o.o.b.s.i.handler.ZonePlayerHandler:378 - Received pair 'AVTransportURI':'x-sonos-htastream:RINCON_48A6B86132AE01400:spdif' (service 'AVTransport') for thing 'sonos:CONNECTAMP:1'

If this is really the case, this is terribly strange because x-sonos-htastream:RINCON_XXXXX1400:spdif is what identifies the digital line-in for all other Sonos devices. Why do they use spdif for an analog line-in ??? In this case, I should introduce a very specific case in the code for the Sonos Amp.

bobadair commented 4 years ago

This is what should set the channel analoglinein to ON.

I definitely got that when I connected to the analog line-in, so I would expect it to work. I can test it again and collect the logs if you don't find a problem in the code.

So when you got that log, it was with the analog line-in ???

I believe that was when I selected the HDMI port as an input using the Sonos app, even though there was nothing connected to it. I can test that again as well, but I'm hoping that someone who is actually using the HDMI port can provide some better info here.

lolodomo commented 4 years ago

I believe that was when I selected the HDMI port as an input using the Sonos app, even though there was nothing connected to it. I can test that again as well, but I'm hoping that someone who is actually using the HDMI port can provide some better info here.

Ok, I presume it was the case and it would confirm the URI I was expecting for the HDMI input. So no problem on this point

lolodomo commented 4 years ago

I definitely got that when I connected to the analog line-in, so I would expect it to work. I can test it again and collect the logs if you don't find a problem in the code.

I see no problem in the code, your channel analoglinein should be updated to ON. Please take care to not have two versions of the binding installed: bundle:list -s | grep sonos Please check that the channel is linked to an item.

bobadair commented 4 years ago

It am definitely running the right version of the binding, because it discovered the Amp properly, and the channels are linked to items. However, when I looked at it again today I found that when I had (too) quickly configured it yesterday, I left the old zoneplayer thing as well as the new Amp thing configured and pointing to the same Amp device. I deleted the old thing, restarted openHAB for good measure, and it it seems to be working properly now. I get a good indication on the switch item connected to the analoglinein channel. However, sending ON to the publicanalogaddress channel doesn't seem to do anything. I'll have to do a bit more testing of that and the other features later tonight.

lolodomo commented 4 years ago

And playlinein channel ?

bobadair commented 4 years ago

Ok, here is what I was able to test so far:

  • channel analoglinein (read only) : switch should be ON when your Sonos Amp analog line-in is connected. Without this working, the other channels relative to the analog line-in will not work.

I've confirmed that this works.

  • channel digitallinein (read only): switch should be ON when your Sonos Amp HDMI line-in is connected. Without this working, the other channels relative to the HDMI line-in will not work.

I can't confirm if this works, as I don't have an HDMI ARC source to test it with.

  • channel playlinein of any Sonos thing including your Sonos Amp thing: pushing "Analog,RINCON_XXXXXX" or "RINCON_XXXXXX" as command should switch the source to your Sonos Amp analog line-in if connected.

I can confirm that both "Analog,RINCON_XXXXXX" and "RINCON_XXXXXX" work properly.

Pushing "Digital,RINCON_XXXXXX" as command should switch the source to your Sonos Amp HDMI line-in if connected.

I can't confirm this, but sending "Digital,RINCON_XXXXXX" results in the message: 2020-05-10 12:12:26.426 [DEBUG] [s.internal.handler.ZonePlayerHandler] - Line-in of RINCON_48A6B86132AE01400 is not connected in the log file, which seems correct.

  • channel publicanalogaddress: pushing ON or OFF command to this channel should make all Sonos devices playing your Sonos Amp analog line-in

This does create a group of all Sonos devices that have a sonos thing running against them, and send the analog line-in audio to them. However, I was unable to get it to stop and revert to the previous configuration. Both sending OFF and turning off the audio source seem to have no effect. But I haven't used this feature before, so I'm unsure how it is supposed to work.

  • channel publicdigitaladdress: pushing ON or OFF command to this channel should make all Sonos devices playing your Sonos Amp HDMI line-in

I wasn't able to test this since I don't have a digital source connected.

lolodomo commented 4 years ago

Ok, thank you for your feedback, I am now very confident that everything should work as expected.

bobadair commented 4 years ago

Ok, thank you for your feedback, I am now very confident that everything should work as expected.

Thanks for the quick update! BTW - Just for my own information, how do you get publicaddress to stop once it's been activated?

lolodomo commented 4 years ago

Stop or load a new source I guess. This is the same as when you play your line-in. The only difference is that you have a group with all Sonos.

bobadair commented 4 years ago

Stop or load a new source I guess. This is the same as when you play your line-in. The only difference is that you have a group with all Sonos.

Ah, ok. I had thought that when switched off it would automatically revert to the previous state (ungroup, switch sources, etc.) and that I was missing something. Thanks.