Mi(Xiaomi) Smart home bindings?

i believe no progress on this one?
Pity - looks pretty good

Sorry for my lack in reply.
I have moved away from OH for the moment.

Anyhow, I did some research earlier and concluded that I knew too little to find some good information by myself.
I used wireshark to find some package information but wireshark did not give much information, the gateway is talking to a cloud(outside IP) with mDNS, wireshark could not understand the package.

I purchased a CC2531 zigbee sniffer using with a TI sniffer SW I got the whole package from the zigbee sensor. I think the information might be used for something, but not quite sure.
Waiting for a program card for my CC2531 so I can install Contiki OS on it so my RPI can receive the packages.

If you guys want to have this working, please spend some time in looking into it. You might have some knowledge that I don’t.

I believe this github repo with MiLight bindings might be what you’re looking for?

Even though you moved away from oh, would be great if you can share your findings.

I’ve been digging into this done while back (programming cc2531 and all) , bit did not get far enough yet. Still very interesting

Hi everyone, I recently purchased some yeelights (9W, rgbw, they communicate directly via Wi-Fi). My plan is to somehow connect those to my alarm set on my phone. I want them to gradually turn on (simulating sunrise) say half an hour before the alarm goes off. Is there an api already available or is there a way to achieve this using wireshark?
Thank y’all for your help.

Did you see this thread

Did someone managed to do this? Actually the prices of the sensors are quite affordable if you look here:

I am thinking of starting a new project and actually this is the most cheap environment i could cross with, so having the binding with openhab would be a +.

I don’t know if this is relevant…

It seems like there is some progress on SmartThings. Wish Openhab will support Xiaomi soon.

Does anybody have a chance to check this xiaomi hub-mqtt gateway with openhab?

milight is not produced by XiaoMi

Yeelight binding is being reviewed.

You can download from:

https://github.com/openhab/openhab2-addons/pull/1514

BTW, you could setup timer with Sunrise scene to make it happen within Yeelight app.
Any problem, feel free to let me know!

(Xiaomi MiHome) Aqara Smart Home API https://github.com/louisZL/lumi-gateway-local-api
I am not familiar with JAVA, but wish someone can implement this to openhab.

Looking at the files inside this repo I wish I knew Chinese rather than JAVA :wink:

2 Likes

I will try to translate them into english, maybe a bit better than gtranslate.

2 Likes

I made a rough translation here: https://github.com/illxi/lumi-gateway-local-api I hope it helps.

2 Likes

The following code reads values from the xiaomi gateway in a very simple way, the returned String is a JSON String.
Probably that helps to create a openhab binding

import java.io.ByteArrayInputStream;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.nio.charset.StandardCharsets;

public class XiaomiTest {

	public static void main(String[] args) {
		XiaomiTest test = new XiaomiTest();
		test.testConnection();
	}
	
	public void testConnection(){
		try (MulticastSocket socket =  new MulticastSocket(9898); ){
			byte[] b = new byte[1024];
			DatagramPacket dgram = new DatagramPacket(b, b.length);
			socket.joinGroup(InetAddress.getByName("224.0.0.50"));
			while(true) {
			  socket.receive(dgram); 
			  ByteArrayInputStream in = new ByteArrayInputStream(dgram.getData(), 0, dgram.getLength());
			  int n = in.available();
			  byte[] bytes = new byte[n];
			  in.read(bytes, 0, n);
			  String s = new String(bytes, StandardCharsets.UTF_8); 
			  System.out.println(s);
			  dgram.setLength(b.length);
			}
		} catch (Exception e) {
            e.printStackTrace();
		} 
	}

}
3 Likes

I made a python script by modifing jon1012/mihome library. https://github.com/illxi/mihome, it will read status from xiaomi gateway and publish all device status to mqtt server. and It can also turn aqara switches and plug on/off. I will put on more description when I have time.

3 Likes

I made simple OH1 binding - just reading states / events of aqara sub devices. You can check it here: https://github.com/octa22/org.openhab.binding.xiaomigateway
Unfortunatelly there is no controlling of switches (writing ON/OFF) at this time - I have no aqara device supporting write to test it even it is almost prepared. If someone interested we can add/test this feature too…

4 Likes