# motionmount package

## Submodules

## motionmount.motionmount module

class motionmount.motionmount.MotionMount(address: str, port: int)

  Bases: `object`

  Class to represent a MotionMount.

  You can create one with the IP address and port number which should be used to connect.

  After creation, you should call connect first, before accessing other properties.

  When you’re done, call disconnect to clean up resources.

  Args:

    address (str): The IP address of the MotionMount. port (int): The port number to use for the connection. notification_callback: Will be called when a notification has been received.

  add_listener(callback: Callable[[], None]) → None

    Register callback as a listener for updates.

  async authenticate(pin: int)

    Provide a pin to authenticate.

    Args:

      pin (int): The pin code for the ‘User’ level to authenticate with (1-9999)

    Raises:

      ValueError: If the pin code is outside the range.

  property can_authenticate: bool | int

    Indicates whether we can authenticate. When there are too many failed authentication attempts the MotionMount enforces a backoff time. This propperty either returns True if authentication is possible or the (last known) backoff time.

  async connect() → None

    Connect to the MotionMount.

    Properties that are updated by notifications are pre-fetched

  async disconnect() → None

    Disconnect from the MotionMount.

  property error_status: int | None

    The error status of the MotionMount. See the protocol documentation for details. It’s recommended to use the system_status property for pre-parsed status information

  property extension: int | None

    The current extension of the MotionMount, normally between 0 - 100 but slight excursions can occur due to calibration errors, mechanical play and round-off errors

  async get_presets() → List[Preset]

    Gets the valid user presets from the device.

  async go_to_position(extension: int, turn: int)

    Go to a specific position.

    Args:

      extension (int): The extension value (0 - 100) turn (int): The turn value. (-100 - 100)

    Raises:

      ValueError: If the extension or turn values are out of range.

  async go_to_preset(position: int)

    Go to a preset position. Preset 0 is the (fixed) Wall position.

    Args:

      position (int): The preset position to go to (0 - 7).

    Raises:

      ValueError: If the position is out of range.

  property is_authenticated: bool

    Indicates whether we’re authenticated to the MotionMount (or no authentication is needed).

  property is_connected: bool
  property is_moving: bool | None

    When true the MotionMount is (electrically) moving to another position

  property mac: bytes

    Returns the (primary) mac address

  property name: str | None

    Returns the name

  remove_listener(callback: Callable[[], None]) → None
  async set_extension(extension: int)

    Set the extension value.

    Args:

      extension (int): The extension value (0 - 100).

    Raises:

      ValueError: If the extension value is out of range.

  async set_turn(turn: int)

    Set the turn value.

    Args:

      turn (int): The turn value (-100 - 100).

    Raises:

      ValueError: If the turn value is out of range.

  property system_status: MotionMountSystemError

    The status of the MotionMount. These flags are aggregated errors from the underlying detailed errors.

  property target_extension: int | None

    The most recent extension the MotionMount tried to move to

  property target_turn: int | None

    The most recent turn the MotionMount tried to move to

  property turn: int | None

    The current rotation of the MotionMount, normally between -100 - 100 but slight excursions can occur due to calibration errors, mechanical play and round-off errors

  async update_authentication_status()

    Fetch authentication status from the MotionMount.

  async update_error_status()

    Fetch the error status from the MotionMount

  async update_name()

    Update the name of the MotionMount.

  async update_position()

    Fetch the current position of the MotionMount.

exception motionmount.motionmount.MotionMountError

  Bases: `Exception`

  Base exception class for MotionMount errors.

class motionmount.motionmount.MotionMountResponse(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntEnum`

  Enum representing possible response codes from MotionMount. These are derived from HTTP response code and have a corresponding meaning.

  Accepted = 202
  BadRequest = 400
  Forbidden = 403
  MethodNotAllowed = 405
  NotFound = 404
  URITooLong = 414
  Unauthorised = 401
  Unknown = 0

exception motionmount.motionmount.MotionMountResponseError(value: MotionMountResponse)

  Bases: `MotionMountError`

  Exception raised for MotionMount response errors.

  Attributes:

    response_value (MotionMountResponse): The response code received.

class motionmount.motionmount.MotionMountSystemError(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntFlag`

  Enum representing the (aggregated) system errors of the MotionMount.

  HDMICECError = 2
  InternalError = 16
  MotorError = 1
  ObstructionDetected = 4
  TVWidthConstraintError = 8

class motionmount.motionmount.MotionMountValueType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `Enum`

  Enum representing possible value types for MotionMount requests.

  Bool = (3,)
  Bytes = (2,)
  IPv4 = (4,)
  Integer = (0,)
  String = (1,)
  Void = (5,)

exception motionmount.motionmount.NotConnectedError

  Bases: `MotionMountError`

  Exception raised when not connected to MotionMount.

class motionmount.motionmount.Preset(index, name, extension, turn)

  Bases: `object`

  Class for storing preset related data

  extension: int
  index: int
  name: str
  turn: int

class motionmount.motionmount.Request(key: str, value_type: MotionMountValueType, value: str | None = None)

  Bases: `object`

  Represents a request to be sent to the MotionMount.

  Args:

    key (str): The key for the request. value_type (MotionMountValueType): The value type for the request. value (Optional[str]): The optional value for the request.

  Attributes:

    key (str): The key for the request. value_type (MotionMountValueType): The value type for the request. value (Optional[str]): The optional value for the request. future (asyncio.Future): The asyncio Future associated with the request.

  encoded() → bytes

    Encodes this request for sending over the network.

    Returns:

      bytes: The encoded request.

## Module contents