Page 1 of 1

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

PostPosted: Thu Jan 12, 2017 2:56 am
by dliccardo
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

Re: How do I detect a lock in python?

PostPosted: Thu Jan 12, 2017 7:17 am
by FlyingDiver
Code: Select all
indigo.server.log("IsLockSubType: %s" % dev.ownerProps["IsLockSubType"])

Re: How do I detect a lock in python?

PostPosted: Thu Jan 12, 2017 8:26 am
by matt (support)
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.

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

PostPosted: Thu Jan 12, 2017 11:15 pm
by dliccardo
great, thanks guys, that works. This is part of a slightly larger issue that I will start another thread on shortly..