Bose Devices

The core of this API is using a container class which stores all important information about a BOSE device. This document contains information about how a BoseDevice is structured and how a device can be obtained.

Interface Functions

boseapi.common.device.new_device(host: str, proxy: Optional[ProxyManager] = None) BoseDevice

Tries to create a new BoseDevice with a complete data section.

This method automatically reloads all components and device properties allocated at the given host. There will be a None result if the given host does not match the following pattern: r”d{1,3}([.]d{1,3}){3}”.

In order to load all properties and attributes of the BoseDevice object, some special URLs will be queried:

Arguments:
host: str

An IPv4 address og the target host.

proxy: Optional[urllib3.ProxyManager]

If a custom proxy should be used, it can be passed as a parameter.

Returns: Optional[BoseDevice]

If the host does not match the IPv4 pattern, None will be returned as a result.

Raises:
InterruptedError: An error occurred while fetching information from the

target host.

Classes

BoseDevice

class boseapi.common.device.BoseDevice(host: str, device_name: Optional[str] = None, device_type: Optional[str] = None, device_id: Optional[str] = None, components: Optional[list] = None, network_info: Optional[list] = None)

The most important object when working with the boseapi.

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. They are queried when invoking the new_device() method.

Attributes:
host: str

An Ipv4 address of the target host.

device_name: str

The current device’s name. The name is updated when using the name()-method in the SoundTouchClient.

device_type: str

The device’s type.

components: list[BoseDeviceComponent]

A small list containing various information about the device’s components.

network_info: list[NetworkConfig]

A list storing the current network configuration

supportedURLs: list[SoundTouchUri]

A list of usable URIs. These can be invoked using the SoundTouchClient.

get(component_category: str)

Iterates over all components that match the given category.

Parameters:

component_category (str) – the component’s category

Returns:

an iterator over the filtered components

Yield:

a device component

Return type:

Generator[BoseDeviceComponent, None, None]

get_logread_url() str

Returns the URL to download a logread file.

Returns: str A string-URL in the following format:

get_pts_url() str

Returns the URL to download a logread file.

Returns: str A string-URL in the following format:

get_upnp_url() str

Returns the UPnP root URL.

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

Returns: str An URL in the following format:

Usage of a simple BoseDevice:

from boseapi.common.device import new_device

device = new_device('127.0.0.1')

# iterating over device's components
for component in device:
  print(component.category)

# get the UPnP location
url = device.get_upnp_url()

BoseDeviceComponent

class boseapi.common.device.BoseDeviceComponent(category: Optional[str] = None, software_version: Optional[str] = None, serial_number: Optional[str] = None)

A small wrapper class to store component related data.

Attributes:
category: str

A simple string used to identify the component object.

software_version: str

If present, this attribute contains the current version the software is running with.

serial_number: str

As the name already states, this string contains a serial number if present.