Random rgb in room lighting always sending saturation of 0, problem in custom driver ... fixed

seems to be a problem with random rgb in room lighting.. it is always sending a saturation of 0, which for this light always ends up with the same color..

rule machine does not and seems to seand a saturation of 100..

ie

@bravenel

It sends whatever saturation was captured for that device. Random only sets hue.

Note also the apparent fact that your device isn't reporting level correctly. Maybe it's doing the same for saturation. If so, that would be the likely cause of the issue with your Room Lighting automation, and fixing that would fix this (and other problems you're likely to have), too.

aha that would make sense as it really doesnt support that as its a hsm200 which is not true rgb.. but whay does random work in motion lighting and rule machine.. i guess i will leave the rule as is using that instead as at least it works

what would i change in the driver to have it always report 100 as saturation.. looking now.

the devcie and driver only support setcolor.. so what is it using to set and retrived the colors in room lighting?

ok getting farther i have implemented the setvalue and setlevel commands in the driver which were not implmented, but caching in state the current hsv vlaues and creating a new color value with the cached and changed parameter and calling setcolor..

but what function is being used and do i have to implement that returns the current h s v

The individual hue, saturation, and level attributes return the HSV components of the color, respectively (rather than any one single attribute).

For the HomeSeer device, just setting the saturation and level attributes to 100 once, say, on a configure(), seems like it would be a good enough workaround (and then "stubbing out" the setHue(), setLevel(), and similar methods or parts of other methods to note that these attributes don't really work on this device, though if you're only writing and using this driver for yourself, whatever works for you).

1 Like

yes i got them working by doing this.

and adding the attributes level and hue

ie

def setSaturation(value)
{
if ((debugEnable) || (descLog)) log.info "setSaturation() : ${value}"

if ((value < 0) || (value > 100))
 log.error "Saturation Value must be between 0 and 100!"

else
{
    
 //lgk implement that but getting last hue and passing to set color
 def newvalue = [:]
                
 newvalue.saturation = value
 newvalue.hue = state.hue
 newvalue.level = state.level
 setColor(newvalue)
}

}

def setHue(value)
{
if ((debugEnable) || (descLog)) log.info "setHue() : ${value}"

if ((value < 0) || (value > 100))
 log.error "Hue Value must be between 0 and 100!"

else
{
    
 //lgk implement that but getting last hue and passing to set color
 def newvalue = [:]
                
 newvalue.hue = value
 newvalue.saturation = state.saturation
 newvalue.level = state.level
    
 log.debug "new value = ${newvalue}"
 setColor(newvalue)
}

}

here is my driver if you want to take alook