Focuser Class
Master Interfaces Reference
These green boxes in each interface member each have a link to the corresponding member definition in Master IFocuserV4 Interface (external). The information in this Alpyca document is provided for your convenience. If there is any question, the info in ASCOM Master Interface Definitions (external) is the official specification.
- class alpaca.focuser.Focuser(address: str, device_number: int, protocol: str = 'http')
Bases:
DeviceASCOM Standard IFocuserV3 Interface
Attention
It is possible to command the focuser to a position exceeding its limits (see notes for
MaxStep) without receiving an exception. This is by design.Initialize Focuser object.
- Parameters:
address (
str) – IP address and port of the device (x.x.x.x:pppp)device_number (
int) – The index of the device (usually 0)protocol (
str, optional) – Only if device needs https. Defaults to “http”.
- Action(ActionName: str, *Parameters) str
Invoke the specified device-specific custom action
Common to all devices
- Parameters:
ActionName – A name from
SupportedActionsthat represents the action to be carried out.*Parameters – List of required parameters or [] if none are required.
- Returns:
String result of the action.
- Raises:
NotImplementedException – If no actions at all are supported
ActionNotImplementedException – If the driver does not support the
requested – ActionName. The supported action names are listed in
SupportedActions.NotConnectedException – If the device is not connected
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
This method, combined with
SupportedActions, is the supported mechanic for adding non-standard functionality.
Master Interfaces Reference
Alpyca uses a common Device class but this is not available in the ASCOM Master Interface Definitions (external). To see the reference info for
Action(), find this specific device’s specification, and seeAction()there.
- CommandBlind(Command: str, Raw: bool) None
Transmit an arbitrary string to the device and does not wait for a response.
Common to all devices
- Parameters:
Command – The literal command string to be transmitted.
Raw – If true, command is transmitted ‘as-is’. If false, then protocol framing characters may be added prior to transmission.
- Raises:
NotImplementedException – If no actions at all are supported
NotConnectedException – If the device is not connected
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Attention
Deprecated, will most likely result in
NotImplementedExceptionMaster Interfaces Reference
Alpyca uses a common Device class but this is not available in the ASCOM Master Interface Definitions (external). To see the reference info for
CommandBlind(), find this specific device’s specification, and seeCommandBlind()there.
- CommandBool(Command: str, Raw: bool) bool
Transmit an arbitrary string to the device and wait for a boolean response.
Common to all devices
- Returns:
The True/False response from the command
- Parameters:
Command – The literal command string to be transmitted.
Raw – If true, command is transmitted ‘as-is’. If false, then protocol framing characters may be added prior to transmission.
- Raises:
NotImplementedException – If no actions at all are supported
NotConnectedException – If the device is not connected
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Attention
Deprecated, will most likely result in
NotImplementedExceptionMaster Interfaces Reference
Alpyca uses a common Device class but this is not available in the ASCOM Master Interface Definitions (external). To see the reference info for
CommandBlind(), find this specific device’s specification, and seeCommandBlind()there.
- CommandString(Command: str, Raw: bool) str
Transmit an arbitrary string to the device and wait for a string response.
Common to all devices
- Returns:
The string response from the command
- Parameters:
Command – The literal command string to be transmitted.
Raw – If true, command is transmitted ‘as-is’. If false, then protocol framing characters may be added prior to transmission.
- Raises:
NotImplementedException – If no actions at all are supported
NotConnectedException – If the device is not connected
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Attention
Deprecated, will most likely result in
NotImplementedExceptionMaster Interfaces Reference
Alpyca uses a common Device class but this is not available in the ASCOM Master Interface Definitions (external). To see the reference info for
CommandString(), find this specific device’s specification, and seeCommandString()there.
- Connect() None
Connect to the device asynchronously.
Common to all devices
- Returns:
Nothing
- Raises:
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
Non-Blocking Use
Connectingto indicate completion.Natively present only in Platform 7 (2024) devices, but this library emulates Connect()/Disconnect()/Connecting mechanic for older devices.
Master Interfaces Reference
Alpyca uses a common Device class but this is not available in the ASCOM Master Interface Definitions (external). To see the reference info for
Connect(), find this specific device’s specification, and seeConnect()there.
- Disconnect() None
Disconnect from the device asynchronously.
Common to all devices
- Returns:
Nothing
- Raises:
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
Non-Blocking Use
Connectingto indicate completion.Natively present only in Platform 7 (2024) devices, but this library emulates Connect()/Disconnect()/Connecting mechanic for older devices.
Master Interfaces Reference
Alpyca uses a common Device class but this is not available in the ASCOM Master Interface Definitions (external). To see the reference info for
Disconnect(), find this specific device’s specification, and seeDisconnect()there.
- Halt() None
Immediately stop any focuser motion due to a previous
Move()call.- Raises:
NotImplementedException – The focuser cannot be programmatically halted.
NotConnectedException – If the device is not connected
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
You should try to call this method aftr initialization to see if halting is supported by your device. You can use this info to possibly disable a Halt button in your user interface.
Master Interfaces Reference
Focuser.Halt() (external)
- Move(Position: int) None
Starts moving the focuser to a new position
Non-blocking: Returns immediately after successfully starting the focus change with
IsMoving= True. See Notes, and How can I tell if my asynchronous request failed after being started?See Notes for details on absolute versus relative focusers
- Parameters:
Position – Step distance or absolute position, depending on the value of the
Absoluteproperty.- Raises:
InvalidValueException – If Position would result in a movement beyond
MaxStep.InvalidOperationException – IFocuserV2 and earlier only Raised if
TempCompis true and a Move() is attempted. This restriction was removed in IFocuserV3, but you must be prepared to catch this for older focusers (2018).NotImplementedException – The focuser cannot be programmatically halted.
NotConnectedException – If the device is not connected
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
Asynchronous (non-blocking): The method returns as soon as the focus change operation has been successfully started, with the
IsMovingproperty True. After the requested position is successfully reached and motion stops, theIsMovingproperty becomes False. See How can I tell if my asynchronous request failed after being started?If the
Absoluteproperty is True, then this is an absolute positioning focuser. TheMove()method tells the focuser to move to an exact step position, and the Position parameter of theMove()method is an integer between 0 andMaxStep.If the
Absoluteproperty is False, then this is a relative positioning focuser. TheMove()method tells the focuser to move in a relative direction. The Position parameter of theMove()method is actually a step distance and is an integer between minusMaxIncrementand plusMaxIncrement.
Master Interfaces Reference
Focuser.Move() (external)
- property Absolute: bool
The focuser does absolute positioning. See
Move().- Raises:
NotConnectedException – If the device is not connected
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
True means the focuser is capable of absolute position; that is, being commanded to a specific step location. False means this is a relative positioning focuser.
Master Interfaces Reference
Focuser.Absolute (external)
- property Connected: bool
(Read/Write) Retrieve or set the connected state of the device.
Common to all devices
Set True to connect to the device hardware. Set False to disconnect from the device hardware. You can also read the property to check whether it is connected. This reports the current hardware state. See Notes below.
- Raises:
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
The
Connectedproperty sets and reports the state of connection to the device hardware. For a hub this means thatConnectedwill beTruewhen the first driver connects and will only be set to False when all drivers have disconnected. A second driver may find thatConnectedis alreadyTrueand settingConnectedto False does not reportConnectedas False. This is not an error because the physical state is that the hardware connection is stillTrue.Multiple calls setting
ConnectedtoTrueor false will not cause an error.
Master Interfaces Reference
Alpyca uses a common Device class but this is not available in the ASCOM Master Interface Definitions (external). To see the reference info for
Connected, find this specific device’s specification, and seeConnectedthere.
- property Connecting: bool
Returns
Truewhile the device is undertaking an asynchronousConnect()orDisconnect()operation.Common to all devices
- Raises:
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
Use this property to determine when an (async)
Connect()orDisconnect()has completed, at which time it will transition fromTruetoFalse.Natively present only in Platform 7 (2024) devices, but this library emulates Connect()/Disconnect()/Connecting mechanic for older devices.
Master Interfaces Reference
Alpyca uses a common Device class but this is not available in the ASCOM Master Interface Definitions (external). To see the reference info for
Connecting, find this specific device’s specification, and seeConnectingthere.
- property Description: str
Description of the device such as manufacturer and model number.
Common to all devices
- Raises:
NotConnectedException – If the device status is unavailable
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
This describes the device, not the driver. See the
DriverInfoproperty for information on the ASCOM driver.The description length will be a maximum of 64 characters so that it can be used in FITS image headers, which are limited to 80 characters including the header name.
Master Interfaces Reference
Alpyca uses a common Device class but this is not available in the ASCOM Master Interface Definitions (external). To see the reference info for
Description, find this specific device’s specification, and seeDescriptionthere.
- property DeviceState: List[dict]
List of key-value pairs representing the operational properties of the device
Common to all devices
- Raises:
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Master Interfaces Reference
Alpyca uses a common Device class but this is not available in the ASCOM Master Interface Definitions (external). To see the reference info for
DeviceState, find this specific device’s specification, and seeDeviceStatethere.
- property DriverInfo: List[str]
Descriptive and version information about the ASCOM driver
Common to all devices
- Returns:
Python list of strings (see Notes)
- Raises:
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
This describes the driver not the device. See the
Descriptionproperty for information on the device itselfThe return is a Python list of strings, the total length of which may be hundreds to thousands of characters long. It is intended to display detailed information on the ASCOM (COM or Alpaca) driver, including version and copyright data. . To get the driver version in a parse-able string, use the
DriverVersionproperty.
Master Interfaces Reference
Alpyca uses a common Device class but this is not available in the ASCOM Master Interface Definitions (external). To see the reference info for
DriverInfo, find this specific device’s specification, and seeDriverInfothere.
- property DriverVersion: str
String containing only the major and minor version of the driver.
Common to all devices
- Raises:
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
This must be in the form “n.n”. It should not to be confused with the
InterfaceVersionproperty, which is the version of this specification supported by the driver. Note: on systems with a comma as the decimal point you may need to make accommodations to parse the value.
Master Interfaces Reference
Alpyca uses a common Device class but this is not available in the ASCOM Master Interface Definitions (external). To see the reference info for
DriverVersion, find this specific device’s specification, and seeDriverVersionthere.
- property InterfaceVersion: int
ASCOM Device interface definition version that this device supports.
Common to all devices
- Raises:
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
This is a single integer indicating the version of this specific ASCOM universal interface definition. For example, for ICameraV3, this will be 3. It should not to be confused with the
DriverVersionproperty, which is the major.minor version of the driver for this device.This value is cached internally after first retrieval since it is repeatedly used if emulating Connect/Disconnect semantics on older (pre - Platform 7) devioces.
Master Interfaces Reference
Alpyca uses a common Device class but this is not available in the ASCOM Master Interface Definitions (external). To see the reference info for
InterfaceVersion, find this specific device’s specification, and seeInterfaceVersionthere.
- property IsMoving: bool
The focuser is currently moving to a new position
- Raises:
NotConnectedException – If the device is not connected
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
Master Interfaces Reference
Focuser.IsMoving (external)
- property MaxIncrement: int
Maximum number of steps allowed in one
Move()operation.- Raises:
NotConnectedException – If the device is not connected
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
For most focusers this is the same as the
MaxStepproperty. This is normally used to limit the increment display in the host software.
Master Interfaces Reference
Focuser.MaxIncrement (external)
- property MaxStep: int
Maximum step position permitted.
- Raises:
NotConnectedException – If the device is not connected
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
The focuser can step between 0 and MaxStep. If an attempt is made to move the focuser beyond these limits, it will automatically stop at the limit.
Master Interfaces Reference
Focuser.MaxStep (external)
- property Name: str
The short name of the driver, for display purposes.
Common to all devices
- Raises:
DriverException – If the driver cannot successfully complete the request. This exception may be encountered on any call to the device.
Master Interfaces Reference
Alpyca uses a common Device class but this is not available in the ASCOM Master Interface Definitions (external). To see the reference info for
Name, find this specific device’s specification, and seeNamethere.
- property Position: int
Current focuser position, in steps.
- Raises:
NotImplementedException – The device is a relative focuser (
Absoluteis False)NotConnectedException – If the device is not connected
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
Master Interfaces Reference
Focuser.Position (external)
- property StepSize: float
Step size (microns) for the focuser.
- Raises:
NotImplementedException – If the device does not intrinsically know what the step size is.
NotConnectedException – If the device is not connected
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Master Interfaces Reference
Focuser.StepSize (external)
- property SupportedActions: List[str]
The list of custom action names supported by this driver
Common to all devices
- Returns:
Python list of strings (see Notes)
- Raises:
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
This method, combined with
Action(), is the supported mechanic for adding non-standard functionality.SupportedActions is a “discovery” mechanism that enables clients to know which Actions a device supports without having to exercise the Actions themselves. This mechanism is necessary because there could be people / equipment safety issues if actions are called unexpectedly or out of a defined process sequence. It follows from this that SupportedActions must return names that match the spelling of
Action()names exactly, without additional descriptive text. However, returned names may use any casing because the ActionName parameter ofAction()is case insensitive.
Master Interfaces Reference
Alpyca uses a common Device class but this is not available in the ASCOM Master Interface Definitions (external). To see the reference info for
SupportedActions, find this specific device’s specification, and seeSupportedActionsthere.
- property TempComp: bool
(read/write) Set or indicate the state of the focuser’s temp compensation.
- Raises:
NotImplementedException – On writing to TempComp, if
TempCompAvailableis False, indicating that this focuser does not have temperature compensation. In that case reading TempComp will always return False.NotConnectedException – If the device is not connected
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
Setting TempComp to True puts the focuser into temperature tracking mode; setting it to False will turn off temperature tracking.
If
TempCompAvailableis False this property will always return False.
Master Interfaces Reference
Focuser.TempComp (external)
- property TempCompAvailable: bool
If focuser has temperature compensation available.
- Raises:
NotConnectedException – If the device is not connected
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Master Interfaces Reference
Focuser.TempCompAvailable (external)
- property Temperature: float
Current ambient temperature (deg. C).
- Raises:
NotImplementedException – The temperature is not available for this device.
NotConnectedException – If the device is not connected
DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Note
Historically (prior to 2019) no units were specified for this property. You should assume this this is in degrees Celsius but old devices may supply temperature in other units. By now (2022) however devices should be providing degrees celsius.
Master Interfaces Reference
Focuser.Temperature (external)