Using iOS Shortcuts and Siri to Interact with Smartthings

There is always a reason. Some newbies complained and this happened

Baash,

I created a virtual TV device and was able to created this json command based on a routine that turns on the tv and mutes the tv in one command.

{“commands”:[{“component”:“main”,“capability”:“switch”,“command”:“on”},{“component”:“main”,“capability”:“audioMute”,“command”:“mute”}]}

And here is the json command to turn the tv on and set the volume, in this case to 5

{“commands”:[{“component”:“main”,“capability”:“switch”,“command”:“on”},{“component”:“main”,“capability”:“audioVolume”,“command”:“setVolume”,“arguments”:[5]}]}

Change the 5 to whatever level you want when the tv turns on. And zero should work

Btw just playing around with those three options I detailed above will help you get a better understanding of how ST works behind the scene

Kurt,

I pasted this command {"commands”:[{"component”:"main”,"capability”:"switch”,"command”:"on”},{"component”:"main”,"capability”:"audioMute”,"command”:"mute”}]}

And I’ve got this error message !

{“error”:{“message”:“The request is malformed.”,“details”:[{“code”:“BodyMalformedError”,“message”:“The request body is malformed and cannot be processed by server.”,“details”:,“target”:“httpRequestBody”}],“code”:“ConstraintViolationError”},“requestId”:“3427767690862164364”}

Baash,

It looks like when I pasted the json, the quotes were changed to curly quotes instead of straight quotes.


{"commands":[{"component":"main","capability":"switch","command":"on"},{"component":"main","capability":"audioMute","command":"mute"}]}

I re-pasted it as preformatted text this time (I didn’t know you could do that). This should work better.

Sorry about that

It works perfectly !!
Big, big thanks to you.
However, I stil didn’t understand how and where to create a virtual device !

Thanks :wink:

If you haven’t seen the FAQ on Creating Virtual Devices, perhaps it will shed some light on the subject for you.

Baash,

I’m glad it worked well for you.

Definitely take a look at the link John provided above. Virtual devices can be useful in so many situations especially when working with routines

Hi. I’m trying to run a shortcut to turn my TV off. However I keep getting error messages. Apologies but I’m new to this, so would welcome any suggestions and help please.

Dan,

Did you change the pat (personal authorization token) to your pat in the ST_Device_CMD_API shortcut?

If your pat is correct, could you please post the entire cmdJSON from the shortcut above

I haven’t seen this error before