SetExternalEvents Method Implementation Notes
SetExternalEvents Action (optional)
- Action Name:
SetExternalEvents - Action Parameters: A JSON encoded string containing an array of
SafetyEventobjects. - Returns:
string.Empty
//Example 1 - One event active
[
{
"Source":"ASCOM Sentinel at My Observatory",
"Name":"Observing conditions SkyBrightness",
"Id":"723e775aab_SkyBrightness",
"Type":"SkyBrightness",
"Trigger":"AboveThreshold",
"Description":"SkyBrightness rule 1 violated: Value 85.83 is greater than 0.25.",
"EventTimeUtc":"2026-04-15T08:05:03.2139641Z"
}
]
// Example 2 - Two events active
[
{
"Source":"ASCOM Sentinel at My Observatory",
"Name":"Observing conditions SkyBrightness",
"Id":"723e775aab_SkyBrightness",
"Type":"SkyBrightness",
"Trigger":"AboveThreshold",
"Description":"SkyBrightness rule 1 violated: Value 85.83 is greater than 0.25.",
"EventTimeUtc":"2026-04-15T08:05:03.2139641Z"
},
{
"Source":"ASCOM Sentinel at My Observatory",
"Name":"Observing conditions StarFWHM",
"Id":"723e775aab_StarFWHM",
"Type":"StarFWHM",
"Trigger":"AboveThreshold",
"Description":"StarFWHM rule 1 violated: Value 1.03 is greater than 0.8.",
"EventTimeUtc":"2026-04-15T08:05:03.2147037Z"
}
]The response has been whitespace formatted for readability, but the actual response should be a single line of JSON text without unnecessary whitespace.
Alpaca Clients and Devices
Alpaca clients must send an HTTP PUT request to the safety monitor's action endpoint as described here:
Alpaca Action Endpoint with application/x-www-form-urlencoded body parameters:
ActionName= "SetExternalEvents"ActionParameters= A string containing a JSON encoded array ofSafetyEventobjects.
Alpaca devices must return a standard Alpaca response object with:
Value= "" andErrorNumber= 0 if the request was successfulValue= "" andErrorNumber≠ 0 and a descriptiveErrorMessageif they cannot complete the request.
{
"Value":"",
"ClientTransactionID":66,
"ServerTransactionID":428,
"ErrorNumber":0,
"ErrorMessage":""
}The response has been whitespace formatted for readability, but the actual response should be a single line of JSON text without unnecessary whitespace.
On receipt, the client should check the ErrorNumber field:
- = 0 - The values provided have been successfully set.
IsSafewill return false.
- ≠ 0 - An error occurred and the
ErrorMessagefield should be examined to determine the cause of the error.
COM Clients and Drivers
COM clients should call the safety monitor instance's Action method with ActionName = "SetExternalEvents" and ActionParameters = A string containing a
JSON encoded array of SafetyEvent objects as shown above.
COM devices should return an empty string. If the device cannot complete the request, it should throw an exception with a message describing the cause of the error.
On return from the call, COM clients should:
- No exception - The values were accepted and
IsSafewill return false. - Exception - Catch and handle any exception thrown by the safety monitor.