plugin.executeAction

Posted on
Thu Feb 01, 2024 6:59 am
Vaillant offline
Posts: 105
Joined: Nov 06, 2011
Location: Belgium

plugin.executeAction

Hey,

Can not get this one working.

plugin = indigo.server.getPlugin('com.GlennNZ.indigoplugin.appleTV')
if plugin.isEnabled():
plugin.executeAction('sendCommand', deviceId =86526909, props={'command':'up'})

What am I missing?

Greetings,
Adrian

Posted on
Thu Feb 01, 2024 3:25 pm
GlennNZ offline
User avatar
Posts: 1578
Joined: Dec 07, 2014
Location: Central Coast, Australia

plugin.executeAction

Any reason using the executeAction python?
Could you use the action command?

They are all there:

Image

Would be far more resistant to changes, async loop aspects, class aspects..

(But will have a look as well)

Edit:

The deviceid is not used, if it exists at all, it is appletv - which in props, as an deviceid to selected appletv.
Need command and args in the correct formatting. These have very specific formatting aspects and depends completely on how it has been coded - can’t super easily have one command fits all plugins.

But if you turn debug logging, particularly on the actions. The plugin does log (I have checked) the props what received from the official call and can try to replicate these.
eg.
Ideally you should turn on debug logging - check the props and naming, formatting of a successful call using the build in Actions.

& then if must duplicate it in this type of call.

Calling a routine directly within a script like this, needs some familiarly with the action.xml setup and the ultimate python code that is called to get formatting correct. Would suggest you look at these aspects as well.

Posted on
Fri Feb 02, 2024 3:51 am
Vaillant offline
Posts: 105
Joined: Nov 06, 2011
Location: Belgium

Re: plugin.executeAction

Turning on debug logging helped me solve it.
Did not expect to have to pass he deviceId twice.

For future reference, this works:

Code: Select all
plugin = indigo.server.getPlugin('com.GlennNZ.indigoplugin.appleTV')
if plugin.isEnabled():
   plugin.executeAction('sendCommand', deviceId=86526909, props={"appleTV":"86526909", "command":"up"})


Thanks for the help.

Posted on
Fri Feb 02, 2024 1:28 pm
jay (support) offline
Site Admin
User avatar
Posts: 18237
Joined: Mar 19, 2008
Location: Austin, Texas

Re: plugin.executeAction

Vaillant wrote:
Turning on debug logging helped me solve it.
Did not expect to have to pass he deviceId twice.
Code: Select all
plugin = indigo.server.getPlugin('com.GlennNZ.indigoplugin.appleTV')
if plugin.isEnabled():
   plugin.executeAction('sendCommand', deviceId=86526909, props={"appleTV":"86526909", "command":"up"})


FYI, deviceId is an optional parameter on any executeAction call. If the plugin doesn't use it (as @GlennNZ states above) you can just leave it out.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest