Access the UI values dictionary from code

Posted on
Sat Apr 15, 2017 2:10 pm
Hackencrash offline
User avatar
Posts: 251
Joined: Dec 16, 2015
Location: UK

Access the UI values dictionary from code

OK, in plugin.py I know I can access device plugin properties with dev.pluginProps and I can access states with dev.states (where dev is the device reference), but how do I access the UI values I entered into a device settings form (Devices.xml)?

I know some methods in plugin.py expose valuesDict or validateDict, but this is not exposed in the deviceStartComm method in plugin.py that I need this from so that I can set the address property to one of these values on the devices UI form.

I've trawled the Indigo documentation and Google for about 3 hours and can't work it out :?

Posted on
Sat Apr 15, 2017 2:38 pm
FlyingDiver offline
User avatar
Posts: 7220
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Access the UI values dictionary from code

The items in the ConfigUI are plugin properties:

Code: Select all
            serialPort = device.pluginProps.get(u'serialPort', "")

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

Posted on
Sat Apr 15, 2017 6:53 pm
kw123 offline
User avatar
Posts: 8365
Joined: May 12, 2013
Location: Dallas, TX

Re: Access the UI values dictionary from code

Try
Indigo.server.log(unicode(dev.pluginProps))
It will show you all the plugin props


Sent from my iPhone using Tapatalk

Posted on
Sun Apr 16, 2017 3:22 am
Hackencrash offline
User avatar
Posts: 251
Joined: Dec 16, 2015
Location: UK

Re: Access the UI values dictionary from code

Absolutely fantastic - thanks for the speedy responses! :D

My method for extracting values from pluginProps was flawed - I had no idea about the need to use the u (unicode) prefix :oops:

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests