Not able to get "configure..." to show up. PluginConfig

Forum rules

This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo

Posted on
Tue Apr 16, 2013 10:41 am
mbw offline
Posts: 6
Joined: Mar 28, 2013

Not able to get "configure..." to show up. PluginConfig

I've been working on a plugin. I didnt have PluginConfig.xml setup at first, but now I have added it. I can't get the configure menu item to show up.

I have restarted indigo, reloaded the plugin, deleted the plugin and re-installed, everything I can think of.

Any advice on getting the PluginConfig to work? I have even used PluginConfig.xml files from example plugins, not much in it yet.

Thanks!

Mike

Posted on
Tue Apr 16, 2013 11:35 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Not able to get "configure..." to show up. PluginConfig

Post your PluginConfig.xml file contents inside code tags (using the "Code" button above the editing window). A properly formed PluginConfig file with some fields in it should cause that menu item to show.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Apr 16, 2013 3:18 pm
mbw offline
Posts: 6
Joined: Mar 28, 2013

Re: Not able to get "configure..." to show up. PluginConfig

Code: Select all
<?xml version="1.0"?>
<PluginConfig>
    <Field type="textfield" id="apitoken">
        <Label>API Token</Label>
        <Description>x</Description>
    </Field>
</PluginConfig>

Posted on
Tue Apr 16, 2013 4:17 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Not able to get "configure..." to show up. PluginConfig

Hmm - looks like it should work though text fields don't use the <Description> element. Zip up the plugin and email it to indigo DASH support AT perceptiveautomation DOT com.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Apr 17, 2013 2:19 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Not able to get "configure..." to show up. PluginConfig

In your __init__ method, you're calling this method:

Code: Select all
rest.app.run(ssl_context='adhoc')


which is never returning. So the plugin is basically non-functional because that method has taken over execution. It can't load the various XML files, etc. The plugin base class sets up the plugin execution environment - which is called into from the indigo server to perform functionality so you can't tie up the main thread with an unending process. Comment out that line and Configure... shows and brings up the dialog. You also get the debugging statements that you have in the plugin.py file in the event log - before you didn't.

You'll need to start that process in a different thread - probably from the startup method and shut it down from the shutdown method, though there are various alternatives for threading (see runConcurrentThread for a simple threading mechanism). I don't really know what the purpose of the plugin is so I can't really steer you any further. This is also why you always see this error when you try to reload your plugin:

Code: Select all
  Error   process (pid 71736) failed to quit after polite request -- forcing it to quit now


You can open the plugin's prefs file directly if needed - it's located here:

/Library/Application Support/Perceptive Automation/Indigo 6/Preferences/Plugins/YOURPLUGINID.indiPref


It's a simple XML file - the top level element is <Prefs> and each of the fields in your config is the element name (<apitoken111>). However, I suspect you don't need to read it yourself - you'll want to get the prefs in the plugin.py file using the standard methods and then pass them to the new thread you're setting up to do whatever it is that's happening in the above method call. Up to you of course.

Oh - you need to change your plugin's id (com.perceptiveautomation.indigoplugin.glasshouse) to your own unique namespace - com.perceptiveautomation.* is reserved for us. If you have a registered domain name, just use that (reversed of course), if not just make up something that's not likely to be used by someone else. Duplicate plugin ids will cause no end of trouble.

BTW, I'm going to move this thread over to the "Extending Indigo with Plugins and Python" forum since it's specifically an issue with building a plugin.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Apr 17, 2013 6:34 pm
mbw offline
Posts: 6
Joined: Mar 28, 2013

Re: Not able to get "configure..." to show up. PluginConfig

ok, awesome. Thanks for the help. Ill keep working with it.

This plugin is kinda strange, so we will see how it goes. I agree with you that it looks pretty hacky and lame at this point.

Posted on
Thu Apr 18, 2013 10:39 am
mbw offline
Posts: 6
Joined: Mar 28, 2013

Re: Not able to get "configure..." to show up. PluginConfig

I got the plugin to reload cleanly finally. Thanks.

is there any docs or info about insteonCommandReceived in the docs? It looks to be more low level than the deviceUpdated stuff.

The idea of the plugin is to serve rest endpoints that an appengine app can talk to (you register your house with it). You have some settings about which devices and whatnot you want notifications for. The plugin pushes to the appengine app also. So its push and pull. The appengine app will have oauth2 credentials and talk to the Google Mirror API (Google Glass). So the appengine app will request info from my plugin, the plugin will push info to appengine, and then appengine can relay stuff to google glasses.

Posted on
Thu Apr 18, 2013 11:12 am
mbw offline
Posts: 6
Joined: Mar 28, 2013

Re: Not able to get "configure..." to show up. PluginConfig

does the built in cherrypy server support ssl? Do you guys plan on supporting a way to extend the cherrypy server with new endpoints from a plugin?

(that is a big part of why I am running a flask server with ssl, I need my own endpoints, ssl, and nice REST framework to work with)

Posted on
Thu Apr 18, 2013 11:27 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Not able to get "configure..." to show up. PluginConfig

We haven't really documented that one yet. Basically, "cmd" is a dictionary with the following format:

Code: Select all
ackValue : 0
address : 0B.4B.41
cmdBytes : [19, 0]
cmdFunc : off
cmdScene : 4
cmdSuccess : True
replyBytes : []


So, the address of the device sending the command and the INSTEON packet information. I don't believe it's what you're looking for.

I suspect you're really just interested in getting device updates - indigo.devices.subscribeToChanges - discussed in the built-in objects section of the developer docs. If you call that when your plugin starts up, then any time a device has any change, the appropriate device methods in your plugin (deviceUpdated and deviceDeleted) will get called. You can then push whatever you need out to the other service.

I don't think the cherrypy that we're using has ssl built in though you could probably hack it. However, as you've seen, it doesn't currently use the IOM for access to Indigo objects (it was build several years before the IOM). It's high on our list for the next major rev of Indigo to get IWS completely moved into our plugin framework, using the IOM, etc. But that's a ways out after we get Indigo 6 out of beta. I'd highly recommend proceeding with a Server Plugin rather than try to patch the current IWS cherrypy implementation.

Check out the Twisted Telnet example plugin in the SDK - it uses the runConcurrentThread method to run the telnet server process and should give you some ideas about how you can architect your plugin.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest