Xiaomi Gateway Integration

Thanks everyone, seams to work now.

With the new correct MAC and upper-case on the key it all works

1 Like

I don’t actually have a MAC address entered, can you try with no mac set

  • mac:

A mac is just needed if you own multiple gateways: https://home-assistant.io/components/xiaomi/

i think there is a motion sensor because in mi home app you can set to turn the light on in the dark when you pass near… i’ve tryed and it works… so there is a motion sensor…:slight_smile:

In mi Home app the automations is only when it is dark and not when someone passes by. The gateway has only the light and light sensor

This is the only teardown I could find: https://www.youtube.com/watch?v=nTo3qi_hsuw

There is no motion sensor on the PCB of this generation of the gateway.

Any news regarding using virtual switches to toggle the alarm mode?

sorry it was my fault… i used it in combination with motion sensor and i forgot it… sorry :wink:

are you sure?

Can someone explain how to trigger “click_type: long_click_release” from the Gen1 Switch Button?

“long_click_press” works as expected, when you press and hold the button… I was expecting “long_click_release” to trigger when you press, hold and then RELEASE, but it does not.

Also, all I’m seeing in the MiHome App is “Long Press”, no sign of any kind of “release”.

Can someone help with this one? Maybe I’m missing something.


I really think this thread needs to be locked now that the gateway is not in Beta and its over 3k posts… Questions about specific issues etc. should be in their own, new threads. Not picking on you at all @badgerhome but the gen 1 switch button is not the gateway and should have its own thread. People have mentioned locking this thread a few times already. It has some great info but is getting out of hand now i think. Mods?


Thank you will have 300+ posts on how to connect the gateway or get the api key :slight_smile: Maybe leave it as it is?

@badgerhome - why not switch a debug mode in logging and find out all the modes the button sends to HA?

It seems that wireless switch is somewhat broken now. Here’s what I have:

  • All debug loggers enabled

  • Gateway fw version 1.4.1_149.0143 (which appears to be latest, according to the iOS app)

  • homeassistant==0.53.1

  • A single automation which contains the following:

    - id: room_switch
    alias: ‘Room switch’
    platform: event
    event_type: click
    entity_id: binary_sensor.wall_switch_158d000183d139
    click_type: single
    service: light.toggle
    entity_id: light.gateway_light_34ce00fa5af0

When I click that wall switch, nothing happens, the automation doesn’t trigger. When I trigger this automation inside the UI it switches alright. When I click that wall switch, there’s nothing in the log. AFAIK there should be a PUSH event there, but there’s nothing. If I click that button five times in a row I get a MCAST event which looks like this:

DEBUG:PyXiaomiGateway:MCAST (heartbeat) << {'model': '86sw1', 'data': '{"voltage":2985}', 'cmd': 'heartbeat', 'short_id': 14290, 'sid': '158d000183d139'}
DEBUG:homeassistant.components.xiaomi:PUSH >> <Entity Wall Switch_158d000183d139: off>: {'voltage': 2985}

Any ideas on what I did wrong?

ps: The automation is perfectly well indented in my configuration file (it loads okay and so on), I just couldn’t make it indented here for some reason. o_O

It’s a bug of firmware version 149: https://github.com/home-assistant/home-assistant/issues/8935

@syssi thanks, I’ll wait for the updated fw.

Hi all,

I need your help. I have been desperately trying to integrate Xiaomi GW in homeassistant (both latest versions).

I cannot see the GW and I cannot debug because my homeassistant.log does not write events. It is a very small file that was last updated many days ago.

Is there smh I can do to enable logging?

Thank you very much in advance.

Could you create a new topic please?

If this is not the proper place for my post then I can create a new topic.

Sorry for the inconvenience.

Please point out the correct thread.

You could take this one Xiaomi gateway not discovered or just create a new one. It will help other users to find a solution without reading the 3000 messages of this thread. :wink:

Hi all,

I’ve noticed a strange behaviour on motions sensors. Sometimes I see that one of my sensor detects a movement even if there’s no one at home.

I remember that some one noticed the same issue and I’ve searched inside this discussion to find it without result.

Can someone please knows if this issue have been solved?

Thank you