Page 1 of 1

Yeelight Color temperature

Posted: Sunday 03 December 2017 20:02
by BullFrog
Hello,

Tried to find solution (google, youtube, this forum), but in the last 2 days I didn't have luck, so I'm begging you to help me achieve the most simple task ever!

Xiaomi YeeLight RGBW color temperature, read WIKI, but as a newbie it kinda misses a few steps, and I might try to do something easy and forgetting a crucial step somewhere.

Domoticz Beta V3.8701 for Synology DS215j

Making the dummy Hardware
Image

Dummy selector switch named : "Color Temperature"
Image

Code I copy-pasted from wiki, and changed IP for the current IP address of the RGBW bulb (fix IP from router with DHCP), I guess the port is fix, so I haven't really changed it.
Image

Changed selector switch to DIMMER and tried to ADD the bulb as a sub/slave, but also tried to do without this step, same outcome.
Image

When I added as a sub, it changed the original Bulb Switch on/off, but in fact the bulb stayed ON all the time, never turned off or on by this, it maybe a helpful info.
Image



Log when I use the dimmer for color temperature, no error messages :(

Code: Select all

 2017-12-03 19:48:05.796 User: BullFrog initiated a switch command (56/Color Temperature/Set Level)
2017-12-03 19:48:05.803 (Dummy) Light/Switch (Color Temperature)
2017-12-03 19:48:05.839 LUA: sudo echo -ne '{"id":1, "method":"set_scene","params":["ct",3812, 75]}\r\n' | nc -w1 192.168.0.221 55443
2017-12-03 19:48:05.839 LUA: Color Temp= 3812
2017-12-03 19:48:09.048 User: BullFrog initiated a switch command (56/Color Temperature/Set Level)
2017-12-03 19:48:09.055 (Dummy) Light/Switch (Color Temperature)
2017-12-03 19:48:09.093 LUA: sudo echo -ne '{"id":1, "method":"set_scene","params":["ct",6404, 75]}\r\n' | nc -w1 192.168.0.221 55443
2017-12-03 19:48:09.093 LUA: Color Temp= 6404
2017-12-03 19:48:10.707 User: BullFrog initiated a switch command (56/Color Temperature/Set Level)
2017-12-03 19:48:10.714 (Dummy) Light/Switch (Color Temperature)
2017-12-03 19:48:10.787 LUA: sudo echo -ne '{"id":1, "method":"set_scene","params":["ct",0, 75]}\r\n' | nc -w1 192.168.0.221 55443
2017-12-03 19:48:10.787 LUA: Color Temp= 0
2017-12-03 19:48:15.178 (YeeLight Controller) Lighting Limitless/Applamp (Hálószoba - RGBW LED)
2017-12-03 19:48:15.217 LUA: sudo echo -ne '{"id":1, "method":"set_scene","params":["ct",6452, 75]}\r\n' | nc -w1 192.168.0.221 55443
2017-12-03 19:48:15.217 LUA: Color Temp= 6452 

What step did I miss or screw up? :\

Re: Yeelight Color temperature

Posted: Wednesday 06 December 2017 1:48
by BullFrog
Any chance for a little help? I'm really desperate :(

Re: Yeelight Color temperature

Posted: Tuesday 12 December 2017 7:44
by BullFrog
Please help! me or at least give me some hints! :(

Re: Yeelight Color temperature

Posted: Tuesday 12 December 2017 8:47
by woody4165
Try this command

Code: Select all

warm_white=(255*65536)+(172*256)+68
runcommand25 = "sudo echo -ne '{\"id\":1,\"method\":\"set_scene\", \"params\":[\"color\", "..warm_white..", 25]}\\r\\n' | nc -w1 " ..IP.." " ..PORT.."";
os.execute(runcommand25);
 
where warm_white is obtained with the RGB formula as above (R*65536)+(G*256)+B

in this case you will set the color and the brightness (25)

I've transformed your script in dzVents and it's working fine, included the Off that turns off the lamp.
Just added the off command in case CalcValue is nil

Code: Select all

return {
	on = {
		devices = {
			'ColorTemp'
		}
	},
	execute = function(domoticz, device)

        IP = '192.168.xx.xx';
        PORT = 'xxxxx'
      
        if device.state == 'Off' then -- turn off
            runcommandoff = "sudo echo -ne '{\"id\":1,\"method\":\"set_power\", \"params\":[\"off\", \"smooth\", 500]}\\r\\n' | nc -w1 " ..IP.." " ..PORT.."";
            os.execute(runcommandoff);
       --  print(runcommandoff) 
         
        else
            CalcValue = ((device.level-1)*48)+1700;
            if CalcValue==nil then
                CalcValue=0
                print("CalcValue = "..CalcValue)
                runcommandoff = "sudo echo -ne '{\"id\":1,\"method\":\"set_power\", \"params\":[\"off\", \"smooth\", 500]}\\r\\n' | nc -w1 " ..IP.." " ..PORT.."";
                os.execute(runcommandoff);
            else
                print("CalcValue = "..CalcValue)
                runcommand = " sudo echo -ne '{\"id\":1,\"method\":\"set_scene\", \"params\":[\"ct\", "..CalcValue..", 50]}\\r\\n' | nc -w1 " ..IP.." " ..PORT.."";
                os.execute(runcommand);
                
            end
        end

    	end
}

Do someone know the formula to use dimmer to change color from 0% to 100% on all the RGB values?

Re: Yeelight Color temperature

Posted: Thursday 14 December 2017 23:00
by BullFrog
Thank you for trying to help me, I really appreciate it!

Tried to copy paste your 2nd code and overwrite the previous one but keeping the IP and port numbers, but the dummy slider switch seems to do nothing.

In the log I get this, but nothing changes :
" 2017-12-14 23:12:22.550 User: BullFrog initiated a switch command (56/Color Temperature/Set Level)
2017-12-14 23:12:22.990 (Dummy) Light/Switch (Color Temperature)
2017-12-14 23:12:48.186 User: BullFrog initiated a switch command (56/Color Temperature/Set Level)
2017-12-14 23:12:48.218 (Dummy) Light/Switch (Color Temperature) "

Re: Yeelight Color temperature

Posted: Friday 15 December 2017 9:40
by woody4165
I imagine you changed the events from Lua to dzVents

Image
and set it to Device, like the image above

Re: Yeelight Color temperature

Posted: Friday 15 December 2017 9:53
by lamouette
Why don't you use a scene ?

Re: Yeelight Color temperature

Posted: Sunday 17 December 2017 18:55
by BullFrog
lamouette wrote: Friday 15 December 2017 9:53 Why don't you use a scene ?
I want to, but there is absolutely no option in events to change color temperature :\
using only the RGB colors I can't manage to get that warm color I want to use, it is neutral white or simple yellow, there is nothing inbetween here.
I think yeelight is using different leds for warm-neutral-cold color emperatures.



@woody4165
yes, tried it with that also, in theory it is working, but physically it does nothing for me:

Code: Select all

 2017-12-17 19:13:03.604 User: BullFrog initiated a switch command (71/ColorTemp/Set Level)
2017-12-17 19:13:03.616 (Dummy) Light/Switch (ColorTemp)
2017-12-17 19:13:03.746 dzVents: Info: Handling events for: "ColorTemp", value: "Off"
2017-12-17 19:13:03.746 dzVents: Info: ------ Start internal script: RGBW_dz: Device: "ColorTemp (Dummy)", Index: 71
2017-12-17 19:13:03.979 dzVents: Info: ------ Finished RGBW_dz
2017-12-17 19:13:05.075 User: BullFrog initiated a switch command (71/ColorTemp/Set Level)
2017-12-17 19:13:05.082 (Dummy) Light/Switch (ColorTemp)
2017-12-17 19:13:05.232 dzVents: Info: Handling events for: "ColorTemp", value: "On"
2017-12-17 19:13:05.232 dzVents: Info: ------ Start internal script: RGBW_dz: Device: "ColorTemp (Dummy)", Index: 71
2017-12-17 19:13:05.232 dzVents: CalcValue = 6404
2017-12-17 19:13:05.271 dzVents: Info: ------ Finished RGBW_dz 
Tried to rename/redo the switch and script, the IP address for bulb is fix, I get no error message, it just does nothing.
Using this beta domoticz (also didnt work with previous version...) : domoticz_armada375-6.1_3.0.8770-7.spk 03-Dec-2017 22:00 15M
5313.png
5313.png (31.94 KiB) Viewed 3747 times

Re: Yeelight Color temperature

Posted: Friday 02 March 2018 20:48
by QSKONE
Hi , Hi , it is possible create selector switch with kelvin settings like Yeelight app?
Image[/url]

Re: Yeelight Color temperature

Posted: Friday 02 March 2018 22:10
by madrian
It is on the way:

viewtopic.php?f=11&t=13016