updating dimmer device RGB properties

Posted on
Tue Mar 14, 2017 10:14 pm
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

updating dimmer device RGB properties

I am currently working on my first plugin. I am starting from the Indigo 7.0.0 version of the 'Example Device - Relay and Dimmer' plugin. I am integrating with Osram Lightify bulbs, using native tcp calls for controlling the light features. I've made progress with turning the bulbs on/off as well as brightness, and now I am trying to set the color/temp settings for the bulbs.

I am testing using the new method in the dimmer python class - indigo.dimmer.setColorLevels(device, ..) . In the actionControlDevice method of plugin.py, I added some debug info as if any of the 'channelKeys' for supporting RGB, Color, White, etc were being set. I was able to see that 'ownerProps' and 'metaProps' dict objects were properly updated with the configuration from my Devices.xml .. However, the core properties on the root device didn't seem to have the settings... Below is sample log info from outputting the whole device dimmer object:

***
greenLevel : None
id : 570176344
lastChanged : 2017-03-14 20:55:20
lastSuccessfulComm : 2017-03-14 20:55:20
ledStates : []
model : Osram Lightify Group
name : Great Room Lightify
onBrightensToDefaultToggle : False
onBrightensToLast : False
onState : False
------ BW - These ownerProps are properly setup from Devices.xml ---
ownerProps : com.woodsmachine.lights.OsramLightify : (dict)
- SupportsRGB : true (bool)
- SupportsTwoWhiteLevels : false (bool)
- SupportsWhite : true (bool)
- SupportsWhiteTemperature : true (bool)
- groupName : Great Room (string)

pluginId : com.woodsmachine.lights.OsramLightify
pluginProps : emptyDict : (dict)
protocol : Plugin
redLevel : None
remoteDisplay : True
states : States : (dict)
brightnessLevel : 0 (integer)
groupBrightness : 11 (integer)
groupColor : (255, 255, 255) (string)
groupColorTemp : 2702 (integer)
groupOnState : 1 (integer)
onOffState : off (on/off bool)
subModel :
------ BW - These root properties dont have the correct values ?? ---
supportsAllLightsOnOff : False
supportsAllOff : False
supportsColor : False
supportsRGB : False
supportsRGBandWhiteSimultaneously : False
supportsStatusRequest : True
supportsTwoWhiteLevels : False
supportsTwoWhiteLevelsSimultaneously : False
supportsWhite : False
supportsWhiteTemperature : False

version : None
whiteLevel : None
whiteLevel2 : None
whiteTemperature : None
***


I believe the sample plugin.py 'actionControlDevice' method is looking in the root properties for the device.. You can see that all of these properties for Color/RGB/etc are False, whereas the 'ownerProps' and 'metaProps' have the proper info from my Devices.xml. See the bolded items in the log output above

I am new to plugin development and these concepts. However, I am guessing I should try to properly set these root device properties in order to have support for other stuff in the future (i.e. the Config UI, Control Pages, etc)

Any suggestions are appreciated.

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

Posted on
Wed Mar 15, 2017 7:58 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: updating dimmer device RGB properties

You also need to set the SupportsColor property to True. In the SDK example plugin that one is set dynamically inside the plugin.py file, but you can set it in Devices.xml like you did with the other properties.

Image

Posted on
Wed Mar 15, 2017 10:00 am
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

Re: updating dimmer device RGB properties

Thanks Matt I will 'SupportsColor' setting as well..

In terms of the 'root' device properties (probably not the correct terminology) vs. the 'ownerProps' properties (that are read in from Devices.xml) .. Do these need to by synchronized somehow? Or should I just re-write the code in plugin.py to check 'ownerProps' instead? This code appears to be using the root device props

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

Posted on
Thu Mar 16, 2017 7:47 am
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

Re: updating dimmer device RGB properties

ok.. so looks like the 'SupportsColor' property enabled all of the stuff that wasn't quite working for me before. The 'actionControlDevice' now properly figures out all of the channel stuff.. I am good to go now and the UI shows all of my devices as having these color attributes.

One question that is more along the lines of different color changing bulbs. The Osram Lightify bulbs are categorized as RGBW (color plus white) as well as 'Tunable White' (no RGB). Both types support full range of white as 'color temperature' . Any examples of bulbs that use a 'White Level', as Lightify bulbs don't really use it? All my stuff seems to be fine ignoring 'White Level', but was thinking I could somehow update the UI such that the 'White Level' isn't even shown

thanks again!

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

Posted on
Sat Mar 18, 2017 11:12 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: updating dimmer device RGB properties

Yeah, changing the pluginProps will automatically push down those changes into the device's attributes (in cases where there are attributes) but there is some conditional logic in some cases like this one where SupportsColor has to be True before the RGB and White properties are pushed.

There isn't currently a way to hide the white level UI if SupportsWhite is True. So for the Osram in the RGBW case you cannot specify an independent white brightness, but can only specify the white temperature? If I wanted 100% Green with just a little bit of warm white mixed in, how would I do it?

Image

Posted on
Sat Mar 25, 2017 9:33 am
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

Re: updating dimmer device RGB properties

Hey Matt, thanks for the reply.. I have to say I am no expert on color theory.. Just tried reading up on it a bit but this was a little more than I wanted to take on for a Saturday morning :)

So this much I do know in regards to Osram Lightify and what I have experimented with:
- REST API from Osram supports the following:
    - set on/off
    - set brightness
    - set color temperature in K (1900-6500)
    - set RGB color as 6 digit hex (FFA509)
    - set hue (0-360)
    - set saturation (0-1)
- Native Python Library (not from Osram) - doesn't seem to expose all of the same features:
    - set on/off
    - set luminance (brightness)
    - set color temperature
    - set RGB color

I am going to play around with it a bit as I am thinking that maybe not all of the REST API functionality is mutually exclusive. For example, if I set some of the 'hue' and 'saturation' levels to extremes maybe it would actually change the color temp and/or color rgb.. I guess this is the intersection of my last task for integrating the native python library. So far I have my Osram plugin capable of using either the REST API or Native Python library (abstracted by common module). However, I haven't yet attempted the RGB color changing via python library.

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 5 guests