controller package

Submodules

controller.base_controller module

class controller.base_controller.Controller

Bases: object

This is an interface to control remote devices, such as Amp or Player. It uses asyncio.

Numeric values are normalised: 0 is min, 100 is max. Implementation should handle conversion to and from whatever values are actually used by the device.

The controller is asynchronous, so it’s not possible to return the exact status of the device at the time of the function call. The implementation should probably manage some sort of internal “cache” / last known good status.

Volume goes from min = 0 to max = 100

connect()
disconnect()
get_mute()
Return type:bool
get_volume()
Return type:int
set_mute()
set_unmute()
set_volume(value)
exception controller.base_controller.ControllerException

Bases: Exception

class controller.base_controller.ControllerStatus(volume=None, playback=None)

Bases: object

Holds last known status of the controller

This should only be modified by the controller

exception controller.base_controller.ControllerStatusException

Bases: controller.base_controller.ControllerException

class controller.base_controller.PlaybackState

Bases: enum.Enum

An enumeration.

ERROR = 4
PAUSED = 2
PLAYING = 1
STOPPED = 3
class controller.base_controller.PlaybackStatus(state)

Bases: object

class controller.base_controller.VolumeStatus

Bases: object

Holds volume related information.

Attributes can be None if they’re not yet known If value is not an integer, it will be rounded to the closest one.

MAX = 100
MIN = 0
mute
Return type:Optional[bool]
value
Return type:Optional[int]

controller.helpers module

controller.rotel module

class controller.rotel.RotelConfigBase(min_volume, max_volume, sources, speakers=None, source_control=False, tone=None, max_dimmer=None, separator='=', recv_end='$', send_end='!')

Bases: object

class controller.rotel.RotelController(host, port, config, loop=None)

Bases: object

Encapsulates a protocol to communicate with Rotel RS232 V2 capable amps.

This class uses asyncio to communicate with the amp. It is NOT thread-safe!

connect()
disconnect()
class controller.rotel.RotelPower

Bases: enum.Enum

An enumeration.

OFF = False
ON = True
class controller.rotel.RotelStatus(config)

Bases: object

update_status(amp_response)

Updates the status from a message received from the amp and returns whether something changed.

Return type:bool
volume
Return type:int
exception controller.rotel.RotelStatusException

Bases: Exception

class controller.rotel.RotelToneConfig(bypass=False, low=-10, high=10, bands=('bass', 'treble'))

Bases: object

exception controller.rotel.RotelVolumeException

Bases: controller.rotel.RotelStatusException

controller.volumio module

class controller.volumio.VolumioController(host, port=3000)

Bases: controller.base_controller.Controller

_get_state()
connect()
disconnect()
get_mute()
Return type:bool
get_volume()
Return type:int
handle_connect()
handle_disconnect()
handle_push_state(state)
max_vol = 100
min_vol = 0
set_mute()
set_unmute()
set_volume(value)

Module contents