Set manually the "address" device property

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
User avatar
Juju
Posts: 108
Joined: Wed Aug 31, 2011 10:16 am
Location: Toulouse - FRANCE

Set manually the "address" device property

Post by Juju »

Hello,

My device property UI allow to choose a house code and a device code using popup menus. They define the device properties "houseCode" and "deviceCode".
I would like to set the device property "address" (houseCode+deviceCode) manually, when the device settings UI is closed. This will allow (I think) to display the device address in the corresponding column.
I don't know where and how to do this ...
I tried in validateDeviceConfigUi with something like :

Code: Select all

deviceCode = valuesDict["houseCode"] + valuesDict["deviceCode"]
dev.pluginProps.update({"address":deviceCode})
dev.replacePluginPropsOnServer(dev.pluginProps)
but it seems that's not the right way ...
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Set manually the "address" device property

Post by jay (support) »

The valuesDict that you get in validate*ConfigUi() can contain only entries that correspond to fields in the dialog itself. What I do in several plugins is to put in a hidden address field in the <Device> element of the ConfigUI XML:

Code: Select all

<Field id="address" type="textfield" hidden="true">
    <Label/>
</Field>
Then in your validation code you could do this:

Code: Select all

valuesDict["address"] = valuesDict["houseCode"] + valuesDict["deviceCode"]
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
User avatar
Juju
Posts: 108
Joined: Wed Aug 31, 2011 10:16 am
Location: Toulouse - FRANCE

Re: Set manually the "address" device property

Post by Juju »

Perfect Jay :P
Thanks.
Locked

Return to “Extending Indigo with Plugins and Python”