How do I add Xiaomi - Mi Control Hub?

Let me repeat, if you just want to control lights and sound in your hub, you do not need any zigbee2mqtt, you said you have already a controller in your pi setup.

Your light should be connected to your mqtt broker.

1 Like

First I thought that lumimqtt should be connected to zigbee2mqtt which should be connected to mosquitto :slight_smile:

To setup the connection I have created a user in mosquitto, then used ip:1883 port and this user in lumimqtt.json and all is working now :slight_smile:

Thanks a lot

1 Like

Resolved all issues:
Required OpenWrt and this GitHub - Beetle-II/lumi: MQTT агент для шлюза Xiaomi DGNWG05LM
nothing more

Just followed this video https://youtu.be/ur4laA1UsbI step by step.

If you need a translation, ping me :slight_smile:

Hi. I’m going to start hack my EU Xiaomi conrtol HUB. But i’m not sure which version would be better.
Can u please tell me, that what is possible with the cadavre/miio_gateway. (Beacuse if these are enogh for me, than i don’t want to change the official fw th openwrt.)

And what are the + possibilities with the Openwrt ? What are the disadvantage of Penwrt?
Does it worth to change? Thanks

Hi,

The big advantage of openwrt is that uses zigbee2mqtt, so you can use your gateway as a general zigbee interface instead of a dedicated xiaomi device’s interface. This means that you can use more zigbee devices with your xiaomi gateway. For example I have a philips hue smart socket controled by the xiaomi gateway. With the cadavre gateway fw you can’t control all the xiaomi devices. The big disavantage iof openwrt+zigbee2mqtt takes, is that it’s not so easy to flash and configure, it takes more time.

Resuming if you only want to work with simple xiaomi zigbee sensors, the cadavre/miio gateway it’s enouth. If you are planning to use zigbee devices of other brand, and more compel xioami devices it’s better to go on openwrt. In my honest opion go on openwrt, it takes some time to do it, but in the end you will be better served(I even use the gateway speaker to listen webradio :wink:. )

Hope that this information help’s you.

Thanks for your opinions. I already flashed it. So now i have Openwrt 21.02 on my gateway.
My home assistant is on my rasperry pi 4 (mqtt broker is running here).
I write what I did, if somebody will need it later:

  1. installed : Zigbee2mqtt ( if i understand this thread right, than i will use this for other zigbee subdevices >so to connect philips/xiaomi/sonoff other decices to the gateway )
    Here in zigbee2mqtt (of the Gateway) In Settings/MQTT Tab >I configured the broker address, username and password.
    But dont know what to set in Advanced Tab > Homeassistant discovery topic. I leave it default.
    After it i can add new devices.

  2. lumimqtt like this : lumimqtt > create the lumimqtt.json > to mqtt_host I write my Rasp Pi (homeassistant) IP address / add my homeassistant mqtt broker acc/passw.
    I can now see the device in Homeassistant with button/illuminance/light entities.

  3. installed for mpd this: MPD but i got an error durring install/config. > anyway it’s wotking.

I have 2 questions:
A: How can i use lumimqtt custom commands?:
for example ont he site there are some example:

 "blink": "for i in 0 255 0 255 0 255 0; do echo $i > /sys/class/leds/{color}/brightness; sleep 1; done",
"reboot": "/sbin/reboot"

Reboot works, but BLINK/TTS not.
What I have to config in these commands? (I don’t understand what is int he USAGE example)

B: I also read somwhere that the EU version chip has Bluetooth to. So i would love to get it work and also integrate it in the Home assistant. Does anybody tried it already?

Thanks

You can access Bluetooth Low Energy devices and read data from them and publish data to home assistant over mqtt. In my device, running Bluetooth scanner and wifi always at be the same time causes freezes and i restart regularly with a cron job configured through openwrt ui.

https://tech-en.netlify.app/articles/en549058/index.html

And this is how i can use TTS

service: mqtt.publish
data:
  topic: lumi/say/set
  payload: |-
    {
      "text": "{{ states('input_text.tts_input') }}", 
      "volume": 75, 
      "lang": "en"
    }

Hey there. Can you please help with this one. I’ve been struggling with tts or playing any sound on my OpenWRT DGNWG05LM for that matter.

I’m not sure if I havent set up mpd correctly or do I even need mpd since lumimqtt says there is no need for it and also I’m unable to even play local (as on gateway) mp3 files.

I am having real trouble to get my mqtt messages from my OpenWRT hacked Xiaom Gateway to homeassistant that I am running on a raspberry pi 4… any chance you could help me? I have the zigbee2mqtt upp and running on the OpenWRT gateway and I have fond my devices there and if I check the log I can see mqtt messages… but how can I get these messages to home assistant that is running on Raspberry pi? (all I have seen after a lot of youtube and google is just guys running home assistant on the gateway itself but that is not what I want… I just want to use the Gateway to relay messages from my Zigbee devices to homeassistant) I see that you suggest to " * change zigbee mod on your router from serial to tcp and install zigbee2mqtt in your home assistant and it should work out of box. You should configure zigbee2mqtt path as your router tcp port." where should I do this? fyi, if I (inside of Zigbee2mqtt on OpenWRT) go to Setting → MQTT and try to change the server url, password and user name I just get an error message when I try to save… this is the message I get…

Request ‘zigbee2mqtt/bridge/request/options’ failed with error: ‘Cannot read property ‘length’ of null’

Two options ahead;

  • run zigbee2mqtt inside gateway using serial mode and set mqtt endpoint of your home assistant mqtt instance address. So, zigbee2mqtt will communicate with mqtt application with zigbee messages.
  • change zigbee chip mode from serial to tcp, install zigbee2mqtt in home assistant supervisor/OS, set device address inside zigbee2mqtt using tcp address and let zigbee2mqtt communicate with internal mqtt broker
  • change zigbee chip mode from serial to tcp, install ZHA integration in home assistant using tcp based device address and that is it.

Third option is easy to implement and manage, first option separates different layers of software (personal choice)

Hi I have installed the version mentioned.
Afterwards what shall I do?
I have enabled “Experimental features → Enable app’s debug mode”. Is this necessary?

Model: lumi.gateway.v3
MAC: starts with 04:CF:8C

Also the plugins found above, how can be used and why?

EDIT: I figured it out. I added it as Lumi Miio, not aqara and using the manual mode.

hi,

did you rise the volume to maximum in alsamixer?

Hey, thanks for stopping by. I have managed to make it work and it worked OK. It did sometimes unreachable as a zigbee HUB (I did the through Open Lumi Router). I used it for some time as a doorbell, but now it is deprecated as I’ve got google home mini instead.

Hello,
I’m glad that you solve it. I still use mine has an zigbee coordinator, and sound column. I replace Lumi by openWRT.

How do I change from serial to tpc? thank you

Hey try this driver, it will be ready over tcp but this device is very weak in terms of signal power so in long run, it might create more issues than a reliable solution

Hi. I could not figure out where he create a database file in the video. Could you help me?

Hello, how did you do it then? I have an Rpi3 with hassio and Mosquito Broker and an openlumi with zigbee2mqtt and the trained zigbee devices. But I can’t make the devices visible in home assistant. How does it work? thanks

Hello guys, recently I’ve jumped on HA wagon and still I’m learning. Mainly my equipment is zigbee stuff, among these I have the xiaomi Hub, Eu version.

Few days ago decided to the to thry the rooting of the Hub for installing Openwrt and using is as zigbee coordinator transmitting messages to MQTT broker which is running in a thin client. Already I have two rasperry pi zero (with cc2531) in a similar role, so I was thinking that xiaomi hub in a such role will be a good idea as it has stronger signal and is more nifty.

Initially I was following this How-to for gaining root access. For the process I’m using an usb uart that was available in my drawer with PL2303HX and I’m mentioning it as I have seen some buffer overrun in the process.

I was following that guide, I’ve changed the passwd and created the ssh (?) key but after that I was receiving messages buffer overrun and rebooted. Since then I have root access in serial console, Im repeating the steps but I’m not getting expected results.

Then found the post of @avsantos76 which I was trying to follow but no success as otput of my console is not matching. Another thing that I’ve noticed is the lack of any file in /etc/dropbear as mentioned in step 26.

Another issue is that my Hub was factory reset before this experiment hence there is no ip in it. If tryiing to use the Mi home app in my android mobile the I can see the hub in another ip range and the process is failing at the end.

Any idea how to recover ? Preferably I want to have it with openwrt at the end than back to xiaomi stuff.
Thanks!

Edit1. Just realized that I cant edit with vi, I can open but no edit and it seems freezing.