How do I add Xiaomi - Mi Control Hub?

Not sure if I understand the problem, but in my setup all my aqara sensors come up with entity ids that are diff than what I have setup in the app. For instance my Front Door shows up as binary_sensor.door_window_sensor_158d000208e248.

Seems like they still have a problem getting the list of sensors from this specific type of gateway (DGNWG05LM). There is an open discussion on github and if you install the dev version of HA the logs show a specific warning about this issue (https://github.com/rytilahti/python-miio/issues/728)

I hope they will manage to do something about it.

1 Like

Did you maybe have any success with connection to ha?

I have now changed to openwrt (https://github.com/openlumi/openlumi.github.io). I did this because the i bought an aqara swtich and I was unable to access the device. Since I was already using a diferent firmware it was able to do the change quickly. The openwrt, give’s more options, now I can acess to all zigbee devices, because the firmware uses the zigbee chip with a diferent firmware. So now I can acess to the aqara switch. I can use more function with cube and play webradio in the gateway and finally use tts on the gateway to say alarme messages. With openwrt you can use zigbee2mqtt and instead of one device, you have now each sensor has a device.

it’s O.K. to put openwrt on the gateway, but how it can be integrated under HA in order to use its speaker or maybe the light?

The light apears on mqtt, like the button, from there you can change the color, etc and do some automation from the state of the button. The speaker is integrated as a media player in homeassistant. By default the volume is to low, but you can change’t using ssh session and the command “alsamixer” to increase the volume to maximum, after that you can change the volume in HA. My configuration is:

media_player:
  - platform: mpd
    name: xiaomigw
    host: 192.168.X.XXX
1 Like

Thanks Alberto for the info, I managed to add the gateway as an MQTT broker in HA, but there is no entity appeared. How can I use the light and the zegbee subdevices in that way? sorry for a basic question. I’m new in the HA world…
update: I found the solution: this needs to be installed on the GW, then the GW and its entities appear under MQTT

Did you install the zigbee2mqtt? If you didn’t please do.
Then, one thing about MQTT broker:
My MQTT broker( MQTT - Home Assistant (home-assistant.io)) is in the homeassistant not on the gateway. And for the light, button and Luminance sensor of the gateway the appear automatically under a device called xiaomi_gateway_yyyyyyyy, where yyyyyyyy is the mac adress of the gateway. But, before, you need to configure the autodiscovery of MQTT. In zigbee2mqtt. To do that:
goto Settings, then MQTT Tab,
configure the broker address, username and password.
Then go to the Advanced Tab and configure the Homeassistant discovery topic.
Finally (I think) go to the Main Tab and check the Homeassistant Integration.
To add devices you simply go to the page o zigbee2mqtt and check that the button on the top righ of the page and see if say Disable Join (all) or Permit Join(all), if it says Permit, press to stay Disable, you should see a pop saying that Zigbee allowing no devices to Join. After that pair the device (if you don’t know how to do it, search in google with: device_name Zigbee2mqtt, that usualy helps. After that you should see the zigbee device and it should apear in the Homeassistant MQTT integration.
Last thing please pay attettion to the installation of MQTT in homeassistant, look how to put the mqtt discovery on!
Hope this help, and sorry for taking to mutch time to awnser.

Thank you very much Alberto for sharing your configuration. Something curious happens to me, I have done everything you say, in Zigbee2MQTT I can detect all the peripherals and they appear in Home Assistant, but the Gateway does not appear, and I cannot control the light, the luminance, or the speaker. However in ZESP32, I do get everything to appear, but I cannot control the color or light intensity of the Gateway. Would you know any option to make the Gateway appear in Zigbee2MQTT ?, I have reinstalled everything 5 times with all the configurations. Communication with Home Assistant works perfectly. Thanks a lot

Please check this link for the gateway button, light and luminance: GitHub - openlumi/lumimqtt: Service to control Xiaomi Gateway with MQTT
For the speaker you must configure a media player, but first open an ssh session, and run command alsamixer to put volume on an level that you can listen:

media_player:
  - platform: mpd
    name: xiaomigw
    host: IP_ADRESS_OF_GATEWAY

you can change “xiaomigw” for the name of your preference in the previous code.

Sorry, I did that some time ago and forget. But that was an help to remind!! :slight_smile:

Thank you very much for your answer. In the end I did not succeed, after several attempts, it appeared once, but it stopped working. I have returned to ZESP, and although I do not like the environment so much, everything works perfectly and I can also add BLE modules

Hi all, looking for a bit help.
I have Xiaomi DGNWG05LM with OpenWRT installed today.
Cannot add it to MQTT integration with HA (rasp pi+ Home Assistant Operating System)

I’ve tried:

  1. zigbee2mqtt addon - dot not work at all, frontend is not working 502, logs mentions that something cannot start, their git has record with the similar issue, not fixed.

  2. installed and run lumimqtt in the hub, the package is installed and probably run (have no idea how to check that)

HA > Integration > MQTT = Failed to connect
I am typing 192.168… - hub IP
port default 1883
login/password - using root, the same I used for the hub.

Any ideas? Thanks in advance.

you have too many problems trying to solve at once :slight_smile:
1- Did you setup mosquitto broker, there is an add on if you are using supervised or hassos installation, if not, you need to run it manually.
2- zigbee2mqtt add on: are you talking about running zigbee2mqtt on openwrt or installing this add on in home assistant?
3- lumimqtt is a local program to run inside hub to send/receive information about hub itself. like controlling the lights on hub.

Thank you for your answer :slight_smile:

  1. I do not have mosquitto addon, will install it
  2. tried this GitHub - zigbee2mqtt/hassio-zigbee2mqtt: Zigbee2mqtt Home Assistant add-on but was unable to run it. There are errors in the logs that plugin unable to start in a timely manner.
  3. installed this GitHub - openlumi/lumimqtt: Service to control Xiaomi Gateway with MQTT inside mi hub OpenWRT.

Ok, what do you want to have here? With openwrt installed hub, you can;

  • Install zigbee2mqtt locally on hub and let it communicate with your mosquitto broker
  • 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.
1 Like

Well… from my mi hub I need only LED lights and playing sound, that is all.
Will check both points, now it is more or less clear what to do :slight_smile:

Ok cool then, do not worry about zigbee2mqtt, focus on mosquito and running lumi program locally, zigbee is not required for your case.

Yep, thank you. I have dedicated Zigbee USB device connected to raspberry, do not need a second one… I guess :slight_smile:

Well… almost here.

Summary:

  1. installed inside hub zigbee2mqtt Now I am able to connect http://192.168.1.XXX:8090 and see zigbee2mqtt interface, niiiiiccccceeeeeee :slight_smile:

  2. installed mosquitto broker in HA

  3. did nothing more and HA found an integration, added this integration.

  4. Then, to get an access to the LED and speaker inside my Mi hub I have installed this
    lumimqtt

  • checked, that it is installed (from yesterday)
  • checked that I have /etc/init.d/lumimqtt with auto start content
  • found that I do not have /etc/lumimqtt.json
  • created /etc/lumimqtt.json with defaults content from git page
{
    "mqtt_host": "localhost",
    "mqtt_port": 1883,
    "mqtt_user": "",
    "mqtt_password": "",
    "topic_root": "lumi/{device_id}",
    "auto_discovery": true,
    "sensor_retain": false,
    "sensor_threshold": 50,
    "sensor_debounce_period": 60,
    "light_transition_period": 1.0
}