Retrieve Device ID from new action dialog

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
nlagaros
Posts: 1646
Joined: Mon Dec 20, 2010 2:16 pm

Retrieve Device ID from new action dialog

Post by nlagaros »

My plugin needs to create a dynamic list of strings based on the device chosen in an Action Group dialog. Apologies if this is a silly question, but I need to address that particular Device ID when my method to populate the list is called. Here is my action as defined in Actions.xml:

Code: Select all

       <Action id="actionZP_LIST" deviceFilter="self.ZonePlayer">
                 <Name>Sonos Playlist</Name>
                <ConfigUI>
                        <Field id="setting" type="menu">
                                <Label>Sonos Playlist:</Label>
                                <List class="self" method="getZP_LIST" dynamicReload="yes"/>
                        </Field>
                </ConfigUI>
                <CallbackMethod>actionZP_LIST</CallbackMethod>
        </Action>
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Retrieve Device ID from new action dialog

Post by jay (support) »

The signature for the dynamic list generator is this:

Code: Select all

 def myListGenerator(self, filter="", valuesDict=None, typeId="", targetId=0)
In the case of this method being called from a config UI for an action that requires selection of a device, the targetId parameter will be the ID of the device selected.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
nlagaros
Posts: 1646
Joined: Mon Dec 20, 2010 2:16 pm

Re: Retrieve Device ID from new action dialog

Post by nlagaros »

Thanks Jay - seems simple enough!
Locked

Return to “Extending Indigo with Plugins and Python”