Plugin hooks & documentation

Posted on
Tue May 26, 2015 7:55 am
autolog offline
Posts: 3991
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Plugin hooks & documentation

Is there a function that I can specify that will intercept the Edit Device Settings ... dialogue before it is displayed?
I want to modify the valuesDict prior to presentation of the UI to the user.

A more general question and/or request. It would be extremely useful if there was some documentation around the flow of control for a plugin. This would show whatIndigo does after it enables a plugin e.g, the plugin routines that get called (for devices, actions, triggers and schedules) and what routines the plugin can intercept and alter. At the moment it takes an awful long time to track some of this down. Some of it isn't documented and some of it has been answered in response to forum queries which are themselves difficult to locate.

As an aside, the forum search facilities are not very good (probably a function of the software being used to present the forums) e.g. you can't search for any name longer than 14 characters - unfortunately a lot of the Indigo function names are longer than 14 characters. I know this can be worked around via google but it just adds to the frustration of not being able to find the info in an expeditious manner. :wink:

Posted on
Tue May 26, 2015 3:32 pm
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

Re: Plugin hooks & documentation

Hi Jon,

You'll want to use getDeviceConfigUiValues. It is called before the dialog is shown, and by default just takes the pluginProps of the device and returns that. You can override it though to change values, or insert errorDict values if a value is out-of-range.

There are, as you have noticed, some gaps in the developer documentation. We'll work on improving it. :-)

Image

Posted on
Tue May 26, 2015 4:03 pm
autolog offline
Posts: 3991
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Plugin hooks & documentation

HI Matt,
Thanks for the info and pointer :D

Posted on
Tue May 26, 2015 7:31 pm
RogueProeliator offline
User avatar
Posts: 2506
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Plugin hooks & documentation

There are, as you have noticed, some gaps in the developer documentation. We'll work on improving it.

What I've found is that the basics are pretty well documents in the plugin guides and IOM wiki pages, but the more "advanced" (less-used might be better term) features are what are lacking documentation. What would be really helpful, and this doesn't have to be Matt/Jay, would be a simple plugin that basically just documents to the Indigo Log each function/step as it is called in order. This would allow developers to look at the plugin source as well as the Indigo Log to view the lifecycle order. I've had to do this myself in new languages and it is generally quite helpful. Then someone may take it upon themselves to visually diagram it out... :-)

Adam

Posted on
Wed May 27, 2015 12:22 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Plugin hooks & documentation

RogueProeliator wrote:
There are, as you have noticed, some gaps in the developer documentation. We'll work on improving it.

What would be really helpful, and this doesn't have to be Matt/Jay, would be a simple plugin that basically just documents to the Indigo Log each function/step as it is called in order.

Good idea. Would help me with my SkyRemote when I get back to it.

Should also print the value (for single-value vars such as strings) or name (for arrays/dictionary's) of any parameter called in a function.

Code: Select all
OK Button Clicked
Executing someFunction(param1,param2)
Values are someFunction(123346,Red)


An optional debug switch might also print the dictionary at the point of calling.

What are you doing this week, Adam...?? ;-) ;-)

Posted on
Wed May 27, 2015 3:24 am
kw123 offline
User avatar
Posts: 8392
Joined: May 12, 2013
Location: Dallas, TX

Re: Plugin hooks & documentation

the print to log is easy:
indigo.server.log(unicode(dict or variable here)) ## just after the def zzzz(): line

Posted on
Wed May 27, 2015 7:16 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Plugin hooks & documentation

Yes I know - but I meant in the context of the plugin.

If it is printing all function calls as they are called, it would be nice to automatically print their values in the same format.

Posted on
Wed May 27, 2015 7:37 am
RogueProeliator offline
User avatar
Posts: 2506
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Plugin hooks & documentation

What are you doing this week, Adam...??

Thinking about it, this would only take an hour or so to throw together, I may be able to do that later today. Would be an interesting exercise and a good reference.

Adam

Posted on
Wed May 27, 2015 9:40 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Plugin hooks & documentation

Have you finished it yet??? Come on, what are you playing at??

:-)

Posted on
Wed May 27, 2015 12:48 pm
durosity offline
User avatar
Posts: 4357
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Plugin hooks & documentation

howartp wrote:
Have you finished it yet??? Come on, what are you playing at??

:-)


That's my line, I'm the one around here that makes ridiculous demands! Now stop wasting time on here and get that sky plugin working. And have it in my inbox by 9am tomorrow.


Sent from my iPad using Tapatalk

Computer says no.

Posted on
Wed May 27, 2015 12:51 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Plugin hooks & documentation

durosity wrote:
howartp wrote:
Have you finished it yet??? Come on, what are you playing at??

:-)


That's my line, I'm the one around here that makes ridiculous demands! Now stop wasting time on here and get that sky plugin working. And have it in my inbox by 9am tomorrow.

:-) Very good response.

Ive got a DVD to produce, hopefully over the next fortnight, then - fingers crossed - I'll be back on with the plugin until September'ish.

If Adam gets this documentation plugin going it will help me tremendously!

Posted on
Wed May 27, 2015 12:56 pm
RogueProeliator offline
User avatar
Posts: 2506
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Plugin hooks & documentation

Have you finished it yet??? Come on, what are you playing at??

Life? I actually started it at lunch, but those who know me and my plugins... I can't really leave well enough alone. So put in menu items, devices, actions, events, etc. I didn't have too much time - had to exercise since soccer starts soon! Shouldn't take but a little more later when I get a break and will have a pretty well documented plugin (both in code and the calls via the Indigo log).

That's my line, I'm the one around here that makes ridiculous demands! Now stop wasting time on here and get that sky plugin working. And have it in my inbox by 9am tomorrow.

Don't mind him, he doesn't like Android. He doesn't count.

Adam

Posted on
Wed May 27, 2015 12:59 pm
durosity offline
User avatar
Posts: 4357
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Plugin hooks & documentation

September eh? That's pretty late.. I set you a deadline of tomorrow. Just an incentive, for every day it's late I'll invoice you £4.99. :p

Back on topic, that documentation would be pretty useful.. I've decided I really need to dedicate some time to properly learning Python and writing my own plugin.. Off on a cruise next week but when I get back I think I'll be firmly wedging myself in the study :D


Sent from my iPad using Tapatalk

Computer says no.

Posted on
Wed May 27, 2015 1:01 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Plugin hooks & documentation

durosity wrote:
September eh? That's pretty late..

I didn't say it would take that long - just that's the period of time I should have free of major distractions. :-)

Posted on
Wed May 27, 2015 1:21 pm
DaveL17 offline
User avatar
Posts: 6786
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Plugin hooks & documentation

Tough crowd!

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

[My Plugins] - [My Forums]

Who is online

Users browsing this forum: No registered users and 1 guest