Mi(Xiaomi) Smart home bindings?

please tell me the current status of the project. What are the difficulties? a) can be get any sensor data? b) whether it is possible to do the script, at least through openhab, but works correctly with xiaomi c) whether to take xiaomi home kit for the purpose of working through openhab. I looked at githab code, it seems to me that there is still damp.

I am totally new to this and like to ask: What do I need to make use of cheap xiaomi gateway and sensors and combine them with heating regulationā€¦ if those also work on ZigBee e.gā€¦
A rapsberry/computer + ZigBee dongle?

For OpenHAB 2 I now added as well the cube controller (Magic Controller). You can get the current version as a jar from here: https://dl.dropboxusercontent.com/u/2377534/org.openhab.binding.mihome-2.1.0-SNAPSHOT.jar

Merge request on openhab2 is here: https://github.com/openhab/openhab2-addons/pull/1660

Hope it will get merged at some time.

6 Likes

Any ideas how to connect to Xiaomi Mi Universal Smart Remote IR Controller OH2

How can I add the switch button
Is it possible to send the switch button over openhab2 a write command?

Great work!

Awesome work, thanks!
I like to add my Things/Items manually in OH2, can you add example of xiaomi.things and xiaomi.items in the README ?
Thanks

Excellent work! I like it soo much. Everything is working fine! temperature/humidity & motion sensors, switch buttons, door/window sensors. Thanks for your work!
I hope sometimes Xiaomi Purifier 2 will be support too :slight_smile:

Yeah, Iā€™m super happy with the binding as well. Great job @Ondrej_Pecta and @pboos :slight_smile:
Iā€™m hoping thereā€™ll be speaker support as well. This is the only thing for me to run complete setup!
Iā€™d like to incorporate openHABā€™s say and playSound goodness with Xiaomi Gateway.

I did some reverse engineering with my own setup - used Wireshark to scan UDP packets sent from my phone to catch the data but itā€™ll take some time to decipher it and find anything useful.

Iā€™m keen to try mi-radio solution found on GitHub - itā€™s basically a local node.js wrapper for the Xiaomi radio (Ximalaya) API. The same idea ximiraga.ru uses.

I hope someone will make the speaker open someday!

In the meantime, Iā€™ve submitted an issue on louisZLā€™s repo with translated message :wink:

I have a problem with the switch button.
I can dont implement the click, doubble click or long click. Have you a idea for me.
I have a error when i link the button to a item.

Right now, as I see, we can not add the switch buttons as Item, but we can use them in rules.
This is my working xiaomi.rules:

rule "Balcony Yeelight ON"
when
    Channel "mihome:sensor_switch:158d0001287ada:button" triggered CLICK or
    Item BalconyMotionSensor_MotionStatus changed from OFF to ON
then
        logInfo("RULES", "Balcony Yeelight ON")
                pushover("Balcony Yeelight ON")
        sendCommand(BalconyYeelightWhiteLEDBulb_Brightness, ON)
        createTimer(now.plusMillis(60000)) [ |sendCommand(BalconyYeelightWhiteLEDBulb_Brightness, OFF) ]
end

rule "Balcony Yeelight OFF"
when
    Channel "mihome:sensor_switch:158d0001287ada:button" triggered DOUBLE_CLICK
then
        logInfo("RULES", "Balcony Yeelight OFF")
                pushover("Balcony Yeelight OFF")
        sendCommand(BalconyYeelightWhiteLEDBulb_Brightness, OFF)
end

rule "Toilet Yeelight ON 2 mins"
when
    Channel "mihome:sensor_switch:158d00013f6f65:button" triggered CLICK
then
        logInfo("RULES", "Toilet Yeelight ON 2 mins")
                pushover("Toilet Yeelight ON 2 mins")
        sendCommand(ToiletYeelightWhiteLEDBulb_Brightness, ON)
        createTimer(now.plusMillis(120000)) [ |sendCommand(ToiletYeelightWhiteLEDBulb_Brightness, OFF) ]
end

rule "Toilet Yeelight ON"
when
    Channel "mihome:sensor_switch:158d00013f6f65:button" triggered LONG_CLICK_PRESS
then
        logInfo("RULES", "Toilet Yeelight ON")
                pushover("Toilet Yeelight ON")
        sendCommand(ToiletYeelightWhiteLEDBulb_Brightness, ON)
end

rule "Toilet Yeelight OFF"
when
    Channel "mihome:sensor_switch:158d00013f6f65:button" triggered DOUBLE_CLICK
then
        logInfo("RULES", "Toilet Yeelight OFF")
                pushover("Toilet Yeelight OFF")
        sendCommand(ToiletYeelightWhiteLEDBulb_Brightness, OFF)
end
2 Likes

please tell me how to use and connected Mi Smart Socket? and gateway rgb light?

Iā€™m not very competent. As your bind install on openhab2

I still do not understand if the binding is supported under OH2 and if it is what is not supported (i understand items are not supported but just usage if things in rules)

TX for explaining

It is working fine in OpenHAB2
Working as Thing and Item: Motion sensor (Items: Motion Status, Last Activity), Door/Windows open/close sensor (Item: Open Status), Temperature & Humidity Sensor (Items: Temperature, Humidity), Gateway (Items: Brightness, Color, ColorTemperature), Switch button (No Item).
I donā€™t have other things like eplug, magic cube etcā€¦

So, Items are supported, if exist under the things.

1 Like

Alright, I think we need to clarify some stuff here :slight_smile:

First @Ondrej_Pecta created a binding for OH1 - available on his github. Binding is called xiaomigateway.

Then @pboos jumped in and basing on some of @Ondrej_Pectaā€™s findings created a OH2 binding called mihome. He then submitted a Pull Request to official openhab2-addons repository to signalize that itā€™s being developed and not to duplicate efforts.

The latest source of MiHome binding is located in this folder. Youā€™ll find some readme here as well.

Regarding [quote=ā€œvshaev, post:113, topic:4711, full:trueā€]
Iā€™m not very competent. As your bind install on openhab2
[/quote]

You need a compiled JAR of @pboosā€™s binding to be placed in your /addons/ folder. Then follow the instructions in README in order to activate Developer mode.


I strongly encourage all of you to submit the issues, review the code and help contributing to the code of this binding! The sooner we catch and fix all the bugs, the better. :slight_smile:

3 Likes

I think the problem is, that many people (including me) are not able to compile a *.jar from the github sources.

Please can anybody provide a jar from the actual sources for OH2?

Or could you provide a little tutorial how to make this yourself?

pboos already provided the latest JAR file 13 days ago.

2 Likes

Thanks!

@Ondrej_Pecta @pboos and others interested in Xiaomi Smart Home API,

LouisZL updated his repository with some valuable findings - turns out thereā€™s voltage value returned in sensors - if itā€™s below 2800mv, the battery is low :slight_smile: Check out this commit.

Thereā€™s also more goodness updated on LouisZL repo. Most importanly (for me :)) the doorbell support!
Check this out.

@illxi are you still interested in translating the documentation on your branch? Please let me know if you need any help. I donā€™t speak Chinese but can help with organizing the docs.

I really hope weā€™ll have opneHAB binding supporting the exciting stuff we have here! :smile: