Hi,
After the Groovy deprecation a lot of my automation stopped working.
How can I update the status of a virtual contact sensor to CLOSE state using curl after my hub was moved to edge drivers ?
I created a new device from Samsung account
I checked the API documentation, but it doesn’t work when I make the request.
Currently the sensor is in OPEN state.
curl -H “Authorization: Bearer token” -H “Content-Type: application/json” -X POST https://api.smartthings.com/v1/devices/df184b34-db74-4ee6-b86f-c4435e6ab670/comma
nds -d ‘{“commands”: [{“component”: “main”,“capability”: “contactSensor”,“command”: “setOpen”,“arguments”: [“close”]}]}’
{“requestId”:“712516891090281429”,“error”:{“code”:“ConstraintViolationError”,“message”:“The request is malformed.”,“details”:[{“code”:“NotValidValue”,“target”:“commands[0].Command(component=main, capability=contactSensor, command=setOpen, commandId=null, arguments=[close])”,“message”:“setOpen is not a valid value.”,“details”:}]}}
The GET request is working fine:
curl -i -v -H 'Authorization: Bearer real_token' -X GET "https://api.smartthings.com/v1/devices/df184b34-db74-4ee6-b86f-c4435e6ab670/status" -k
Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying [54.76.147.178:443](http://54.76.147.178:443/)...
* Connected to [api.smartthings.com](http://api.smartthings.com/) ([54.76.147.178](http://54.76.147.178/)) port 443 ([#0](https://support.smartthings.com/hc/requests/0))
* ALPN: offers http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN: server accepted http/1.1
* Server certificate:
* subject: CN=*.[smartthings.com](http://smartthings.com/)
* start date: Feb 22 00:00:00 2023 GMT
* expire date: Mar 22 23:59:59 2024 GMT
* issuer: C=US; O=Amazon; CN=Amazon RSA 2048 M01
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
> GET /v1/devices/df184b34-db74-4ee6-b86f-c4435e6ab670/status HTTP/1.1
> Host: [api.smartthings.com](http://api.smartthings.com/)
> User-Agent: curl/7.84.0
> Accept: */*
> Authorization: Bearer real_token
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Date: Thu, 10 Aug 2023 14:35:01 GMT
Date: Thu, 10 Aug 2023 14:35:01 GMT
< Content-Type: application/json
Content-Type: application/json
< Content-Length: 122
Content-Length: 122
< Connection: keep-alive
Connection: keep-alive
< Server: openresty
Server: openresty
< X-RateLimit-Limit: 350
X-RateLimit-Limit: 350
< X-RateLimit-Remaining: 350
X-RateLimit-Remaining: 350
< X-RateLimit-Reset: 59185
X-RateLimit-Reset: 59185
< X-RateLimit-Limit: 350
X-RateLimit-Limit: 350
< X-RateLimit-Remaining: 350
X-RateLimit-Remaining: 350
< X-RateLimit-Reset: 59078
X-RateLimit-Reset: 59078
< Access-Control-Allow-Origin: *
Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
< Access-Control-Allow-Headers: DNT,Keep-Alive,User-Agent,If-Modified-Since,Cache-Control,Content-Type,Accept,Authorization,X-ST-Client,X-ST-Api-Version,X-ST-Client-AppVersion,X-ST-Client-OS,X-ST-Client-DeviceModel
Access-Control-Allow-Headers: DNT,Keep-Alive,User-Agent,If-Modified-Since,Cache-Control,Content-Type,Accept,Authorization,X-ST-Client,X-ST-Api-Version,X-ST-Client-AppVersion,X-ST-Client-OS,X-ST-Client-DeviceModel
<
* Connection [#0](https://support.smartthings.com/hc/requests/0) to host [api.smartthings.com](http://api.smartthings.com/) left intact
{"components":{"main":{"contactSensor":{"contact":{"value":"open","timestamp":"2023-07-28T12:09:46.631Z"}},"refresh":{}}}}
Thanks,