Setting Hue bulb white Colour Temperature

Can anyone please tell me how to change the ColorTemp on a Hue bulb from Vera. I have tried it multiple ways with multiple syntaxes, but cannot make it change

My VeraPlus is on version 1.7.5186 (7.31)
My Hue hub is on version 4.11.0 (9557)
I am using the AltHUE plugin version 1.49
I am using Livarno Lux (LIDL) Smart LED bulbs which are Colour Temperature white bulbs. I have no problem controlling them in the Hue app

From Vera I can Turn them on and off, Dim them, RunHueScene

I have tried using Scenes, using the SetColorTemp command in the Advanced Editor or directly running LUA for which the syntax is

luup.call_action(‘urn:micasaverde-com:serviceId:Color1’, ‘SetColorTemp’, {newColorTempTarget = “W54”}, 306)

I have edited and run the scene both in the native Vera GUI and in AltUI
I have used Reactor actions

I would rather not have to use RunHueScene for this as, though it works fine, it will make the setup and maintenance much more laborious as, to separately change each of four lights in a room, I will have to set up each as a different room in Hue.

But no matter what I do I cannot get the white temperature of the bulb to change
What am I doing wrong?

this is quite old code now :slight_smile:
but from the code I can see that the method is expecting a number between 153 and 500

so this should work

luup.call_action(‘urn:micasaverde-com:serviceId:Color1’, ‘SetColorTemp’, {newColorTempTarget = 154}, 306)

(note: the source code visible here : https://github.com/amg0/ALTHue )

Thank you for your helpful reply. Sorry to be so long responding but other things have occupied me. Looking in the source code, the relevant section - which you referenced in your reply - seems to be as below. The one last detail I am not clear about from this (as my lua coding is rudimentary) is exactly in what format to send the new value. Reading the code, it seems to want a string, but should this be ‘153’ or “153”

function UserSetColorTemp(lul_device,newColorTempTarget)
– The Mired color temperature of the light. 2012 connected lights are capable of 153 (6500K) to 500 (2000K).
debug(string.format(“UserSetColorTemp(%s,%s)”,lul_device,newColorTempTarget or ’ ’ ))
local newTemp = tonumber(newColorTempTarget or 0)
if (newTemp>500) then
newTemp = 500
elseif (newTemp<153) then
newTemp = 153
end
local body = string.format(’{“ct”:%d}’, newTemp )
HueLampSetState(lul_device,body)
end

it should be an associative array containing parameter name and value. in that case parameter is newColorTempTarget and value is a number ( integer ) just like in the example I have put in my previous reply.

in terms of string constant , either single quote or double quote work as long as you use a different one from what the string itself contains.

lua.org manual says:

As a matter of style, you should use always the same kind of quotes (single or double) in a program, unless the string itself has quotes; then you use the other quote, or escape those quotes with backslashes.

Best Home Automation shopping experience. Shop at getvera!

© 2021 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules