Setting RGBW levels via Python script

Posted on
Mon Sep 30, 2019 8:15 pm
srkinard offline
Posts: 320
Joined: Apr 10, 2016
Location: Austin, Texas

Setting RGBW levels via Python script

Hey guys...since the Flux LED plugin isn't evolving, I figure I'd just use some scripts to set the levels on the device.

Here's the device info for the Flux LED unit:

Code: Select all
 616937882     RGBW_02:  alertMode(""), blueLevel("0.0"), blueLevel.ui("0"), brightnessLevel("100"), colorBlue("0"),
               :  colorGreen("0"), colorMode(""), colorRed("0"), colorTemp("0"), colorX("0"),
               :  colorY("0"), effect(""), greenLevel("0.0"), greenLevel.ui("0"), hue("0"),
               :  onOffState("True"), online("True"), redLevel("0.0"), redLevel.ui("0"), saturation("0"),
               :  whiteLevel("54.0"), whiteLevel.ui("54"),

What would the python code to set the Warm White LED levels be for that device?

Thanks
Ross

Posted on
Fri Oct 04, 2019 5:44 pm
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

Re: Setting RGBW levels via Python script

The API to update the states on a device is updateStateOnServer (or updateStatesOnServer to update multiple states at once):

Code: Select all
someDevInstance.updateStateOnServer("whiteLevel", 75)

Unfortunately, that API can only be called from plugins that own/define the device it is being called on. So the call would have to be made from the plugin. From glancing at the plugin's source code it looks like it has some logic for updating the whileLevel currently (search on "whiteLevel"), but I don't know the details of how it works.

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 9 guests