Need PicoC script for Yeelight RGB

450 views
Skip to first unread message

Sergey Rozenblat

unread,
Jun 28, 2017, 10:37:17 AM6/28/17
to Loxone English
I've found Yeelight (https://www.yeelight.com/) products has very simple API that can be almost fully controlled by Loxone. Bought myself their RGB strip and RGB bulbs. Chineese made but strip is even better (though less powerfull) than Loxone original strip, bulbs are very quality build - I'm surprised.

So after connecting to your wifi network through the App you have to enable Developer Mode. Then create virtual output in Loxone for tcp://192.168.x.xx:55443 and use commands like:
{ "id": 1, "method": "set_power", "params":["on", "smooth", 3500]}
{ "id": 1, "method": "set_rgb", "params":[65536, "smooth", 500]}
to operate everything.

API is documented here:

Thing is with this API you can control color through Loxone interface. Just need to convert Loxone's output ranging from 001001001 to 100100100 (RGB in 0-100%) into RGB decimal (1-16777215) which is described well in API documentation.

I did this using Formula and Integer blocks. If only Formula block support rounding this all probably could be done with just one block. Currently it looks like this.


I really don't want to replicate this amount of blocks for all my Yeelight strips and bulbs. I'm sure PicoC script will be convenient solution with one input and one output and very simple math inside. I just don't know how to program in PicoC. If anyone can help me and provide simple base to start - I need a base script reading input, doing some math inside and providing final variable as output - then I can probably do the math in the middle.

Nico

unread,
Oct 4, 2017, 12:55:40 PM10/4/17
to Loxone English
Hello,

Did you have a .LoxPLAN config  fiel of this example?

Thank´s Nico

28. Juni 2017 16:37:17 UTC+2 write Sergey Rozenblat:

OnWaVo

unread,
Feb 12, 2019, 2:31:00 PM2/12/19
to Loxone English
Just bought a yeelight lamp for testing and found this:


Looks easy. But on my first try it doesnt do anything. Hopefully you can figure it out.




Reply all
Reply to author
Forward
0 new messages