How can I activate the "Edit Device" UI from within a plugin

Posted on
Fri May 12, 2017 8:36 am
papamac offline
User avatar
Posts: 131
Joined: Jan 29, 2014

How can I activate the "Edit Device" UI from within a plugin

I'm writing a GPIO interface plugin that allows users to create a different device for each GPIO channel. Often it is convenient to duplicate a device and then edit it to address a different channel. I'd like to force this process rather than rely on the user because the rest of my plugin does not respond well to having two devices assigned to the same GPIO channel.

I can detect the duplicated device by calling the "deviceCreated" method and testing for "dev.configured" = True. At this point, I'd like to activate the "Edit Device" UI, but don't know how. Any suggestions?

Thanks in advance for your help.

Dave

Posted on
Fri May 12, 2017 9:14 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How can I activate the "Edit Device" UI from within a pl

First, as mentioned in the docs, deviceCreated has been deprecated so you shouldn't use it (it will be very likely to break in future versions even though it's still called now).

Second, it's not possible for a plugin to force open a dialog in the way you want.

My recommendation would be to add fields and a button to the device's config dialog (and/or a menu item on your plugin's menu) that would create a new device for the specified channel. So you would programmatically create the device which would link it to the master/main device. You could copy settings from a different device if you want during that process and only add fields for the specific data.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri May 12, 2017 9:32 am
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: How can I activate the "Edit Device" UI from within a pl

If you like you can look at the pibeacon plugin. It does that for raspberry pi.
Gpio as input / output. Simple on/off counter, pwm ...

Also all kinds of other sensors supported.



Sent from my iPhone using Tapatalk

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 7 guests