Page 1 of 1

try to reload a plugin

PostPosted: Sun Jun 03, 2018 4:43 am
by koburg
HI all

I try to make a action group to execute this python script

Code: Select all
plugin = indigo.server.getPlugin("com.ssi.indigoplugin.Sonos.indiPref")
if plugin.isEnabled():
   plugin.restart()


but nothing seem to happen when execute no info in the log about reloading or errors ?

Re: try to reload a plugin

PostPosted: Sun Jun 03, 2018 5:15 am
by FlyingDiver
The identifier for the Sonos plugin is "com.ssi.indigoplugin.Sonos".

"com.ssi.indigoplugin.Sonos.indiPref" is the name of the preferences file.

Re: try to reload a plugin

PostPosted: Sun Jun 03, 2018 5:16 am
by koburg
Ok thanks but why do the log not show any errors ?

Re: try to reload a plugin

PostPosted: Sun Jun 03, 2018 11:02 am
by matt (support)
The call to retrieve a plugin always succeeds, even if the plugin isn't installed (or doesn't exist). Indigo has no way to know if a given pluginID is invalid or if that plugin just isn't installed. This is documented (but probably not clear enough) here, "This will always return to you a plugin object."

The plugin object is returned with a display name that says it isn't installed. If after getting the plugin you add this line to the script:

indigo.server.log("plugin returned:\n" + unicode(plugin))

You will see this in the Event Log window:

Code: Select all
   Script                          plugin returned:
pluginDisplayName : - plugin not installed -
pluginId : com.ssi.indigoplugin.Sonos.indiPref
pluginSupportURL :
pluginVersion :

The isEnabled() method returns False for that placeholder plugin, so the restart in your script is never executed.