RGB dimmer devices access to build in states

Posted on
Fri Feb 28, 2020 11:56 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

RGB dimmer devices access to build in states

2 issues:

1.====
for RGB dimmer devices brightness seems to either 0 or 100, nothing in-between.
in the sdk is also no example on how to set this,
how is is calculated. just 0 or 100 for on/off?


2.===
the building devise stated eg redLevel can be set withe dev.updateStates ...()
but i am not able to read them:

tried
Code: Select all
 if "redState in dev.states .. is False

Code: Select all
xx = dev.states["redLevel"] throws error

Code: Select all
dev.redLevel shows None


doing indigo.log( unicode(dev) ) shows
...
batteryLevel : None
blueLevel : None
brightness : 0
redLevel : None
...


although they do show a value in the detailed device pane


======
And finally a python question:
how do I access dev.ppp
with ppp a variable = "redLevel" / "greenLevel" / "address"... (dev.redLevel works but shows None)
shows error: 'DimmerDevice' object has no attribute 'ppp'


Karl

Posted on
Sat Feb 29, 2020 12:39 am
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: rg dimmer devices access to build in states

it seems the devices was not properly initialized -- the properties supportXXX was not set .

BUT still the 2 questions remain:

== for RGB dimmer devices brightness seems to either 0 or 100, nothing in-between.

==And finally a python question:
how do I access dev.ppp
with ppp a variable = "redLevel" / "greenLevel" / "address"... (dev.redLevel works but shows None)
shows error: 'DimmerDevice' object has no attribute 'ppp'


Karl

Posted on
Sat Feb 29, 2020 8:55 am
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: rg dimmer devices access to build in states

as for the python question:

This works,
Code: Select all
xxx="redLevel"
exec("aa = dev."+xxx)
indigo.server.log("returned: "+ aa)
but there must be a pythonic way

Karl

Posted on
Sat Feb 29, 2020 9:42 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: rg dimmer devices access to build in states

Code: Select all
xxx="redLevel"
value = getattr(dev, xxx)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Feb 29, 2020 2:46 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: rgb dimmer devices access to build in states

ok thanks,

and the brightness value =0 or 100, nothing in-between?

Karl

Posted on
Sun Mar 01, 2020 11:22 am
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: rg dimmer devices access to build in states

Some more questions on brightnessLevel (not brightness)

The attached:
Screen Shot 2020-03-01 at 11.04.32.png
Screen Shot 2020-03-01 at 11.04.32.png (15.1 KiB) Viewed 1906 times

shows a dimer device w prop SupportsOnState True, SupportsWhite True
I am updating state: "brightnessLevel", the number in the slider is correct, the position of the slider is NOT as well as the Brightness number on the right
setting state "onState" to False sets brightness to 0 as well as the slider - and the other way around

I here a setting I am not aware of, or how should:
Code: Select all
"SupportsColor"
"SupportsRGB"
"SupportsWhite"
"SupportsWhiteTemperature",
"SupportsRGBandWhiteSimultaneously"
"SupportsTwoWhiteLevels",
"SupportsTwoWhiteLevelsSimultaneously"
"SupportsOnState"
"SupportsSensorValue"
"SupportsStatusRequest"
"AllowOnStateChange"
be set to for
1. a simple dimmer
2. a dimmer with white color / temp
3. a dimer w RGB only
4. dimmer w RGB & W & temp


Karl

Posted on
Sun Mar 01, 2020 12:25 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: rg dimmer devices access to build in states

The RGB Color devices support overall brightness as well as individual R, G, B (and up to 2 white channels) levels to specify the color. The Example Device - Relay and Dimmer plugin in the SDK has the best documentation on all of the properties and their dependencies:

Code: Select all
SupportsColor:                                  True or False
-> SupportsRGB:                                 True or False (requires SupportsColor to be True)
-> SupportsWhite:                               True or False (requires SupportsColor to be True)
      -> SupportsTwoWhiteLevels:                True or False (requires SupportsWhite to be True)
      -> SupportsTwoWhiteLevelsSimultaneously:  True or False (requires SupportsTwoWhiteLevels to be True)
      -> SupportsWhiteTemperature:              True or False (requires SupportsWhite to be True)
      -> SupportsRGBandWhiteSimultaneously:     True or False (requires SupportsRGB and SupportsWhite to be True)

So note SupporsColor needs to be set to True for any of the other properties to be used.

Image

Posted on
Sun Mar 01, 2020 1:10 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: RGB dimmer devices access to build in states

I red all of that, that is clear..

after some more testing it seems to be:
when "onOffState" is used brightness only follow sTHAT state, not brightnessLevel
with property SupportsOnState off and no use of updateStateonserver("onOffState"..) the brightness works fine

Karl

Posted on
Sun Mar 01, 2020 1:23 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: RGB dimmer devices access to build in states

I'm having a hard time following what you mean. Can you walk me through a specific example and the results?

Image

Posted on
Sun Mar 01, 2020 2:00 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: RGB dimmer devices access to build in states

when "SupportsOnState" is true
brightness follows dev.udatestateOnServer("stateonOffState" ,true/false)

Posted on
Sun Mar 01, 2020 2:59 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: RGB dimmer devices access to build in states

What do you mean by "follows?" Can you give me a specific example, with values?

If you are wanting the On command to go to the last known brightness (before it transitioned to the OFF state) then see this thread.

Image

Posted on
Sun Mar 01, 2020 3:15 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: RGB dimmer devices access to build in states

In dev edit / props: "SupportsOnState" is true

dev.updatestateOnServer("onOffState" ,True) ==> brightness=100
dev.updatestateOnServer("onOffState" ,False) ==> brightness =0

dev.updatestateOnServer("brightnessLevel" ,50) does not change brightness

Karl

Posted on
Sun Mar 01, 2020 3:39 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: RGB dimmer devices access to build in states

Did you try changing dev.onBrightensToLast as shown that other thread?

However, I don't see how that would fix this:
kw123 wrote:
dev.updatestateOnServer("brightnessLevel" ,50) does not change brightness

I don't know how / why that would fail. That should always set the brightness if it is a dimmer instance. No error logged in the Event Log?

Image

Posted on
Sun Mar 01, 2020 3:59 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: RGB dimmer devices access to build in states

no errors in log

and what does dev.onBrightensToLast do?
its not in the dimmer example

anyway I am happy now.. do not use SupportsOnState for dimmers then everything works -- for me

Karl

Posted on
Mon Mar 02, 2020 8:37 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: RGB dimmer devices access to build in states

I suggest you try:

Code: Select all
dev = indigo.devices[123]
dev.onBrightensToLast = True
dev.replaceOnServer()

I don't understand why changing SupportsOnState would change the behavior (no doubt it does, but from looking at the code it is a mystery). Regardless, the instance does support the on/off state so you should leave it set to True. Note it is set to True by default for all relay and dimmer instances when it is created. I think the root problem here is probably that we should be defaulting dev.onBrightensToLast to True for new instances but we aren't and you need to explicitly do it yourself.

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 14 guests