Referring to property in PluginConfig.xml from Python

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
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
HomeAutomationPlugins.com
Posts: 41
Joined: Sat Feb 18, 2012 12:38 pm

Referring to property in PluginConfig.xml from Python

Post by HomeAutomationPlugins.com »

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!
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Referring to property in PluginConfig.xml from Python

Post by matt (support) »

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
HomeAutomationPlugins.com
Posts: 41
Joined: Sat Feb 18, 2012 12:38 pm

Re: Referring to property in PluginConfig.xml from Python

Post by HomeAutomationPlugins.com »

Got it!

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

Return to “Extending Indigo with Plugins and Python”