Package: alpyca
alpyca (2.0.4)Python 3.7+ API library for allASCOM Alpacauniversal interfacesProduced by theASCOM Initiative, and derived from Ethan Chappel's
Alpyca 1.0.0. Ethan kindly released the nameAlpycato the ASCOM Initiative, hence this expanded
package starts life as Version 2.0.RequirementsThis package runs under Python 3.7 or later. It is compatible with most Linux distros, Windows , and MacOS.
Dependencies are minimal:requests,netifaces,typing-extensions,python-dateutil, andenum-tools.InstallationThe package installs from PyPi aspipinstallalpycaor if you have the source code in a tar file, extract it and run (withPython 3)pythonsetup.pyinstallThe dependencies listed above (and others they may depend on) are automatically
installed with alpyca.Current Status & DocumentationThis version 2.0.4 is the third production release (2.0.3 is unpublished).
The documentation is extensive and available
online asAlpyca: API Library for Alpacaas well as aPDF Document here. SeeCHANGES.rst(on GitHub) for
change log.Feedback and DiscussionFeedback can be given on theASCOM Driver and Application Development Support Forum.
Please note that the protocols are universal and strictly curated. This library is animplementationof the protocols, not the protocols themselves. For background please visitAbout Alpaca and ASCOM, as well as theASCOM Interface Principle,The Standards Process, and
theGeneral Requirements.ExampleFirst download, install and run thecross-platformAlpaca Omni Simulatorwhich will give you fully functional simulators forallAlpaca devices, as well as aliveOpenAPI/Swagger interface to the Alpaca RESTful endpoints (see the details below). This example will
use the Telescope simulator. Assuming you are running the Omni Simulator on your local host
at its default port of 32323, its address is thenlocalhost:32323. Here is a sample
program using alpaca:importtimefromalpaca.telescopeimport*# Multiple Classes including Enumerationsfromalpaca.exceptionsimport*# Or just the exceptions you want to catchT=Telescope('localhost:32323',0)# Local Omni Simulatortry:T.Connected=Trueprint(f'Connected to{T.Name}')print(T.Description)T.Tracking=True# Needed for slewing (see below)print('Starting slew...')T.SlewToCoordinatesAsync(T.SiderealTime+2,50)# 2 hrs east of meridianwhile(T.Slewing):time.sleep(5)# What do a few seconds matter?print('... slew completed successfully.')print(f'RA={T.RightAscension}DE={T.Declination}')print('Turning off tracking then attempting to slew...')T.Tracking=FalseT.SlewToCoordinatesAsync(T.SiderealTime+2,55)# 5 deg slew N# This will fail for tracking being offprint("... you won't get here!")exceptExceptionase:# Should catch specific InvalidOperationExceptionprint(f'Slew failed:{str(e)}')finally:# Assure that you disconnectprint("Disconnecting...")T.Connected=FalseResultsConnected to Alpaca Telescope Sim
    Software Telescope Simulator for ASCOM
    Starting slew...
    ... slew completed successfully.
    RA=10.939969572854931 DE=50
    Turning off tracking then attempting to slew...
    Slew failed: SlewToCoordinatesAsync is not allowed when tracking is False
    Disconnecting...
    doneAlpaca Omni SimulatorsThe ASCOM Alpaca Simulators areavailable via GitHub here.
Using the [Latest] link, scroll down the
Assets section and pick the package for your OS and CPU type. Extract all files to a directory and start via./ascom-alpaca.simulators(or the equivalent on Windows or MacOS). A web browser should appear. This is the primary user interface to the simulator
server and simulated devices. Once you get this running you are ready to try the sample above.ASCOM RemoteAny current ASCOM COM device that is hosted on a Windows system can have an Alpaca interface added via theASCOM Remote Windows app. This app allows you to
expose any of your Windows-hosted astronomy devices to the Alpaca world, making them reachable from programs
using alpyca.WiresharkIf you are interested in monitoring the HTTP/REST traffic that alpyca creates and exchanges with the
Alpaca devices, you can install theWireshark network protocol analyzer.
One thing that trips people up is making the installation so that Wireshark has access to all of the
network insterfaces without needing root privs (linux) or running "As Administrator" on Windows. Pay close
attention the installation steps on this. On WIndows the capture driver installation will require elevation,
as it is a privileged module. For example installinn on Linux (e.g Debian/Raspberry Pi) you'll see this,
andbe sure to answer Yes.To watch Alpaca traffic, set this simple display filterhttp and tcp.port == 32323(with32323being the port of the OmniSim, see above). You'll get a nice analysis
of the Alpaca traffic like this