My mind is gone -- list in actions

Posted on
Sat Nov 07, 2015 7:24 am
nlagaros offline
Posts: 1646
Joined: Dec 20, 2010

My mind is gone -- list in actions

I have a static list in an action, I need to pass the selected value to create a dynamic list in the same action. I'm stuck on passing the value. HELP!?!?

Posted on
Sat Nov 07, 2015 10:14 am
DaveL17 offline
User avatar
Posts: 6786
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: My mind is gone -- list in actions

Will this help you? It's a dynamic reload from a device config.

Devices.xml
Code: Select all
      <Field
        id="thing1"
        type="menu"
        defaultValue="None">
        <Label>Thing 1:</Label>
        <List
          class="self"
          filter=""
          method="listGenerator"
          dynamicReload="true"/>
      </Field>

plugin.py
Code: Select all
    def listGenerator(self, filter="", valuesDict=None, typeId="", targetId=0):
        # This method collects IDs and names for all Indigo devices and
        # variables. It creates a dictionary of the form
        # ((dev.id, dev.name), (var.id, var.name)).
        self.debugLog(u"listGenerator() method called.")

        dev_list = [(dev.id, "(D) %s" % dev.name) for dev in indigo.devices]
        var_list = [(var.id, "(V) %s" % var.name) for var in indigo.variables]
        List = dev_list + var_list
        List.append(('None', 'None'))
        self.debugLog(u"Generated list of devices and variables:")
        self.debugLog(unicode(List))
        return List

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sat Nov 07, 2015 2:22 pm
nlagaros offline
Posts: 1646
Joined: Dec 20, 2010

Re: My mind is gone -- list in actions

Thanks Dave. I've got this part down - the dynamic list itself. Say I needed to reference the value from another list in the same action. That is the part I've forgotten how to do.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 7 guests