bosesoundtouchapi.soundtouchdevice

@export
class SoundTouchDevice:

This class contains device-related information, such as: host ip address, device name/type/id, a list of the device's components, a list of supported URLs and the current network configuration.

The supported URLs are used by the SoundTouchClient to verify the requested URL is supported by the device.

In order to load all properties and attributes of the SoundTouchDevice object, some special URLs will be queried: - http://host:8090/info (contains basic device information) - http://host:8090/supportedURLs (contains URL's supported by the device)

Click the Sample Code links in the individual methods for sample code examples.

SoundTouchDevice( host: str, connectTimeout: int = 30, proxyManager: urllib3.poolmanager.ProxyManager = None, port: int = 8090)

Initializes a new instance of the class.

Arguments:
  • host (str): An Ipv4 address of the device; it must the following regular expression pattern for a IP V4 network address: r"\d{1,3}([.]\d{1,3}){3}".
  • connectTimeout (int): Controls how long (in seconds) a connection request is allowed to run before being aborted.
    Only used if the proxy argument is null (e.g. default proxy manager is used).
    Default is 30 seconds.
  • proxyManager (Optional[urllib3.ProxyManager]): If a custom proxy should be used, it can be specified here; otherwise, a default urllib3.PoolManager is used for http requests / responses.
  • port (int): IPV4 port number the Bose WebAPI is listening on for incoming requests on the device. Default is 8090, the standard WebAPI port number.

This method loads all components and device properties allocated at the given SoundTouch host.

Sample Code

from bosesoundtouchapi import *

try:

    # create SoundTouch device instance.
    device:SoundTouchDevice = SoundTouchDevice("192.168.1.131") # Bose SoundTouch 10

    # display device basic details and all installed components.
    print(device.ToString(True))

    # iterate over all components that match the given category.
    print("\nDisplaying specific components - SCM ...")
    for component in device.GetComponents('SCM'):
        print(component.ToString())

    # iterate over all components that match the given category.
    print("\nDisplaying specific components - LPM ...")
    for component in device.GetComponents('LPM'):
        print(component.ToString())

    # iterate over all components that match the given category.
    print("\nDisplaying specific components - LPMBL ...")
    for component in device.GetComponents('LPMBL'):
        print(component.ToString())

    # iterate over all components that match the given category.
    print("\nDisplaying specific components - BASS ...")
    for component in device.GetComponents('BASS'):
        print(component.ToString())

    # dump the webapi list of uri's this device supports.
    print("\nSupported URI's for device '%s':" % (device.DeviceName))
    for item in device.SupportedUris:
        print("- %s" % (str(item)))

except Exception as ex:

    print("** Exception: %s" % str(ex))

Components: list

A list of SoundTouchDeviceComponent objects containing various information about the device's components (e.g. SCM, LPM, BASS, etc).

CountryCode: str

The country code of the device as assigned by the manufacturer (e.g. 'US', etc).

DeviceId: str

The unique device identifier as assigned by the manufacturer (e.g. '9070658C9D4A', etc).

DeviceName: str

The friendly name assigned to the SoundTouch device (e.g. 'Home Theater SoundBar', etc).

DeviceType: str

The type of device as assigned by the manufacturer (e.g. 'SoundTouch 10', 'SoundTouch 300', etc).

Host: str

An Ipv4 address of the SoundTouch device. This property is read-only, and supplied by the class constructor.

LogReadUrl: str

The URL to download a logread file from this device.

The format of the returned url is:
http://{Host}:8091/logread.dat

Example with Host = '192.168.1.131':
http://192.168.1.131/logread.dat

ModuleType: str

The Radio module type used in the device, as assigned by the manufacturer (e.g. 'SM2', etc).

NetworkInfo: list

A list of SoundTouchNetworkConfig objects containing the current network configuration of the device.

Port: str

An Ipv4 address of the SoundTouch device. This property is read-only, and supplied by the class constructor.

RegionCode: str

The region code of the device as assigned by the manufacturer (e.g. 'US', etc).

StreamingAccountUUID: str

Bose Streaming account UUID, as assigned by the manufacturer (e.g. '6146078', etc).

StreamingUrl: str

Bose Streaming URL, as assigned by the manufacturer (e.g. 'https://streaming.bose.com', etc).

SupportedUris: list

A list of SoundTouchUri objects that the device supports.

These URI's are used by the SoundTouchClient class to obtain information from the device (e.g. info, now_Playing, etc).

PtsUrl: str

The URL to download a logread file.

The format of the returned url is:
http://{Host}:8091/pts.dat

Example with Host = '192.168.1.131':
http://192.168.1.131/pts.dat

UpnpUrl: str

The Universal Plug and Play (UPnP) root URL for this device.

The document located at the returned URL contains additional information about methods and properties that can be used with UPnP.

The format of the returned url is:
http://{Host}:8091/XD/BO5EBO5E-F00D-FEED-{DeviceId}.xml

Example with Host = '192.168.1.131', DeviceId = 'E8EB11B9B723':
http://192.168.1.131:8091/XD/BO5EBO5E-F00D-FEED-E8EB11B9B723.xml

Variant: str

The variant node value (e.g. 'ginger', etc).

VariantMode: str

The variant node value (e.g. 'noap', etc).

def GetComponents( self, componentCategory: str) -> bosesoundtouchapi.soundtouchdevicecomponent.SoundTouchDeviceComponent:

Iterates over all components discovered at class initialization that match the given category.

Arguments:
  • componentCategory (str): The component's category
Returns:

An iterator over the filtered SoundTouchDeviceComponent components.

This yields a device component for the given category.

def ToString(self, includeItems: bool = False) -> str:

Returns a displayable string representation of the class.

Arguments:
  • includeItems (bool): True to include all items in the list; otherwise False to only include the base list.