A simple ASCOM Alpaca SafetyMonitor API simulator for testing purposes. This simulator provides a mock SafetyMonitor device that can have its weather status (safe/unsafe) changed in real-time through the console.
- Implements the essential
/safetymonitor/{device_number}/issafeendpoint - Weather status can be changed on-the-fly without restarting
- Simple console interface for controlling the weather state
- Compatible with your existing Alpaca weather client
- Python 3.6 or higher
python alpaca_simulator.py [--port PORT]Options:
--port PORT: Port to run the server on (default: 11111)
Once the simulator is running, you can use the following commands in the console:
safe: Set weather to safe conditionsunsafe: Set weather to unsafe conditionstoggle: Toggle between safe and unsafestatus: Display current weather statusexitorquit: Exit the simulator
Configure your client to connect to the simulator with the following settings:
alpaca:
host: "127.0.0.1" # Local machine
port: 11111 # Default simulator port
device_number: 0 # Device number (default)The simulator follows the Alpaca API response format:
{
"ClientTransactionID": 1747081479,
"ErrorNumber": 0,
"ErrorMessage": "",
"ServerTransactionID": 717774164,
"Value": false
}Where Value indicates whether the conditions are safe (true) or unsafe (false).
The simulator implements the following endpoints:
GET /api/v1/server/interfaces- Returns available interfacesGET /api/v1/safetymonitor/0/issafe- Returns current weather safety statusGET /api/v1/safetymonitor/0/connected- Always returns truePUT /api/v1/safetymonitor/0/connected- Connection control (always succeeds)
This project is provided as free software.