Homematic with Yeelight Xiaomi Mi Bedside Lamp 2

Send simple commands to Yeelight Xiaomi Mi Bedside Lamp 2 from Homematic.

I have a doorbell connected to my Homematic CCU2. In this example it should flash blue a few times if the doorbell rings.

You need the CUx Daemon installed on your Homematic CCU and an Exec-Device registerd in your CCU.
Here is a screenshot how to create this device in CUxD:

After you created this device it is in your Inbox of your CCU.

In my previous article https://www.mogilowski.net/2020/04/21/commandline-api-for-yeelight-xiaomi-mi-bedside-lamp-2-mjctd01yl this is the command to let your lamp blink blue:

printf '{"id":1, "method":"set_scene","params":["cf",10,0,"300, 1, 255, 10, 300, 1, 255, 100"]}\r\n' > /dev/tcp/192.168.10.34/55443

But on the CCU /dev/tcp is not available. But the „nc“ program is.

printf '{"id":1, "method":"set_scene","params":["cf",10,0,"300, 1, 255, 10, 300, 1, 255, 100"]}\r\n' | nc YOUR_LAMP_IP 55443

If you have ssh access on your CCU this command should work to let lamp flash blue.

If you want to execute this command from the Homematic script you need your Exec-Device:

dom.GetObject("CUxD.CUX2801001:1.CMD_EXEC").State("printf '{\"id\":1, \"method\":\"set_scene\",\"params\":[\"cf\",10,0,\"300, 1, 255, 10, 300, 1, 255, 100\"]}\r\n' | nc YOUR_LAMP_IP 55443");

Now create a new Program and select doorbell device. Next step is to select execute script on push:

My Exec-Device has the serial number 1 and the ID CUX2801001. If yours is different you have to change it.

Here is another usefull script. It toogles the power state of the lamp. You can use it as action of an button of an remote controll:

dom.GetObject("CUxD.CUX2801001:1.CMD_EXEC").State("printf '{\"id\":1,\"method\":\"toggle\",\"params\":[]}\r\n' | nc YOUR_LAMP_IP 55443");

You can use all other API commands. But remember to escape “ with \“.

Schreibe einen Kommentar

eMail-Benachrichtigung bei weiteren Kommentaren.
Auch möglich: Abo ohne Kommentar.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.