ASCOM Alpaca Switch - 'Value=' is not added to 'setswitchvalue' request URL.

Issue #844 resolved
rR G created an issue

Hello,

I am trying to control a ASCOM Alpaca Switch device. The device supports multiple switchvalues: [0.0, 1.0, 2.0]

On setting a new switchvalue (eg. to 2.0 ) in NINA, the http request URL lacks the “Value=2.0“. (see log line 58))

/api/v1/switch/0/setswitchvaluewhere I am expecting:

/api/v1/switch/0/setswitchvalue?Value=2.0&ClientTransactionID=XXXX&ClientID=XXXX&ID=0

Looking at the log, I see the other requests are correct and do also contain a ClientTransaction and ClientID. Where the ‘setswitchvalue’ PUT request does not provide a 'Value’. The ClientTransactionID is internally incremented but not added to the request URL. (compare log line 55, 58 and 61).

Trying it out on: https://ascom-standards.org/api/#/Switch%20Specific%20Methods/put_switch__device_number__setswitchvalue

it seems to me, that the Alpaca API reference does also not provide the correct request string. Where the exemplary curl string has the Value

curl -X PUT "https://virtserver.swaggerhub.com/ASCOMInitiative/api/v1/switch/0/setswitchvalue" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "Id=&Value=2.0&ClientID=0&ClientTransactionID=1234"

the generated request URL lacks the Value and IDs:

https://virtserver.swaggerhub.com/ASCOMInitiative/api/v1/switch/0/setswitchvalue

Am I missing something here or is this a bug in URL assembling?

LOG (Line 1-57 show the correct device connection and parameter queries, line 58 has the setswitchvalue request URL in question):

GET /api/v1/switch/0/interfaceversion?ClientTransactionID=1377&ClientID=11674 HTTP/1.1
REPLY: {'Value': '0001', 'ErrorNumber': 0, 'ErrorMessage': ''}

PUT /api/v1/switch/0/connected HTTP/1.1
REPLY: {'Value': '', 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/maxswitch?ClientTransactionID=1379&ClientID=11674 HTTP/1.1
REPLY: {'Value': 1, 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/canwrite?ClientTransactionID=1380&ClientID=11674&ID=0 HTTP/1.1
REPLY: {'Value': 1, 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/getswitchname?ClientTransactionID=1381&ClientID=11674&ID=0 HTTP/1.1
REPLY: {'Value': 'TESTSWITCH', 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/getswitchdescription?ClientTransactionID=1382&ClientID=11674&ID=0 HTTP/1.1
REPLY: {'Value': 'SWITCHDRIVERTEST', 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/getswitchvalue?ClientTransactionID=1383&ClientID=11674&ID=0 HTTP/1.1
REPLY: {'Value': 0.0, 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/maxswitchvalue?ClientTransactionID=1384&ClientID=11674&ID=0 HTTP/1.1
REPLY: {'Value': 2.0, 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/minswitchvalue?ClientTransactionID=1385&ClientID=11674&ID=0 HTTP/1.1
REPLY: {'Value': 0.0, 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/switchstep?ClientTransactionID=1386&ClientID=11674&ID=0 HTTP/1.1
REPLY: {'Value': 1.0, 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/description?ClientTransactionID=1387&ClientID=11674 HTTP/1.1
REPLY: {'Value': 'SWITCHDRIVERTEST', 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/driverinfo?ClientTransactionID=1388&ClientID=11674 HTTP/1.1
REPLY: {'Value': 'SWITCHDRIVERTEST', 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/driverversion?ClientTransactionID=1389&ClientID=11674 HTTP/1.1
REPLY: {'Value': '0001', 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/driverversion?ClientTransactionID=1390&ClientID=11674 HTTP/1.1
REPLY: {'Value': '0001', 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/getswitchname?ClientTransactionID=1391&ClientID=11674&ID=0 HTTP/1.1
REPLY: {'Value': 'TESTSWITCH', 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/getswitchvalue?ClientTransactionID=1392&ClientID=11674&ID=0 HTTP/1.1
REPLY: {'Value': 0.0, 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/getswitchname?ClientTransactionID=1393&ClientID=11674&ID=0 HTTP/1.1
REPLY: {'Value': 'IMP85', 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/getswitchvalue?ClientTransactionID=1394&ClientID=11674&ID=0 HTTP/1.1
REPLY: {'Value': 0.0, 'ErrorNumber': 0, 'ErrorMessage': ''}

GET /api/v1/switch/0/getswitchname?ClientTransactionID=1398&ClientID=11674&ID=0 HTTP/1.1
REPLY: {'Value': 'IMP85', 'ErrorNumber': 0, 'ErrorMessage': ''}

PUT /api/v1/switch/0/setswitchvalue HTTP/1.1
REPLY: {'Value': '', 'ErrorNumber': 1025, 'ErrorMessage': 'Invalid value'}

GET /api/v1/switch/0/getswitchvalue?ClientTransactionID=1399&ClientID=11674&ID=0 HTTP/1.1
REPLY: {'Value': 0.0, 'ErrorNumber': 0, 'ErrorMessage': ''}

Comments (7)

  1. Dale Ghent

    NINA does not have any sort of Alpaca implementation built into it. Can you explain what it is you are using? If you are using the ASCOM Remote driver then NINA has no influence over how that talks to an Alpaca driver. Such low level details would be the responsibility of the Remote driver and thus this question should be asked on one of the two ASCOM organization support lists

  2. rR G reporter

    Hello Dale,

    thank you for the quick reply. I am trying to control my own driver over ASCOM Remote.

    So I will ask at the recommended place. and mark this as resolved.

  3. Log in to comment