Page 1 of 1

RGBW colour flash cycle or fade

Posted: Friday 20 November 2015 12:12
by christwigg1974
Hi All

Firstly, thanks for a great product!

I have a doorbell when pushed triggers a sonos script to play a doorbell mp3.

I would also like the LED lights to flash between red and white for a visual alert. (fade & cycle commands would also be nice to have in the future)

logic:-
if cupboard lights are on > flash red twice > return to white on.
if cupboard lights are off > flash red twice > return to off.

I have tried blocky but all the events happen at the same time which does not change the colour.
I have tried scenes but in blocky you cannot 'switch on after'

any ideas ?

I have also tried lua but cannot figure how to pause between commands.

commandArray = {}
if (devicechanged['Kitchen Cupboard Lights'] == 'On') then
commandArray=['Scene:Kitchen_Cupboard_Lights_Red']='On'
commandArray=['Scene:Kitchen_Cupboard_Lights_White']='On'
commandArray=['Scene:Kitchen_Cupboard_Lights_Red']='On'
commandArray=['Scene:Kitchen_Cupboard_Lights_White']='On'
elseif (devicechanged['Kitchen Cupboard Lights'] == 'Off') then
commandArray=['Scene:Kitchen_Cupboard_Lights_Red']='On'
commandArray=['Scene:Kitchen_Cupboard_Lights_White']='On'
commandArray=['Scene:Kitchen_Cupboard_Lights_Red']='On'
commandArray=['Scene:Kitchen_Cupboard_Lights_White']='On'
commandArray=['Scene:Kitchen_Cupboard_Lights_White']='Off'
print('Kitchen_Cupboard_Flash was switched ON')
end


Any ideas would be greatly appreciated.

Many Thanks

Chris

Re: RGBW colour flash cycle or fade

Posted: Friday 20 November 2015 19:13
by Roncalli
Hi Chris,

have you tried to include a time component, e.g.:

commandArray = {}
if (devicechanged['Kitchen Cupboard Lights'] == 'On') then
commandArray=['Scene:Kitchen_Cupboard_Lights_Red']='On'
commandArray=['Scene:Kitchen_Cupboard_Lights_White']='On AFTER 3'
commandArray=['Scene:Kitchen_Cupboard_Lights_Red']='On AFTER 6'
commandArray=['Scene:Kitchen_Cupboard_Lights_White']='On AFTER 9'
elseif (devicechanged['Kitchen Cupboard Lights'] == 'Off') then
commandArray=['Scene:Kitchen_Cupboard_Lights_Red']='On'
commandArray=['Scene:Kitchen_Cupboard_Lights_White']='On AFTER 3'
commandArray=['Scene:Kitchen_Cupboard_Lights_Red']='On AFTER 6'
commandArray=['Scene:Kitchen_Cupboard_Lights_White']='On AFTER 9'
commandArray=['Scene:Kitchen_Cupboard_Lights_White']='Off AFTER 12'
print('Kitchen_Cupboard_Flash was switched ON')
end

Additionally, you might want to check wether your doorbell bas been rung:

if (devicechanged['Doorbell'] == 'On' and otherdevices['Kitchen Cupboard Lights'] == 'Off') then
...

Also, I'm not sure whether the elseif works. You might want to try simple if-statements. Check the wiki (http://www.domoticz.com/wiki/Events).

Rgds F.