supportsOnState property

Posted on
Sat Dec 19, 2020 7:27 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

supportsOnState property

A virtual relay appears to be missing the property: supportsOnState

So checking if device.supportsOnState throws an error. :|

Posted on
Sat Dec 19, 2020 11:14 am
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: supportsOnState property

I'll look into it, thanks.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Dec 22, 2020 2:38 pm
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: supportsOnState property

Dimmers and relay devices don't have the supportsOnState property because they always support an on state. Sensor devices may or may not, so that's where supportsOnState is used.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Dec 22, 2020 3:20 pm
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: supportsOnState property

OK but I guess that isn't so helpful if you are trying to identify device types that do from that property. :wink:

Thanks for the explanation. :)

Posted on
Wed Dec 23, 2020 1:28 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: supportsOnState property

I’m with Jon on this. :-)


Sent from my iPhone using Tapatalk Pro

Posted on
Wed Dec 23, 2020 11:31 am
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: supportsOnState property

So, you guys are trying to build a list of all devices that support ON states, correct? It would require a bit of extra logic to test first to see if the device instance is an indigo.RelayDevice (dimmers are a subclass of Relay so isinstance(dev, indigo.RelayDevice) would work on both), and if not then look at the supportsOnState property (catching the exception where it doesn't have the property). So it is a bit more work.

I'll add an API feature request to add a filter for the device iterator.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Dec 23, 2020 2:22 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: supportsOnState property

I think you can do this now. In Indigo 7.4 I added the SupportsOnState property to relays and dimmers (and set it to always be True), so you can do the following to get all devices that are relays, dimmers, or sensors that support on/off states:

Code: Select all
for dev in indigo.devices.iter("props.SupportsOnState"):
   indigo.server.log(dev.name)

So basically the property exists at the dict level for everything that supports on/off states, but relays and dimmers do not have an instance level attribute (yet) which makes dev.supportsOnState fail on them. I should probably add the instance level attribute to relay / dimmers...

Image

Posted on
Wed Dec 23, 2020 3:16 pm
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: supportsOnState property

How's THAT for turnaround! I believe I asked Matt for this last year some time (I thought it sounded familiar, but my memory isn't what it used to be).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Dec 23, 2020 4:26 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: supportsOnState property

matt (support) wrote:
I think you can do this now.

I should probably add the instance level attribute to relay / dimmers...

jay (support) wrote:
How's THAT for turnaround!

I don't see the instance level attribute in 7.5....

Posted on
Wed Dec 23, 2020 4:36 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: supportsOnState property

I think Jay was talking about the property dict level support I added in 7.4.1 (which can be accessed with the iterator filter in the example above). A new dev.supportsOnState attribute will have to wait for the next release. 8)

Image

Posted on
Wed Dec 23, 2020 4:38 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: supportsOnState property

I know full well what he was on about!

I’m suggesting you should get working a bit quicker.


Sent from my iPhone using Tapatalk Pro

Posted on
Wed Dec 23, 2020 4:42 pm
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: supportsOnState property

howartp wrote:
I know full well what he was on about!

I’m suggesting you should get working a bit quicker.


I have a suggestion for you, but not in polite company... :twisted:

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Dec 23, 2020 4:46 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: supportsOnState property

Hey, it was Matt I was insinuating!


Sent from my iPhone using Tapatalk Pro

Posted on
Wed Dec 23, 2020 5:04 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: supportsOnState property

I think this is where we should just blame everything on durosity.

Image

Posted on
Wed Dec 23, 2020 5:35 pm
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: supportsOnState property

matt (support) wrote:
I think this is where we should just blame everything on durosity.


+1

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Who is online

Users browsing this forum: No registered users and 2 guests