Xiaomi Gateway Integration

I have the same with a two channel wall switch, only works 1 of them…

Hi guys,
First of all, you have done a great job with Xiaomi Gateway.
Only recently I have got Xiaomi Smart Home set and started playing with it.
It is a great thing that most of sensors and options already working with HAAS.

One important feature is still missing, it is an ability to Arm or DisArm Alarm using HAAS.
I have done some research and found at page (https://www.gitbook.com/book/forrestfung/lumi-gateway-local-api/details) that there is API version 1.0.9 (https://cnbj2.fds.api.xiaomi.com/lumiaiot/common/gateway/绿米网关局域网通信协议V1.0.9_2017.08.01.doc).

It has the ability to simulate virtual click event over multicast with a command:
{“cmd”:“write”,“model”:“switch”,“sid”:“112316”,“short_id”:4343,“data”:"{“status”:“click”}" }

Perhaps we can make event function that would trigger this event on call, so HAAS could be configured to send Arm/DisArm (double click event).

2 Likes

There are also some nice features that could be useful for HAAS like API call for sub-device connection:
{“cmd”:“write”,“model”:“gateway”,“sid”:“6409802da2af”,“short_id”:0,“data”:"{“join_permission”:“yes”}" }

It’s possible to arm/disarm the gateway by the mi home app? I don’t think so.

Hey guys,

you have done an amazing job.
Since there are only components manageable, which are directly connected to the gateway, I cannot control my Xiaomi Wifi Remote Control Outlet Power Strip.
But my cube flip90 event turns the power strip on (Definition in the Xiaomi Home App).
And I can handle the event in HA.

Is the other way also possible?
I’d like to fire the same flip90 event from home assistant, so I can control the power strip indirectly through HA?

If so, could you please help me with some basic example?

Thanks.
Regards.

The power strip is supported by another component. Take a look here: Xiaomi mi wifi plug & air purifier - #122 by syssi

Next step will be a home assistant automation to connect both devices.

It’s possible, it also shows the status of arm/disarm.

Cool. May be the feature will be exposed for the local network protocol soon. I assume the “virtual click event” cannot be used.

my single wireless wall switch has stopped working and I have the latest firmware, grrr

Also what is the range of the hub and sensors please? I have a several motion/temp sensors down stairs, all perfect. but on my landing, the motion sensor/lux are sketchy and the temp on next to it, keeps going to offline. It is wise to have 1 gateway up and 1 downstairs?

Cheers
Mark

that’s how I do

thanks Claudio. Is it possible to roll back firmware? The wall switch produces a log of a click, but not in ha since the firmware upgrade :frowning:

I don’t know how to

Can you tell me the type of the device? It’s the wireless wall switch without a relay, right?

it is the Xiaomi Aqara Smart Light Switch Wireless Version, that runs from battery. It was working perfectly with a toggle automation, thanks to you :slight_smile:

May be the format of the event has changed. I will check it and report.

How guys can you see the json messages between the gateway and HA ? Only using Wireshark ? Or is there any other way ?

Just enable the debug log. Because of the official component it looks like this now:

logger:
  default: warn
  logs:
    homeassistant.components.xiaomi: debug
    homeassistant.components.binary_sensor.xiaomi: debug
    homeassistant.components.sensor.xiaomi: debug
    homeassistant.components.light.xiaomi: debug
    homeassistant.components.switch.xiaomi: debug

What is an “alert” for the Xiaomi cube? Throw it into the wall? Sink it in water? :_)

Something like an earth quake. :wink:

Isn’t that tap_twice event?