Getting Songs plugin to execute actions from within Python

Posted on
Sun Apr 23, 2017 1:14 pm
pgershon offline
Posts: 506
Joined: Jul 10, 2004

Getting Songs plugin to execute actions from within Python

I have a plugin that run my Grand Concerto and I am trying to get the python code to communicate with the Sonos plugin. I can look at values within Sonos, but I am having trouble getting Sonos to perform actions. I tried two ways - the first fails, the second works but relies on an Action Group I wrote to perform:

Code: Select all
sqzPlugin = indigo.server.getPlugin("com.ssi.indigoplugin.Sonos")
sqzPlugin.executeAction("TogglePlay", deviceId="42384538")
and
Code: Select all
indigo.actionGroup.execute(1445798824)


42384538 is the ID of the Sonos device. 1445798824 is the ID of a Sonos Action Group that does Toggle Play. The action group works fine from the Indigo main interface, just not from within the Python script.

Error generated by first approach:

    NuVo Grand Concerto Error Error in plugin execution runConcurrentThread:

    Traceback (most recent call last):
    File "plugin.py", line 226, in runConcurrentThread
    File "plugin.py", line 266, in parseToServerLine
    File "plugin.py", line 363, in parseToServer
    ArgumentError: Python argument types in
    PluginInfo.executeAction(PluginInfo, str)
    did not match C++ signature:
    executeAction(CPlugin {lvalue}, CCString actionTypeId, unsigned long deviceId=0, boost::python::api::object props=None, bool waitUntilDone=True)

    NuVo Grand Concerto Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)


Any thoughts?

Posted on
Sun Apr 23, 2017 1:41 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Getting Songs plugin to execute actions from within Pyth

Try this:
Code: Select all
sqzPlugin = indigo.server.getPlugin("com.ssi.indigoplugin.Sonos")
if sqzPlugin.isEnabled():
    sqzPlugin.executeAction("actionTogglePlay", deviceId="42384538")


Unless documented elsewhere by the plugin developer, you need to look at the Actions.xml file inside the plugin to determine the name of the action you're trying to invoke.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue May 02, 2017 3:46 pm
pgershon offline
Posts: 506
Joined: Jul 10, 2004

Re: Getting Songs plugin to execute actions from within Pyth

I needed to remove the quotes from the device id, then it worked. Thanks.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests

cron