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!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

scene with hue.


Question

Posted

so im almost 6 months busy with this hue!

i got a room with 4 hue lights. but i want to control them separate. one above tabel and one above coach.
so if i one 2  lights tabel the other 2 keeps off. and if on the other 2 lights coach the other stays on the situation what they are.

and visa versa. with scene blocks you cant do that

you have to do with lua, but i dont anything about it , and cant nothing on this forum

 

any one can help me?

12 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • Posted

    he guys 

     

    Cag014 is good help for he made this scene  for me it works splendid

    the idea was to make one button controlling 2 lights. so now Hue light ID 141 is controlling Hue light ID 119. On/Off and brightness

     

     

    --[[

    %% properties
    141 ui.onOff.value
    141 ui.brightness.value
    141 ui.hue.value
    141 ui.saturation.value
    %% globals
    --]]
     
    function setValue(copyFrom, copyTo, valName)
    local act = {"true", "false"} --true=turnOff, false=turnOn
     
    local valSet = fibaro:getValue(copyFrom, valName)
    local uri = "/api/plugins/callUIEvent?deviceID=" ..copyTo .. "&elementName="
    local HC2 = net.HTTPClient()
     
    if (valName == "ui.onOff.value") then
        uri=uri .. "onOff&eventType=onToggled&value=" .. act[tonumber(valSet)+1]
    elseif  (valName == "ui.brightness.value") then
       uri=uri .. "brightness&eventType=onChanged&value=" .. valSet
    elseif  (valName == "ui.hue.value") then
       uri=uri .. "hue&eventType=onChanged&value=" .. valSet
    elseif (valName == "ui.saturation.value") then
      uri=uri .. "saturation&eventType=onChanged&value=" .. valSet
    end
     
    HC2:request("

    Please login or register to see this link.

    .. uri,{method = "GET"})
    end 
     
    local startSource = fibaro:getSourceTrigger()
    local devID = tonumber(startSource["deviceID"]) 
     
    -- set device 141 to same state as device 119
    if (devID == 141 ) then 
    setValue(devID, 119, startSource["propertyName"] )
    end

     

     

     

     

     

    Thanks a lot Cag014

    • 0
    Posted

    +1

    • 0
  • Inquirer
  • Posted

    maybe I simple guide? why is this forum so dead?

    anyone know other website?

    • 0
    Posted

    Tamil112,

    You can find ton of LUA guides on internet - just search something like LUA for beginners.

    But you need to be familiar with Fibaro functions, which are heavily used in code.

    Please refer to  

    Please login or register to see this link.

     

    Just for an example could you describe what exactly you want to do (please include your device IDs) and I'll try to write a simple code to start with... 

    Your description above doesn't include who should trigger the lights?

    • 0
  • Inquirer
  • Posted

    hi cag014

     

    thanks for the website. i should make free time and start learning this stuff  :->

     

    my problem is

    i got 4 hue lights in one room
    id 131

    id 132

    id 118

    id 119

    if i one the 131 and 132 the 118 and 119 also is switch on. and visa versa.

    but i want to control them separate.

     

    so that if on the 118+119 , the 131 + 132 stay on there current situation and visa versia

    the other rooms i got module,so i could make scene with the block scene.

    but the hue you cant make scene with the lua.

     

    you got any idea if this is possible what i want.

    Please login or register to see this image.

    /emoticons/default_icon_rolleyes.gif" alt=":roll:" />

    • 0
    Posted

    Ok... as I understand you're using Hue plugin and you've four of them with different IP for each, right?

     

    Now the question how come that when you turn on of them ON all others are turned ON as well?

    • 0
  • Inquirer
  • Posted

    jup I got 4 with 4 ip.

    I on and off them with the plug in button.

    when first add the bridge and light. with that I on and off them.

    but I also got 4 "devices" with 4 ips.

    I want to 1 button for 2 light. and control them separately.

    • 0
  • Inquirer
  • Posted

    Please login or register to see this image.

     

    this are my hue lights.

     

     

    • 0
    Posted

    Sorry, but I'm a little bit confused...

    You have 118,119, 131,132, correct? 

    Now let me see if I understand what do you need - 

    When you turn ON device ID 131, you want ID-132 ON as well and ID-118/119 should stay without change.

    When you turn ON device ID 118, you want ID-119 ON as well and ID-131/132 should stay without change.

    According to above you've separate control on two devices (118/119) and (131/132). 

    Is it right?

     

    By the way to control plugin a little be tricky...need to use API (http), but could be done.

    • 0
    Posted

    Here is the code for what I believe you've asked for:

    Please login or register to see this code.

    When you switch device 118 the scene will set device 119 to same status (ON or OFF).

    Same for device 131 and 132

    Please notice that the scene triggered by devices 118 and 131 only (as defined at code's header, property portion).

    Devices 119 and 132 will not trigger the scene.

    Create new scene and copy the code. Please set scene to Active and at least 4 instances. 

    In any case play with the code as you need...

     

    To my opinion the better way is to create Virtual Device with two buttons to control the lights... let me know if you want me to help you with virtual device.

    • 0
  • Inquirer
  • Posted

    Please login or register to see this image.

    /emoticons/default_icon_eek.gif" alt=":shock:" /> dude thats a huge code!!

     

    but it works! i never could figure this out on my own!
    thanks for it!

    what do you mean with virtuale device? is that even better?
    i see that you can add slider with virtual device. that would be even great.then i also can use the brightness and colors!

    could you help?

    Please login or register to see this image.

    /emoticons/default_icon_redface.gif" alt=":oops:" />

    • 0
  • Inquirer
  • Posted

    is it possible too adjust the brightness?

    because now it just on and off it.

    can't I adjust that both light have same brightness? if I adjusted one light other goes to the same brightness level.

    Join the conversation

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

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