Configuration Structures¶
This document shows all implemented classes that can be obtained through a method call in a client.
Classes¶
Volume¶
- class boseapi.model.Volume(root: Optional[Element] = None, actual_vol: int = 0, target_vol: int = 0, muted: bool = False)¶
A class representing the current Volume config.
- property actualvolume: int¶
The actual volume value.
- static body(level: int) str¶
Returns the POST body for changing the current volume.
- is_muted() bool¶
Returns whether the device is muted.
- property targetvolume: int¶
A volume value which will be targeted.
ZoneSlave¶
- class boseapi.model.ZoneSlave(root: Optional[Element] = None, ip_address: Optional[str] = None, role: Optional[str] = None, device_id: Optional[str] = None)¶
A class representing a multiroom slave.
- property deviceid: str¶
The stored device id.
- property devicerole: str¶
An optional role for that device.
- property ipaddress: str¶
The ip address this slave belongs to.
Zone¶
- class boseapi.model.Zone(root: Optional[Element] = None, device_id: Optional[str] = None, ip: Optional[str] = None, slaves: Optional[list] = None)¶
A class representing a mutliroom master.
This class contains a list-like implementation to store the different ZoneSlaves.
- is_zone_master() bool¶
Returns whether this zone object is a zone master.
- property masterid: str¶
The master id.
- property masterip: str¶
The master ip address.
- to_xml() str¶
Converts this object into a xml representation.
Example behaviour of a Zone object:
from boseapi.model import Zone, ZoneSlave
zone = Zone(device_id='ID', device_ip='127.0.0.1')
zone.append(ZoneSlave(device_id='ID2', device_ip='127.0.0.2'))
# Len()
assert len(zone) != 0
# Iterations:
for slave in zone:
# act on each slave object
for i in range(len(zone)):
slave = zone[i]
# Get/Set
zone[0] = ZoneSlave(device_id='ID3', device_ip='127.0.0.3')
slave3 = zone[0]
InfoNetworkConfig¶
Status¶
- class boseapi.model.Status(root: Element)¶
A class covering all information about the current ContentItem.
An object of this class can be obtained when querying the nowPlaying node.
- property album: str¶
If present, the album of the playing track.
- property artist: str¶
If present, the creator of the track.
- property contentitem: ContentItem¶
The selected ContentItem.
- property description: str¶
If present, this property contains a brief description that was added to the track.
- property duration: str¶
The track’s duration.
- property image: str¶
If present, a link/URL to the cover image of the track.
- property play_status: str¶
Indicates whether the device is currently playing the embedded track.
- property repeat_setting: bool¶
True, if repeat is enabled, false otherwise.
- property shuffle_setting: bool¶
True, if shuffle is enabled, false otherwise.
- property source: str¶
The media source: should be one of the sources defined in boseapi.common.source
- property station: str¶
If present, the station’s name.
- property stationlocation: str¶
The station’s location.
- property streamtype: str¶
The stream type of the current track (TRACK_ONDEMAND when playing from an external resource).
- property track: str¶
If present, the current media file name.
- property trackid: str¶
The track’s id.
ContentItem¶
- class boseapi.model.ContentItem(src: Optional[str] = None, account: Optional[str] = None, media_type: Optional[str] = None, location: Optional[str] = None, root: Optional[Element] = None, name: Optional[str] = None)¶
A class covering all information about the media source.
Instances of this class can be used to switch the input source of media.
- is_presetable() bool¶
Returns True if this content item can be saved as a Preset.
- property itemtype: str¶
Specifies the type of this item.
- property location: str¶
If present, a direct link to the media.
- property name: str¶
The item’s name.
- property source: str¶
The media source type. This value is defined at boseapi.common.source.
- property sourceaccount: str¶
The source account this content item is played with.
- property xml_str: str¶
The item object as an XML string.
SimpleConfig¶
- class boseapi.model.SimpleConfig(root: Element)¶
A class used to represent single node XML-response.
On init, this object takes all stored attributes and the text from an XML-Element.
- property attrib: dict¶
The stored attributes. (Only ‘bearertoken’ uses them)
- property configname: str¶
The XML tag name.
- property value: str¶
The stored text value from the XML-Element.
Bass¶
BassCapabilities¶
Balance¶
- class boseapi.model.Balance(root: Element)¶
A class to represent the balance configuration.
- property actual: int¶
The actual value of balance.
- property available: bool¶
True, if a balance fconfiiguration can be altered.
- property default: int¶
The default balance value.
- property max: int¶
The maximum of balance.
- property min: int¶
The minimum of balance.
- property target: int¶
The targeted value of balance.
Capabilities¶
- class boseapi.model.Capabilities(root: Element)¶
The global capabilities storage.
This class contains important configuration values, such as wsapiproxy which indicates whether the WebSocket notification API can be used.
Next, a capabilities object shows whether a clock display is available or the device can run in dualMode. Each device comes along with different additional features, which are also stored in this class with a dict-like implementation with the following mapping: self[cap.name] = cap.url.
- property bcoresetCapable¶
Returns whether the device contains a BOSE coreset.
- property clockDisplay¶
Returns whether the clock display is available.
- property disablePowerSaving¶
Returns whether the power saving mode can be disabled.
- property dualMode¶
Returns whether the device can run in dual mode.
- property lightswitch¶
Returns whether the lightswitch can be used.
- property lrStereoCapable¶
Returns whether the device is left-right stereo capable.
- property wsapiproxy¶
Returns whether the WebSocket API can be used on port 8080.
from boseapi.all import new_device, SoundTouchClient
device = new_device('127.0.0.1')
with SoundTouchClient(device) as client:
capabilities = client.capabilities()
# iterate over all additional capabilities if len() > 0
if len(capabilities) > 0:
for cap_name in capabilities:
cap_url = capabilites[cap_name]
ClockConfig¶
- class boseapi.model.ClockConfig(root)¶
A class storing the current clock configuration.
- property brightnessLevel¶
Used to dispaly the clock time.
- property timeFormat¶
The time format with the following form: TIME_FORMAT_xxHOUR_ID.
- property timezoneInfo¶
The device’s timezone.
- property userEnable¶
A value indicating whether the timezone can be altered by a user.
- property userOffsetMinute¶
The offset in relation to the utc time.
- property userUtcTime¶
The current utc time.