Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,


as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.


As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!



Smart Home Forum by FIBARO Team

  • 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: 


Please login or register to see this image.

/monthly_2018_12/image.png.98756ca856cefeddf0b16537c7ed3cb5.png" alt="image.png.98756ca856cefeddf0b16537c7ed3cb5.png" />


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". 


Please login or register to see this link.


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 comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0
  • Inquirer
  • 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 comment
    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...