Yeelight rainbow mode

Hi guys I bought Yeelight and raspberry pi 3. Im using nodered node ,
What I want is there somewhere to see how to make rainbow mode and I wish to use but how to? Btw this is my for my final year project.

I use https://flows.nodered.org/node/node-red-contrib-yeelight-compat-hue as my flow.
Thanks in advance for your help, I really need it :slight_smile:
Shafirin

Well since it is your final project, you must have already tried some things, so show us your flow (read How to share code or flow json) tell what you have tried and what problems you are having.

I'm sure you will find lots of people here that will ask you questions that will help you figure this out yourself.

After all if someone else give you the answer, what would you have learned.

Actually im not know well about the node-red and other programming. also, Im not familiar with these command. so, I tried to figure out myself before this, and I failed. that's why im asking the forum to find someone that can help me :slight_smile:

once again, what have you tried? Show us your current flow and explain what problem you have.

I've completed my final year project many years ago.
We can help you, but it's you that need to complete your project.

So what have you tried? Even if it didn't work, we can suggest where you are going wrong.

2 Likes

Okay, this is my 1st mode, that is rainbow effect (not complete). im don't know how to make the rainbow mode after that.

  • I do some research, more of them using rgb code to make the rainbow. im using hex code color. when I tried to change hex to rgb, it show command error
[{"id":"c095d2b3.b127a","type":"function","z":"ab1042c8.676e2","name":"mode colours","func":"for(i=0;i<5;i++){\n\n    var randomColor = Math.floor(Math.random()*16777215).toString(16);\n    msg.payload='{\"on\": true, \"hex\": \"#'+randomColor+'\", \"sat\":0}'  \n    return msg\n}\n","outputs":1,"noerr":0,"x":740,"y":500,"wires":[["d83faa77.40a228"]]},{"id":"f546c651.0c1348","type":"ui_button","z":"ab1042c8.676e2","name":"","group":"d9540242.7d89d","order":5,"width":"6","height":"1","passthru":false,"label":"Rainbow Effect","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"str","topic":"","x":480,"y":500,"wires":[["c095d2b3.b127a"]]},{"id":"d83faa77.40a228","type":"delay","z":"ab1042c8.676e2","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":920,"y":500,"wires":[["f6776d0.4c63a9","915a6d66.fd89"]]},{"id":"f6776d0.4c63a9","type":"debug","z":"ab1042c8.676e2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1130,"y":500,"wires":[]},{"id":"fcae1b8e.804e98","type":"inject","z":"ab1042c8.676e2","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":540,"y":580,"wires":[["c095d2b3.b127a"]]},{"id":"d9540242.7d89d","type":"ui_group","z":"","name":"Easy Light Control","tab":"ac25b9b2.3319c8","order":1,"disp":true,"width":"6","collapse":false},{"id":"ac25b9b2.3319c8","type":"ui_tab","z":"","name":"Yeelight","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

please read this thread and then edit your latest post and fix it - your flow currently can not be imported

1 Like

It would also be useful if you can describe what you mean by rainbow effect as I would have thought randomly generating a colour was what you are after.

for the rainbow effect, I mean something like this
= https://www.youtube.com/watch?v=gbjEqXABnas&t=31s

Have you gone to the site referenced in the explaination of that video and looked at his code to see if you can use something like it with node-red-contrib-yeelight-compat-hue?

You also create your msg.payload to be a string. Where I assume you want it to be an object?

msg.payload='{"on": true, "hex": "#'+randomColor+'", "sat":0}'

should be msg.payload={"on": true, "hex": "#'+randomColor+'", "sat":0}

But theres also a problem with the hex part of your msg.payload. Try googling
"append to string variable javascript" and you should find the answer...