Folder Iterator

Posted on
Fri Feb 22, 2019 5:18 pm
DaveL17 offline
User avatar
Posts: 6756
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Folder Iterator

As far as I can tell, the server doesn't expose an iterator of all Indigo folders. Assuming that's right (there's no guarantee of that of course), in order to get all folders in one place, I think I have to roll my own. There may be a more elegant way to do this, but it's pretty Pythonic, I think.

Am I missing something?

Code: Select all
f = {}
for folder_object in [('actions', indigo.actionGroups.folders),
                      ('control pages', indigo.controlPages.folders),
                      ('devices', indigo.devices.folders),
                      ('schedules', indigo.schedules.folders),
                      ('triggers', indigo.triggers.folders),
                      ('variables', indigo.variables.folders)
                      ]:
    f[folder_object[0]] = [folder.id for folder in folder_object[1]]

indigo.server.log(str(f))

Example output:
Code: Select all
{'triggers': [1073828790, 182673228, 30846254, 981343334, 42743123, 14429673, 571912516, 1916906011, 1024085457, 595299723, 91927611], 'variables': [184892127, 1269796536, 1863978771, 1132757992], 'devices': [452228027, 1402752664, 1142130304, 1222282872, 362984127, 1496514993, 1170841789, 251697344, 1453848350, 117852589, 1719897690, 1503528654, 428317405, 1161238881, 1781830064], 'actions': [1426203602, 1354552169, 257551181, 1427618268, 1600764606, 1202165711, 504743372, 1326254561, 1617577537, 20346907, 1639805504], 'schedules': [], 'control pages': []}

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

[My Plugins] - [My Forums]

Posted on
Fri Feb 22, 2019 5:31 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Folder Iterator

Looks good to me!

Image

Posted on
Fri Feb 22, 2019 6:56 pm
DaveL17 offline
User avatar
Posts: 6756
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Folder Iterator

Thanks Matt.

I saw indigo.Folder, indigo.FolderIter and indigo.FolderList but I couldn't get a list of folders out of those.

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

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 5 guests