RESTful API: Invoke Device Action (vs execute action)

Posted on
Sun Jan 24, 2021 7:20 pm
Ramias offline
Posts: 272
Joined: Nov 24, 2015

RESTful API: Invoke Device Action (vs execute action)

Using thing Samsung TV plugin.

Each key press on the remote is a separate command. they are defined in Actions.XML for the plugin.

Is there a way to execute these commands via API without having them defined as actual Actions under Action Groups?

Posted on
Mon Jan 25, 2021 10:57 am
jay (support) offline
Site Admin
User avatar
Posts: 18201
Joined: Mar 19, 2008
Location: Austin, Texas

Re: RESTful API: Invoke Device Action (vs execute action)

There is currently no way to execute them through the RESTful API. You can script them, however, which may be useful if you're executing a script from a separate process on the same Mac using the indigo-host command.

We encourage plugin developers to document this in their plugins documentation, but it can be discovered if necessary.

Yes, Indigo Plugins as a general rule are scriptable (that link discusses how and shows some examples). We encourage plugin developers to document this in their plugin's documentation, but it can be discovered if necessary as you'll see below.

First you need to determine the ID of the plugin, which is visible on the Plugin Store page for that plugin (com.oldefortran.indigo.exlink). That's the easy part.

The more complex part is figuring out what the props are that you have to pass to the plugin - this is where you have to inspect the plugin code. In the Actions.xml for the plugin, you'll want to look at the sendSingleButton action at the very bottom (that's the action id that you'll pass in to the executeAction method of the plugin). You'll notice on the Action definition that it specifies a deviceFilter - this indicates that you'll need to pass a deviceId in to the executeAction method. The only field specified is the Button field id - you need to pass the appropriate value for the required button as specified in the Option List in a dictionary as the props parameter of the executeAction method.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Jan 25, 2021 12:38 pm
Ramias offline
Posts: 272
Joined: Nov 24, 2015

Re: RESTful API: Invoke Device Action (vs execute action)

Thanks. In this case the script is bash in a container on my NAS. I just created a dozen action groups for each unique key press.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests