Python check to see if a variable has dependencies?

Posted on
Wed Aug 02, 2017 4:24 pm
racarter offline
User avatar
Posts: 477
Joined: Jun 18, 2016
Location: North Yorkshire, UK

Python check to see if a variable has dependencies?

My Netatmo Welcome Camera plugin creates an Indigo variable for each person seen by the camera and identified in the Netatmo iOS or Android app. A user has asked if I can provide an option to automatically delete variables associated with persons who have been deleted in the Netatmo app. This is easy to do, but obviously if the user has created a trigger based on one of these variables deleting the variable will break things.

Is there a (Python) way to check to see if a variable has any dependencies before deleting it?

Posted on
Wed Aug 02, 2017 4:45 pm
jay (support) offline
Site Admin
User avatar
Posts: 18212
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python check to see if a variable has dependencies?

Yes, the getDependencies method in the variable command class will do it (just like for devices).

Note: if you just went looking for this in the docs and didn't see it, you aren't going crazy. I realized we had missed documenting it and I just added it... ;)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Aug 03, 2017 12:32 am
racarter offline
User avatar
Posts: 477
Joined: Jun 18, 2016
Location: North Yorkshire, UK

Re: Python check to see if a variable has dependencies?

Thank Jay, that’s great. And yes, I did look! :lol:

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests