Referring to property in PluginConfig.xml from Python

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
Sun Feb 19, 2012 12:11 pm
HomeAutomationPlugins.com offline
Posts: 41
Joined: Feb 18, 2012

Referring to property in PluginConfig.xml from Python

Hi,

I'm stuck on a simple question I'm hoping you can help with!

Info.plist
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>PluginVersion</key>
   <string>1.0.0</string>
   <key>ServerApiVersion</key>
   <string>1.0.0</string>
   <key>IwsApiVersion</key>
   <string>1.0.0</string>
   <key>CFBundleDisplayName</key>
   <string>LightwaveRF</string>
   <key>CFBundleIdentifier</key>
   <string>com.perceptiveautomation.indigoplugin.lightwaverf</string>
   <key>CFBundleVersion</key>
   <string>1.0.0</string>
   <key>CFBundleURLTypes</key>
   <array>
      <dict>
         <key>CFBundleURLName</key>
         <string>http://www.perceptiveautomation.com/userforum/viewforum.php?f=20</string>
      </dict>
   </array>
</dict>
</plist>


PluginConfig.xml
Code: Select all
<?xml version="1.0"?>
<PluginConfig>
   <SupportURL>http://www.yourdomain.com/plugin/config.html</SupportURL>

   <Field id="wifilinkip" type="textfield" defaultValue="192.168.0.220">
      <Label>Wifilink IP Address:</Label>
   </Field>

</PluginConfig>


Could you let me know how I can refer to the "wifilinkip" property in the PluginConfig.xml from my python script?

I'm currently doing:

Code: Select all
indigo.server.log(u"Value is " + com.perceptiveautomation.indigoplugin.lightwaverf.wifilinkip)


But that's resulting in:

Traceback (most recent call last):
File "plugin.py", line 56, in actionControlDimmerRelay
<type 'exceptions.NameError'>: global name 'com' is not defined

Thanks!

Posted on
Sun Feb 19, 2012 12:21 pm
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

Re: Referring to property in PluginConfig.xml from Python

If you are inside the plugin config UI validate method, validatePrefsConfigUi(), then use:

Code: Select all
valuesDict["wifilinkip"]

Otherwise, use:

Code: Select all
self.pluginPrefs["wifilinkip"]

Image

Posted on
Sun Feb 19, 2012 12:27 pm
HomeAutomationPlugins.com offline
Posts: 41
Joined: Feb 18, 2012

Re: Referring to property in PluginConfig.xml from Python

Got it!

Thanks again - the support you guys give is awesome by the way!

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests

cron