Jump to content

Association with RGBW and set the color


Recommended Posts

hi,

I have a relay module and when I switch in on I would like an RGBW module to switch on and have the color red.

 

Is this possible with 'Association' or do I need to make a scene (I prefer Association)

 

I do use another scene to set the same rgbw device to green (so last color used would not be an option)

 

thanks for your help in advance!

 

Regards,

Martijn

Link to post
Share on other sites
3 hours ago, mdejager said:

hi,

I have a relay module and when I switch in on I would like an RGBW module to switch on and have the color red.

 

Is this possible with 'Association' or do I need to make a scene (I prefer Association)

 

I do use another scene to set the same rgbw device to green (so last color used would not be an option)

 

thanks for your help in advance!

 

Regards,

Martijn

 

Hi @mdejager

I think you could do it with association but it depends on the type or relay module

I have TKB switches and a group 1 association will trigger a device at the same time.

 

The only issue I can see is that of you change the RGB from red to a different colour then it may retain that colour the next time it switches on.

 

If you did it with a scene and used a trigger in the header you could control the color as well

 

_f

 

 

Link to post
Share on other sites

@mdejager

 

i actually do what you are wanting to do but i have used a scene to perform the action instead of associations for the reason you mentioned above.

association would only turn RGBW on or off and last colour would come back on.

whereas scene means you set the desired colour regardless of previous selected colour.

 

--[[
%% properties
376 value
%% events
%% globals
--]]

local jT = json.decode(fibaro:getGlobalValue("jTable"))

local sw = fibaro:getValue(jT.kitchen.RGBWSW,'value')
--fibaro:debug(sw)
local rgbw = fibaro:getGlobal("rgbw")


if ((sw=='1') and (rgbw == 'set1')) then
while (true) do
math.randomseed(os.time())
  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:debug(rgbw)
    fibaro:debug(r)
fibaro:debug(g)
fibaro:debug(b)
fibaro:debug(w)
  fibaro:call(jT.kitchen.RGBW1, "setColor", r,g,b,w)
    fibaro:sleep(1000)
    fibaro:abort()
  end
 end

if ((sw=='1') and (rgbw == 'set2')) then
while (true) do
math.randomseed(os.time())
  local r = math.random(25,75)
  local g = math.random(175,255)
  local b = math.random(25,75)
  local w = math.random(25,75)
 fibaro:debug(rgbw)
    fibaro:debug(r)
fibaro:debug(g)
fibaro:debug(b)
fibaro:debug(w)
  fibaro:call(jT.kitchen.RGBW1, "setColor", r,g,b,w)
    fibaro:sleep(1000)
    fibaro:abort()
  end
 end

if ((sw=='1') and (rgbw == 'set3')) then
while (true) do
math.randomseed(os.time())
  local r = math.random(25,75)
  local g = math.random(25,75)
  local b = math.random(175,255)
  local w = math.random(25,75)
  fibaro:debug(rgbw)
  fibaro:debug(r)
fibaro:debug(g)
fibaro:debug(b)
fibaro:debug(w)
  fibaro:call(jT.kitchen.RGBW1, "setColor", r,g,b,w)
    fibaro:sleep(1000)
    fibaro:abort()
  end
 end

if ((sw=='1') and (rgbw == 'set4')) then
while (true) do
math.randomseed(os.time())
  local r = math.random(25,75)
  local g = math.random(25,75)
  local b = math.random(25,75)
  local w = math.random(175,255)
 fibaro:debug(rgbw)
    fibaro:debug(r)
fibaro:debug(g)
fibaro:debug(b)
fibaro:debug(w)
  fibaro:call(jT.kitchen.RGBW1, "setColor", r,g,b,w)
    fibaro:sleep(1000)
    fibaro:abort()
  end
 end

if ((sw=='0') and (rgbw=='set1')) then
  fibaro:call(jT.kitchen.RGBW1,'turnOff')
  fibaro:setGlobal("rgbw", "set2")
  end

if ((sw=='0') and (rgbw=='set2')) then
  fibaro:call(jT.kitchen.RGBW1,'turnOff')
  fibaro:setGlobal("rgbw", "set3")
  end

if ((sw=='0') and (rgbw=='set3')) then
  fibaro:call(jT.kitchen.RGBW1,'turnOff')
  fibaro:setGlobal("rgbw", "set4")
  end

if ((sw=='0') and (rgbw=='set4')) then
  fibaro:call(jT.kitchen.RGBW1,'turnOff')
  fibaro:setGlobal("rgbw", "set1")
  end

 

i have setup 4 different colour codes and autoswitching between the different sets with randomisation.

cheers

Link to post
Share on other sites

thanks 

that is what I am afraid of.

 

I prefer association above scenes

6 hours ago, AutoFrank said:

thanks..Yes I do use a scene with a different color.. maybe I set the color first back the color I want to use with association... in the scene.. so when the associated device turns it on.. it will be the last color used... that would work.. do you thinks so?

 

 

 

6 hours ago, AutoFrank said:

Hi @mdejager

I think you could do it with association but it depends on the type or relay module

I have TKB switches and a group 1 association will trigger a device at the same time.

 

The only issue I can see is that of you change the RGB from red to a different colour then it may retain that colour the next time it switches on.

 

If you did it with a scene and used a trigger in the header you could control the color as well

 

_f

 

 

 

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.

Guest
Reply to this topic...

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