[ANSWERED]How do I detect a lock in python?

Posted on
Thu Jan 12, 2017 2:56 am
dliccardo offline
Posts: 36
Joined: Jun 09, 2014

[ANSWERED]How do I detect a lock in python?

Hi,

I have a python script that looks through all devices:

Code: Select all
for dev in indigo.devices:


then I can do things based on class, for example:

Code: Select all
if (dev.__class__ == indigo.DimmerDevice):


I want to be able to know if a device is a z-wave door lock. A door lock is a indigo.RelayDevice class along with a bunch of other switches. I tried looking for the key 'IsLockSubType' in pluginProps per the indigo 7 docs, but it is not there. My z-wave door lock shows up correctly in the Indigo 7 UI with the lock/unlock instead of on/off elements. So, I was expecting to find this key in the pluginProps for my door lock devices.

So, how do I detect that a device is a door lock in python?

Thanks,
Darren

Posted on
Thu Jan 12, 2017 7:17 am
FlyingDiver offline
Posts: 3614
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: How do I detect a lock in python?

Code: Select all
indigo.server.log("IsLockSubType: %s" % dev.ownerProps["IsLockSubType"])

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Jan 12, 2017 8:26 am
matt (support) offline
Site Admin
User avatar
Posts: 19455
Joined: Jan 27, 2003
Location: Texas

Re: How do I detect a lock in python?

The most efficient way to handle this is for the Indigo Server to handle the filtering. See this forum post for how to iterate only through locks, and search on "Device Filtering Improvements" on this forum post for examples of how to use device filtering in-general.

Image

Posted on
Thu Jan 12, 2017 11:15 pm
dliccardo offline
Posts: 36
Joined: Jun 09, 2014

Re: [ANSWERED]How do I detect a lock in python?

great, thanks guys, that works. This is part of a slightly larger issue that I will start another thread on shortly..

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest