Yeelight Color temperature

Post Reply
BullFrog
Posts: 6
Joined: Sunday 03 December 2017 19:41
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Yeelight Color temperature

Post by BullFrog » Sunday 03 December 2017 21:02

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? :\

BullFrog
Posts: 6
Joined: Sunday 03 December 2017 19:41
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Yeelight Color temperature

Post by BullFrog » Wednesday 06 December 2017 2:48

Any chance for a little help? I'm really desperate :(

BullFrog
Posts: 6
Joined: Sunday 03 December 2017 19:41
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Yeelight Color temperature

Post by BullFrog » Tuesday 12 December 2017 8:44

Please help! me or at least give me some hints! :(

woody4165
Posts: 530
Joined: Monday 14 March 2016 14:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: Yeelight Color temperature

Post by woody4165 » Tuesday 12 December 2017 9:47

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?
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat

BullFrog
Posts: 6
Joined: Sunday 03 December 2017 19:41
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Yeelight Color temperature

Post by BullFrog » Friday 15 December 2017 0:00

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) "

woody4165
Posts: 530
Joined: Monday 14 March 2016 14:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: Yeelight Color temperature

Post by woody4165 » Friday 15 December 2017 10:40

I imagine you changed the events from Lua to dzVents

Image
and set it to Device, like the image above
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat

lamouette
Posts: 37
Joined: Friday 20 January 2017 9:47
Target OS: Raspberry Pi
Domoticz version:
Location: France
Contact:

Re: Yeelight Color temperature

Post by lamouette » Friday 15 December 2017 10:53

Why don't you use a scene ?

BullFrog
Posts: 6
Joined: Sunday 03 December 2017 19:41
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Yeelight Color temperature

Post by BullFrog » Sunday 17 December 2017 19:55

lamouette wrote:
Friday 15 December 2017 10: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 2300 times

QSKONE
Posts: 16
Joined: Monday 12 February 2018 13:56
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Yeelight Color temperature

Post by QSKONE » Friday 02 March 2018 21:48

Hi , Hi , it is possible create selector switch with kelvin settings like Yeelight app?
Image[/url]

madrian
Posts: 240
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

Re: Yeelight Color temperature

Post by madrian » Friday 02 March 2018 23:10

It is on the way:

viewtopic.php?f=11&t=13016

Post Reply

Who is online

Users browsing this forum: Markies and 2 guests