Jump to content
  • 0

Dimming of Philips Hue with scene




I am trying to make a scene in LUA where I can dim my Hue bulbs.


I have a Sunricher 4ch switch, which I have created scenes for turnOn and turnOff Hue bulbs, and it works nicely, as in the picture below: 




I want to make a new scene, where the button´s HELD DOWN function should utilize dimming of the Hue bulb.

I have tested some commands from the Hue Developer API, and found out that if I "PUT" the below command to the Hue-bulb, it increases the saturation with 1 for each time I press "PUT". 




Is it possible to make a repeat loop / while loop or similar that sends this command? I know this is not the LUA API, it is in the REST API. 


I can not quite see how to send similar commands in LUA, unless there is a way to make a repeat loop that takes the saturation value and adds "1" e.g. each 10 millisecond while the switch is in HELD DOWN state? 






Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I did find a way to send the commands, now all I need to figure out is how to loop the function WHILE the button is HELD DOWN. Anyone who knows how to do it?


Code below works so that it sends a "-10" value to the brightness parameter of the Hue bulb, so that it dims it from its current state instead of sending a new value to the brightness-parameter such as e.g. 254 for full brightness. 


%% properties
%% weather
%% events
19 CentralSceneEvent 2 HeldDown
%% globals

local startSource = fibaro:getSourceTrigger();
if (
 ( (startSource["type"] == "event" and startSource["event"]["type"] == "CentralSceneEvent") )
startSource["type"] == "other"
url = 'http://myBridgeIP/api/myUsername/lights/2/state'
local function putMethod(requestUrl, successCallback, errorCallback)
  local http = net.HTTPClient()
  http:request(requestUrl, {
      options = {
        method = 'PUT',
        data = message
      success = successCallback,
      error = errorCallback
    message = '{"bri_inc":-10}' 
        print('Status dla PUT: ' .. resp.status)
        print('error' .. err)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...