Found these replies very helpful!
I was able to get my PAT and get a list of devices. From there, I isolated the virtual switch I want to control and was able to check it’s status and see it go from ON to OFF after changing it manually in the Smartthings app. That’s progress!!
But, when I tried to turn it OFF (or ON, really just trying to change it). It errored. Here’s the command I issued and the response/error I got:
curl -X POST -H “Authorization: Bearer xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” -H “Content-Type: application/json” -d ‘{“commands”:[{“component”:“main”,“capability”:“switch”,“command”:“on”}]}’ “https://api.smartthings.com/v1/devices/mydeviceid/commands”
RESPONSE:
{“requestId”:“xxxxxxxx-arequestid”,“error”:{“code”:“ConstraintViolationError”,“message”:“The request is malformed.”,“details”:[{“code”:“BodyMalformedError”,“target”:“httpRequestBody”,“message”:“The request body is malformed and cannot be processed by server.”,“details”:}]}}
Here’s the switch’s details listed when I listed all my devices:
{“deviceId”:“xxxxx”,“name”:“spa_pump”,“label”:“spa_pump”,“manufacturerName”:“SmartThings”,“presentationId”:“generic-switch”,“locationId”:“xxxxxx”,“roomId”:“xxxxx”,“deviceTypeId”:“e233618f-da91-4e0f-8993-ae1c99f2aca2”,“deviceTypeName”:“Virtual Switch”,“deviceNetworkType”:“UNKNOWN”,“components”:[{“id”:“main”,“capabilities”:[{“id”:“switch”,“version”:1},{“id”:“sensor”,“version”:1},{“id”:“actuator”,“version”:1}],“categories”:[{“name”:“Switch”,“categoryType”:“manufacturer”}]}],“createTime”:“2021-02-22T03:32:34.280Z”,“parentDeviceId”:“xxxxx”,“dth”:{“completedSetup”:false,“deviceNetworkType”:“UNKNOWN”,“deviceTypeId”:“e233618f-da91-4e0f-8993-ae1c99f2aca2”,“deviceTypeName”:“Virtual Switch”,“executingLocally”:true,“hubId”:“xxxxx”,“networkSecurityLevel”:“UNKNOWN”},“type”:“DTH”,“restrictionTier”:0,“allowed”:}
I admit I’m WAAAY out of my element here, but I think I’ve got syntax wrong or something