Mi(Xiaomi) Smart home bindings?

The new Xiaomi Gateway (v3) is released:

This gateway supports zigbee, bluetooth and wi-fi devices. It also receives power via USB, so no Chinese sockets.

1 Like

Looks promising if it is backward compatible with their sensors as well as other Zigbee equipment… And ofcouse, we need the binding as well :smiley:

I’ve made a pre-order on that. Supposedly shipping end of January.

Look forward to hear how it goes.

Hi @dimalo,

I have "Aqara” gateway, it doesn’t support “Lumi” gateway protocol, it just natively support homekit,
as I am not able to add / discover by paperUI also develop mode, I didn’t use it at all.
please let me know if you want to do any test.

Can anyone who have xiaomi gateway or any xiaomi product share your fw version and binding version,
especially mention any malfunction after fw upgrade, I am trying to summarize fully functional fw with OH binding and mark warn if there is any compatible issue with specific fw version.

Hi @dimalo,

Can you add support of Lumi Gateway radio feature?
I have test with below command and it works with miio and miiocli, so this should be easy to add to current mihome

miiocli wifispeaker --ip 192.168.0.2 --token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx raw_command "get_prop_fm"
miiocli wifispeaker --ip 192.168.0.2 --token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx raw_command "play_specify_fm" "{'type': 0, 'id': 0, 'url': 'http://192.168.0.1:8080/static/testplayer/hls/527782023/pl.m3u8'}"
miiocli wifispeaker --ip 192.168.0.2 --token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx raw_command "play_fm" "['on']"
miiocli wifispeaker --ip 192.168.0.2 --token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx raw_command "play_fm" "['off']"
miiocli wifispeaker --ip 192.168.0.2 --token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx raw_command "play_fm" "['next']"
miiocli wifispeaker --ip 192.168.0.2 --token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx raw_command "set_fm_volume" "[100]"

DEBUG=* miio protocol call 192.168.101.243 get_prop_fm
DEBUG=* miio protocol call 192.168.101.243 play_fm '["off"]'
DEBUG=* miio protocol call 192.168.101.243 play_fm '["on"]'
DEBUG=* miio protocol call 192.168.101.243 play_fm '["next"]'
DEBUG=* miio protocol call 192.168.101.243 set_fm_volume '[100]'
DEBUG=* miio protocol call 192.168.101.243 play_specify_fm '{"type": 0, "id": 0, "url": "http://192.168.0.1:8080/static/testplayer/hls/527782023/pl.m3u8"}'

regarding radio source, you may check below web link for reference.
https://www.mylifesucks.de/oss/xiaomiwifiradio/

Some Aqara gateways do, have a look here for details on retrieving the key.

I have a question regarding the textual config of the things:

I always configured them like this

Bridge mihome:bridge:gateway "Xiaomi Gateway" [ serialNumber="xxxxxx", ipAddress="192.168.0.xx", port=9898, key="xxxxx", pollingInterval=6000 ] {
    Thing mihome:gateway:gateway             "Xiaomi Mi Smart Home Gateway "    [itemId="xxxx"]
    Thing mihome:sensor_ht:temp_hum_kelder   "Xiaomi Temperature Sensor kelder" [itemId="xxxx"]
.....
}

Yesterday, I updated to 2.5.0 and saw in the Xiaomi binding docs a different way (same way as I use for NHC):

Bridge mihome:bridge:gateway "Xiaomi Gateway" [ serialNumber="xxxxxx", ipAddress="192.168.0.xx", port=9898, key="xxxxx", pollingInterval=6000 ] {
    Things:
          gateway      gateway            "Xiaomi Mi Smart Home Gateway"        [itemId="xxxx"]
          sensor_ht    temp_hum_kelder    "Xiaomi Temperature Sensor kelder"    [itemId="xxxx"]
....
}

But when using this last method, my items aren’t linked to the things… so none of my devices are working. Already restarted openHAB and my Pi. no errors in the logs.

I reverted back to my first method and everything is working fine again.

When I use this first method I also get this warning message

2019-12-20 20:53:04.485 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'xiaomi.things', using it anyway:
Provide a thing type ID and a thing ID in this format:
 <thingTypeId> <thingId>
....

Looks to me that you haven’t exactly defined the things as described in the ‘new’ (2.4+ I think) docs. What about

...
Things:
          gateway    xxxx     "Xiaomi Mi Smart Home Gateway"        [itemId="xxxx"]
          sensor_ht xxxx      "Xiaomi Temperature Sensor kelder"    [itemId="xxxx"]
...

So you show your items.

Bridge mihome:bridge:xxxx "bridge" @ "xiaomi" [ serialNumber="aaaa", ipAddress="192.168.215.235", port=9898, key="zzzz", pollingInterval=6000 ] {
  Things:
    gateway xxxx "gate" @ "xiaomi" [itemId="xxxx"]
    sensor_switch yyyy "switch" @ "xiaomi" [itemId="yyyy"]
}

Number  Switch_Battery                  <battery>                   { channel="mihome:sensor_switch:xxxx:yyyy:batteryLevel" } 
Switch  Switch_BatteryLow               <energy>                    { channel="mihome:sensor_switch:xxxx:yyyy:lowBattery" }

Thanks @Hans_Lree & @Olymp !
Didn’t noticed the items also changed…

A follow up. Received the gateway yesterday. It does not have a developer mode. Less options and settings compared to the gen2 gateway.
Will most likely use it as a paperweight. :ghost:

It really sounds odd. There has been alot of discussion about this lately… I wonder if anyone has actually asked xiaomi whats going on? It can hardly be an security issue, as the token (developer mode) is actually the security itself…

Is it possible to add the new mi gateway? I’ve added to the mi app, but cant find any dev settings.

@dimalo Are you still working on this binding? I just found my new (extra) gateway (ZNDMWG03LM - https://banggood.app.link/9yeamJWC27) which I bought 6 months ago in the closet and I wanted to try it once more.
With an older version of the Xiaomi Home app, I managed to get the token, device id and model (lumi.gateway.mgl03).
I tried to add it like another gateway, but that doesn’t seem to work.

Could you help me what is wrong on my system?
1, Xiaomi door and temperature sensor are added, it works properly on the Paper UI, but i can’t display these on my sitemap.

2, what is wrong with the rule with xiaomi door sensor (the roller shutter work like a charm),

xiaomi.things

  sensor_magnet 158d0002xxxxxx "Xiaomi Kitchen Door Sensor" [itemId="158d0002xxxxxx"]
  sensor_ht 158d0003xxxxxx "Xiaomi Basement Temperature Sensor" [itemId="158d0003xxxxxx"]

items:

Number:Temperature BasementTemperature "Temperature" {channel="mihome:sensor_ht:04cf8cxxxxxx:158d0003xxxxxx:temperature"}

Number:Dimensionless BasementHumidity "Humidity" {channel="mihome:sensor_ht:04cf8cxxxxxx:158d0003xxxxxx:humidity"}

Contact KitchenDoorStatus "Open status" {channel="mihome:sensor_magnet:04cf8cxxxxxx:158d0002xxxxxx:isOpen"}

DateTime KitchenDoorLastOpened "Last time opened (date/time)" {channel="mihome:sensor_magnet:04cf8c9xxxxxx:158d0002xxxxxx:lastOpened"}

sitemap:

Frame label="Test"{
    Text item=KitchenDoorStatus  label= "Kitchen Door [%s]" icon="door"
    Text item=KitcheDoorLastOpened label= "Last time open [%s]" icon="time"
    Text item=BasementTemperature label="Basement Temperature [%.1f °C]" icon="temperature"

Screenshot 2020-08-21 at 09.31.51

2:

rule "Shutter_Door_Open"

when 

  Item KitchenDoor changed
  

then 
 if ((KitchenDoor.state == OPEN ))
  
{ sendCommand(RollerControlLiving, UP ) }


end 

thank you

Could you please paste your settings in a code fence style… And also be more specific about what exactly you´re showing… your items seems alittle bit ackward and the item name seems to be the actual measuring, (you have called the item name for temperatur “temperature”). Its not that its not going to work, but doing like this, you´ll end up with several fatal issues when you add the next temperature sensor…

But please… First,
Your items file (using code fences).
Your sitemap file (using code fences).
Your rules, (using code fences). (Its almost impossible to see your rules, because its a very small screenshot).

1 Like

sorry, edited

(is it ok like it?)