Call Another Plugin Function

Posted on
Wed Jan 10, 2018 12:24 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Call Another Plugin Function

I remember at one point I was playing with this and there was a built in method but I cannot remember what it is nor can I find the thread where I may have asked that question and gotten it answered - but it seems to me that there was an API change that allowed a plugin to publish a function that other plugins could call (outside of calling an action). I seem to remember toying with this and getting it working and then a shiny object caught my attention....

It was something along the lines of plugin A would create a function, say testFunction() that would return - I think - a dictionary and plugin B could call that function and get the dictionary back. I recall it had a lot of limitations but I'm only looking to get plugin B to grab some very specific info from plugin A. For some reason I want to think it was a static function name that it had to be, you can't cook up your own name but it had to be implemented via a built-in function.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Wed Jan 10, 2018 2:48 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Call Another Plugin Function

You thinking of the Publish/Subscribe API?

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

Posted on
Wed Jan 10, 2018 3:08 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Call Another Plugin Function

Do you mean the broadcast/subscribe? No, that's something different. I know there was also an update to the base functionality in the new 2.0 API for Indigo 7 but I think that was a bit different too.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Wed Jan 10, 2018 4:00 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Call Another Plugin Function

Check out the new API announcement post and search for the "Plugin action return values" section.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Jan 10, 2018 4:18 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Call Another Plugin Function

I did check that out before I posted but I thought there was another method that was open before those API changes, am I just dreaming?

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Wed Jan 10, 2018 6:26 pm
DaveL17 offline
User avatar
Posts: 6743
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Call Another Plugin Function

Are you maybe thinking of plugin.executeAction()? I have this facility in the Matplotlib plugin as kind of a test case.

Code: Select all
matplotlibPlugin = indigo.server.getPlugin("com.fogbert.indigoplugin.matplotlib")
payload = {'x_values': [1, 2, 3],
           'y_values': [2, 4, 7],
           'kwargs': {'linestyle': 'dashed',
                      'color': 'b',
                      'marker': 'd',
                      'markerfacecolor': 'r'},
           'path':'/Library/Application Support/Perceptive Automation/Indigo 7/IndigoWebServer/images/controls/static/',
           'filename': 'chart_filename1.png'
           }
try:
    result = matplotlibPlugin.executeAction('refreshTheChartsAPI', deviceId=0, waitUntilDone=True, props=payload)
    if result is not None:
        indigo.server.log(result['message'])
except Exception as err:
    indigo.server.log(u"Exception occurred: {0}".format(err))

I designed the result as a dict. I think the code above can be run from anywhere Indigo can run the script.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Wed Jan 10, 2018 6:50 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Call Another Plugin Function

Colorado4Wheeler wrote:
that other plugins could call (outside of calling an action).


No, it was something else. Maybe it was just the new function in the I7 API that I played with a year ago - seems like it was earlier than that but it could be I need to stop hitting the crack pipe :shock:

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests