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

rgbw controller and Lua


ggoetz56

Question

Hi 

could some explain to me what kind of variable or syntax this command needs

fibaro:call(ID_RGB_CONTROLLER, "setColor", "0", "255", "0", "0") 

 

If i define 

local R_value = 255

fibaro:call(ID_RGB_CONTROLLER, "setColor", R_value, "255", "0", "0") 

 

"R_value" is not defined. The command fails.

I tried character and single numeric, global and local etc. or do i have to use a table for all of the 4 values?

I didn't find an example.

 

Thanks 

Gerhard

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

1) open HC2 UI

2) create empty scene "Add scene in LUA"

3) you can see empty LUA editor

4) move mouse left and make hover on the your room / device RGB device and finally you should see

Please login or register to see this image.

/monthly_2019_10/image.png.861469561744b34c3eb4e25e0eb8c8ff.png" />

 

 

just click on any methods.

FIBARO UI insert methods to your editor.

for example as I can understabd you ask how to set colors independ - yes as you can see setR setG setB what you wish.

 

good luck!

 

 

 

  • Thanks 1
Link to comment
Share on other sites

  • 0

all R G B W have to be defined - if off then define as "0"

eg 

fibaro:call(ID, "setColor", "0","0","0","255")

this sets my strip to White

 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Hi

    many thanks for your response.

     

    I know the statement "fibaro:call(ID, "setColor", "0","0","0","255")" 

    Instead of setColor I can use setValue to change brightness or turnOff to switch off the stripes i.e.

    So far, so good BUT i like to use variables for "Red","Blue",Green","White"

    At the very first moment it seems easy to me to define

    Local Red = "0"

    Local Blue ="255"

    .....

    ::::

    fibaro:call(ID, "setColor", "Red","Blue","Green","White")

    Does NOT work.

    I tried Numeric, String, Array, local global, not at all. I even don't find any hints in the forum

    It seems with 

    Please login or register to see this code.

    you store the last "colorset" of your stripes to colorSet i.e. you use "turnOff" to shut down your stripes.

     

    But how do you restore that? Not with fibaro:call(ID, "setColor",  colorSet)

     

    So i can't believe no one has ever changed the colorset of RGBW-Module except with use  of fixed values.

     

     

     

    Link to comment
    Share on other sites

    • 0

    That is achievable.

    I use that myself

    Define the variable

    local red = 232

    local green = 45

    local blue = 55

    local white = 5

     

    fibaro:call(ID,"setcolor",red,green,blue,white)

    There are no "" around the words so the system knows you are asking for variables

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • @@morpheus75

    That is what i tried first, seems logical to me. But failed.

     

    @10der

    that's all I get in the Aktion sektion. There is no Set-RGBW.

     

    I think I got the issue, its the new RGBW2 controller with 500er Chip. I m so lucky.

    Any one has experiences with this module?

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    here is the exact code i use:


      local r = math.random(175,255)
      local g = math.random(25,75)
      local b = math.random(25,75)
      local w = math.random(25,75)

      
      fibaro:call(ID, "setColor", r,g,b,w)
       
      i have a delivery of the new rgbw2 modules. i will check it when i receive them

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • @morpheus75

    Thanks a lot your great.

    So I have some older RGBW-Module I just tried. They behave well!

    The math.random(x,y) statement means you use a value between (ie r) between 175 and 255 by random? 

     

    You know where to create a support-ticket? My last ticket is about 3 years ago:

     

     

     

    Link to comment
    Share on other sites

    • 0

    Yes. The random gives me random colours when I turn strips on.

    Support tickets through the fibaro.com website

    • Thanks 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • OK Thank you guys very much!

    It will do its job. First of all RGBW2 is different to RGBW. So the commands are different.

     

    @morpheus75 Your right the type is numeric. I think the issue was i didn't define the White value (I don't need it, but have to define it) in a correct manner. So if w is nil  fibaro:call(ID, "setColor", r,g,b,w) fails without a debug notice even r,g,b  have correct values.

    @10der SetR() does no longer exists. This is a pity  because i have to change only one color, the other colors should stay at their actually given value. And these  values i don't know. I have to read it with fibaro:getValue(id, "color") witch gives me a string like "255,0,255,125" that I have to separate to the single values of r,g,b,w

    Must be something like gmatch() or so.

     

    Once more thank you for support!

    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.

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