Mi(Xiaomi) Smart home bindings?


(Ward) #811

I also ordered 2 of them :slight_smile:

The latest Aqara Cube & Switch (with Gyrometer) is also not yet integrated in openHAB.
I’ve them both, so if I can help…

Cube
https://ww.aliexpress.com/item/Xiaomi-Mi-Cube-Controller-Zigbee-Version-Gateway-Controlled-by-Six-Actions-with-Phone-App-for-Smart/32751779590.html

Switch
https://www.aliexpress.com/item/Xiaomi-Aqara-Smart-Wireless-Switch-Mini-With-Gyro-House-Remote-Controller-for-Mi-Home-APP-MIJIA/32861228768.html


(Dimalo) #812

hi everyone!
I have made a PR to fix your issue @Olymp. It was also reported on github…
I have also enabled the new Aqara Cube and tested it already @wars
It’s only working with the newest firmware though (something with 159)…

As soon as anybody can provide logs for new devices please open an issue in the github repo.

In the future I want to get rid of the gateway and use pure zigbee with zigbee2mqtt.
This means I will support this binding not that much anymore.
I hope there is anybody wanting to step in, so that the binding stays alive.

@kubawolanin: seems like aqara is pushing an updated doc here now, already in english so no need to translate. don’t know if the chinese version has more content…
seems like they are preparing for a new protocol version which would need a major change in the binding…


(Svilen) #813

Hi Team here! Really great job! I already bought lot of Xiaomi smart stuff and also successfully bind it into OH - temperature, humidity sensors, Air Index sensor, el. plug, IR remote, door sensors, Roborock … but this time I tried door core lock which is not integrated in OH Mi Smart binding. This lock can give information which from registered keys is used to unlock, reminds for not pulled out key after unlocking and most important - can give alert when there is illegal try for unlocking. Integration in OH can give chance to disarm alarm system with unlocking the door with registered key and so on. It works through Gateway. I’ve been able to extract token from iOS sqlite database from MI Home App. I can support (with a little help) if someone capable of integration of it wills to do it (can try to capture its communication to the gateway with Wireshark etc). Please excuse me if this is not the right way for requesting it - still not very aware hot he community works here.

Here are few pictures of this Wima Door Smart Lock.

Thanks everybody for their time and efforts making this binding better and better!


(Ulugbek Akhmedov) #814

Hi,

I bought this lock https://www.gearbest.com/access-control/pp_1142172.html?wid=1433363

Xiaomi Smarthome binding support this lock?


(Thefathefa) #815

@dimalo, thanks for all what you do on this. I have just received 3 Vibration Sensors and I’m willing to help getting logs but I don’t know how. Is there a place with a bit of explanation of what I can do to provide the info needed?


(MM) #816

Got 6 of the Vibration Sensors today. Would be great If your can add Support to this really good working Binding.
Thx


(Ward) #817

Thanks for implementing this! Still figuring out how I can do all gestures :slight_smile:
these are all available, correct?
MOVE
ROTATE_RIGHT
ROTATE_LEFT
FLIP90
FLIP180
TAP_TWICE
SHAKE_AIR
FREE_FALL
ALERT


(Marcel) #818

Yes, this gestures are available … but i don‘t understand the alert. What‘s to do to receive an alert?


(JustAProgrammer) #819

Guess you need a alert/event to trigger rules.
How should your .rules file know when it’s triggered :slight_smile:


(Dimalo) #820

My Cube is triggering the Alert action when it senses slight vibrations. for example if it lies on the table and somebody gets to the table and bumps on it.


(Dimalo) #821

Hi @thefathefa, I also received some and added the sensor already, see here. I added a small tutorial in the readme explaining how to get the informations from new devices.


(Marcel) #822

for the trigger i don’t use the alert event.

rule "OgSr Xiaomi Cube"
when
    Channel 'mihome:sensor_cube:158d00xxxxxxxx:action' triggered
then
    var actionName = receivedEvent.getEvent()
    switch(actionName) {
        case "MOVE": 
        {
             ...
        }
        case "ROTATE_RIGHT": 
        {
             ...
        }
        ...
   }
end

(Ole Morten Rønning) #823

Have they added info about what face is up and what face was previously up when pushed or double tapped?
That was (the main) part of the reason I stopped using the Mi Gateway for my cubes. The gateway had no events for that.


(Ward) #824

You did a very good job to update the binding + readme. Now everybody can easily help you with new devices.

I’ll check the new jar this evening.

I also notived that the power socket sends 3 events when turning it on or off. It always results in the correct one, but I assume that this is not normal?

2018-09-10 15:49:17.966 [ome.event.ItemCommandEvent] - Item 'Xiaomi_Socket_Power' received command ON
2018-09-10 15:49:17.984 [vent.ItemStateChangedEvent] - Xiaomi_Socket_Power changed from OFF to ON
2018-09-10 15:49:18.030 [vent.ItemStateChangedEvent] - Xiaomi_Socket_Power changed from ON to OFF
2018-09-10 15:49:18.066 [vent.ItemStateChangedEvent] - Xiaomi_Socket_Power changed from OFF to ON
2018-09-10 15:49:58.976 [ome.event.ItemCommandEvent] - Item 'Xiaomi_Socket_Power' received command OFF
2018-09-10 15:49:59.002 [vent.ItemStateChangedEvent] - Xiaomi_Socket_Power changed from ON to OFF
2018-09-10 15:49:59.014 [vent.ItemStateChangedEvent] - Xiaomi_Socket_Power changed from OFF to ON
2018-09-10 15:49:59.020 [vent.ItemStateChangedEvent] - Xiaomi_Socket_InUse changed from OFF to ON
2018-09-10 15:49:59.030 [vent.ItemStateChangedEvent] - Xiaomi_Socket_LoadPower changed from 0.00 to 13.32
2018-09-10 15:49:59.100 [vent.ItemStateChangedEvent] - Xiaomi_Socket_Power changed from ON to OFF
2018-09-10 15:49:59.111 [vent.ItemStateChangedEvent] - Xiaomi_Socket_InUse changed from ON to OFF
2018-09-10 15:49:59.115 [vent.ItemStateChangedEvent] - Xiaomi_Socket_LoadPower changed from 13.32 to 0

As you can see, the inUse & LoadPower item is only updated after I switch off the socket. I generated this logs a few times, with more or less time between switching on/off, but the output is always the same.


(Thefathefa) #825

@dimalo, great ! I installed it and I have the vibration sensors up. Super fast, thanks a lot.
I also saw you guys are considering the lock as well for support, I’ll give it a try for sure.


(Dimalo) #826

hey @wars
please open an issue and post some trace logs :ok_hand:


(Ward) #827

Is this enough?

Power off

==> /var/log/openhab2/openhab.log <==
2018-09-15 00:06:42.095 [DEBUG] [home.handler.XiaomiDeviceBaseHandler] - Device 158d0001xxxxxx on channel mihome:sensor_plug:socket_plug:power received command OFF

==> /var/log/openhab2/events.log <==
2018-09-15 00:06:42.091 [ome.event.ItemCommandEvent] - Item 'Xiaomi_Socket_Power' received command OFF
2018-09-15 00:06:42.121 [vent.ItemStateChangedEvent] - Xiaomi_Socket_Power changed from ON to OFF

==> /var/log/openhab2/openhab.log <==
2018-09-15 00:06:42.124 [DEBUG] [g.mihome.handler.XiaomiBridgeHandler] - Send to bridge mihome:bridge:gateway: {"cmd": "write", "sid": "158d0001xxxxxx", "data": "{\"status\": \"off\", \"key\": \"5339AFB96DCE180DFDECD7B1985C98D5"}"}
2018-09-15 00:06:42.130 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Sending message: {"cmd": "write", "sid": "158d0001xxxxxx", "data": "{\"status\": \"off\", \"key\": \"5339AFB96DCE180DFDECD7B1985C98D5"}"} to /192.168.0.80:9898
2018-09-15 00:06:42.535 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - Received Datagram from 192.168.0.80:9898 on Port 9898
2018-09-15 00:06:42.538 [TRACE] [g.mihome.handler.XiaomiBridgeHandler] - Received message {"cmd":"write_ack","model":"plug","sid":"158d0001xxxxxx","short_id":52627,"data":"{\"voltage\":3600,\"status\":\"on\",\"inuse\":\"1\",\"power_consumed\":\"6059\",\"load_power\":\"11.92\"}"}
2018-09-15 00:06:42.541 [TRACE] [g.mihome.handler.XiaomiBridgeHandler] - Updated "last time seen" for device 158d0001xxxxxx
2018-09-15 00:06:42.545 [DEBUG] [g.mihome.handler.XiaomiBridgeHandler] - Device 158d0001xxxxxx honored write request
2018-09-15 00:06:42.550 [DEBUG] [home.handler.XiaomiDeviceBaseHandler] - Item got update: {"cmd":"write_ack","model":"plug","sid":"158d0001xxxxxx","short_id":52627,"data":"{\"voltage\":3600,\"status\":\"on\",\"inuse\":\"1\",\"power_consumed\":\"6059\",\"load_power\":\"11.92\"}"}

==> /var/log/openhab2/events.log <==
2018-09-15 00:06:42.565 [vent.ItemStateChangedEvent] - Xiaomi_Socket_Power changed from OFF to ON

==> /var/log/openhab2/openhab.log <==
2018-09-15 00:06:42.584 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Data received and notified 1 listeners
2018-09-15 00:06:42.587 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Thread Thread[Thread-93,5,main] waiting for data on port 9898
2018-09-15 00:06:42.616 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - Received Datagram from 192.168.0.80:4321 on Port 9898
2018-09-15 00:06:42.618 [TRACE] [g.mihome.handler.XiaomiBridgeHandler] - Received message {"cmd":"report","model":"plug","sid":"158d0001xxxxxx","short_id":52627,"data":"{\"status\":\"off\"}"}
2018-09-15 00:06:42.620 [TRACE] [g.mihome.handler.XiaomiBridgeHandler] - Updated "last time seen" for device 158d0001xxxxxx
2018-09-15 00:06:42.623 [DEBUG] [home.handler.XiaomiDeviceBaseHandler] - Item got update: {"cmd":"report","model":"plug","sid":"158d0001xxxxxx","short_id":52627,"data":"{\"status\":\"off\"}"}
2018-09-15 00:06:42.635 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Data received and notified 1 listeners
2018-09-15 00:06:42.637 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Thread Thread[Thread-93,5,main] waiting for data on port 9898

==> /var/log/openhab2/events.log <==
2018-09-15 00:06:42.644 [vent.ItemStateChangedEvent] - Xiaomi_Socket_Power changed from ON to OFF
2018-09-15 00:06:42.655 [vent.ItemStateChangedEvent] - Xiaomi_Socket_InUse changed from ON to OFF
2018-09-15 00:06:42.657 [vent.ItemStateChangedEvent] - Xiaomi_Socket_LoadPower changed from 11.92 to 0

==> /var/log/openhab2/openhab.log <==

2018-09-15 00:06:47.969 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - Received Datagram from 192.168.0.80:4321 on Port 9898
2018-09-15 00:06:47.973 [TRACE] [g.mihome.handler.XiaomiBridgeHandler] - Received message {"cmd":"heartbeat","model":"gateway","sid":"34ce008bfe89","short_id":"0","token":"5UeSl7xoRcfrcQcq","data":"{\"ip\":\"192.168.0.80\"}"}
2018-09-15 00:06:47.976 [TRACE] [g.mihome.handler.XiaomiBridgeHandler] - Updated "last time seen" for device 34ce008bfe89
2018-09-15 00:06:47.980 [DEBUG] [home.handler.XiaomiDeviceBaseHandler] - Item got update: {"cmd":"heartbeat","model":"gateway","sid":"34ce008bfe89","short_id":"0","token":"5UeSl7xoRcfrcQcq","data":"{\"ip\":\"192.168.0.80\"}"}
2018-09-15 00:06:47.983 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Data received and notified 1 listeners
2018-09-15 00:06:47.986 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Thread Thread[Thread-93,5,main] waiting for data on port 9898

Power on

==> /var/log/openhab2/events.log <==
2018-09-15 00:06:49.064 [ome.event.ItemCommandEvent] - Item 'Xiaomi_Socket_Power' received command ON
2018-09-15 00:06:49.085 [vent.ItemStateChangedEvent] - Xiaomi_Socket_Power changed from OFF to ON

==> /var/log/openhab2/openhab.log <==
2018-09-15 00:06:49.082 [DEBUG] [home.handler.XiaomiDeviceBaseHandler] - Device 158d0001xxxxxx on channel mihome:sensor_plug:socket_plug:power received command ON
2018-09-15 00:06:49.102 [DEBUG] [g.mihome.handler.XiaomiBridgeHandler] - Send to bridge mihome:bridge:gateway: {"cmd": "write", "sid": "158d0001xxxxxx", "data": "{\"status\": \"on\", \"key\": \"8FBDE7243A0E729A0B6863C8F1599B1B"}"}
2018-09-15 00:06:49.108 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Sending message: {"cmd": "write", "sid": "158d0001xxxxxx", "data": "{\"status\": \"on\", \"key\": \"8FBDE7243A0E729A0B6863C8F1599B1B"}"} to /192.168.0.80:9898
2018-09-15 00:06:49.514 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - Received Datagram from 192.168.0.80:9898 on Port 9898
2018-09-15 00:06:49.517 [TRACE] [g.mihome.handler.XiaomiBridgeHandler] - Received message {"cmd":"write_ack","model":"plug","sid":"158d0001xxxxxx","short_id":52627,"data":"{\"voltage\":3600,\"status\":\"off\",\"inuse\":\"0\",\"power_consumed\":\"6059\",\"load_power\":\"0.00\"}"}
2018-09-15 00:06:49.518 [TRACE] [g.mihome.handler.XiaomiBridgeHandler] - Updated "last time seen" for device 158d0001xxxxxx
2018-09-15 00:06:49.521 [DEBUG] [g.mihome.handler.XiaomiBridgeHandler] - Device 158d0001xxxxxx honored write request
2018-09-15 00:06:49.523 [DEBUG] [home.handler.XiaomiDeviceBaseHandler] - Item got update: {"cmd":"write_ack","model":"plug","sid":"158d0001xxxxxx","short_id":52627,"data":"{\"voltage\":3600,\"status\":\"off\",\"inuse\":\"0\",\"power_consumed\":\"6059\",\"load_power\":\"0.00\"}"}

==> /var/log/openhab2/events.log <==
2018-09-15 00:06:49.545 [vent.ItemStateChangedEvent] - Xiaomi_Socket_Power changed from ON to OFF

==> /var/log/openhab2/openhab.log <==
2018-09-15 00:06:49.551 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Data received and notified 1 listeners
2018-09-15 00:06:49.554 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Thread Thread[Thread-93,5,main] waiting for data on port 9898
2018-09-15 00:06:49.604 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - Received Datagram from 192.168.0.80:4321 on Port 9898
2018-09-15 00:06:49.607 [TRACE] [g.mihome.handler.XiaomiBridgeHandler] - Received message {"cmd":"report","model":"plug","sid":"158d0001xxxxxx","short_id":52627,"data":"{\"status\":\"on\"}"}
2018-09-15 00:06:49.610 [TRACE] [g.mihome.handler.XiaomiBridgeHandler] - Updated "last time seen" for device 158d0001xxxxxx
2018-09-15 00:06:49.613 [DEBUG] [home.handler.XiaomiDeviceBaseHandler] - Item got update: {"cmd":"report","model":"plug","sid":"158d0001xxxxxx","short_id":52627,"data":"{\"status\":\"on\"}"}
2018-09-15 00:06:49.620 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Data received and notified 1 listeners
2018-09-15 00:06:49.623 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Thread Thread[Thread-93,5,main] waiting for data on port 9898

==> /var/log/openhab2/events.log <==
2018-09-15 00:06:49.629 [vent.ItemStateChangedEvent] - Xiaomi_Socket_Power changed from OFF to ON

==> /var/log/openhab2/openhab.log <==

2018-09-15 00:06:57.943 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - Received Datagram from 192.168.0.80:4321 on Port 9898
2018-09-15 00:06:57.946 [TRACE] [g.mihome.handler.XiaomiBridgeHandler] - Received message {"cmd":"heartbeat","model":"gateway","sid":"34ce008bfe89","short_id":"0","token":"1KPVYIMYdofMJ44G","data":"{\"ip\":\"192.168.0.80\"}"}
2018-09-15 00:06:57.949 [TRACE] [g.mihome.handler.XiaomiBridgeHandler] - Updated "last time seen" for device 34ce008bfe89
2018-09-15 00:06:57.953 [DEBUG] [home.handler.XiaomiDeviceBaseHandler] - Item got update: {"cmd":"heartbeat","model":"gateway","sid":"34ce008bfe89","short_id":"0","token":"1KPVYIMYdofMJ44G","data":"{\"ip\":\"192.168.0.80\"}"}
2018-09-15 00:06:57.956 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Data received and notified 1 listeners
2018-09-15 00:06:57.959 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Thread Thread[Thread-93,5,main] waiting for data on port 9898

(Svilen) #828

Hi guys,

I followed your wonderful “read me” explanation from the binding page in order to track something from Wima Lock I recently bought (few posts up), but all I got is sort of this:

2018-09-16 14:03:55.228 [TRACE] [g.mihome.handler.XiaomiBridgeHandler] - Received message {"cmd":"read_ack","model":"","sid":"158dXXXXdf77c","short_id":54728,"data":"{\"voltage\":3350}"}
2018-09-16 14:03:55.228 [TRACE] [g.mihome.handler.XiaomiBridgeHandler] - Updated "last time seen" for device 158dXXXXdf77c
2018-09-16 14:03:55.228 [DEBUG] [g.mihome.handler.XiaomiBridgeHandler] - Device 158dXXXXdf77c honored read request
2018-09-16 14:03:55.228 [DEBUG] [discovery.XiaomiItemDiscoveryService] - Unknown discovered model:
2018-09-16 14:03:55.181 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Sending message: {"cmd": "read", "sid": "158dXXXXdf77c"} to /192.168.1.102:9898
2018-09-16 15:25:09.186 [DEBUG] [g.mihome.handler.XiaomiBridgeHandler] - Send to bridge mihome:bridge:7811dXXXX356: {"cmd": "read", "sid": "158dXXXXdf77c"}
2018-09-16 15:25:09.201 [TRACE] [g.mihome.handler.XiaomiBridgeHandler] - Received message {"cmd":"read_ack","model":"","sid":"158dXXXXdf77c","short_id":54728,"data":"{\"voltage\":3350}"}

Seems there is communication between the lock and the gate, but only about the battery level. No any trace for msgs when the lock is locked/unlocked, no info which key is used, no info when not allowed key is used or some of the allowed is forgotten in the lock. Any ideas how to chase that.

Thank you very much for the binding and all the efforts to add more and more stuff to it!


(Masssssy) #829

I’m getting “unknown_event” and “short_pressed” from my dual switch wireless buttons. This would seem kind of strange?

Also, does these buttons support long press, short press etc (in hardware, binding seems to not right have support)?

Even if the buttons doesn’t support long press etc. it would seem strange that a single short press would trigger “unknown”?


2018-09-17 18:39:39.178 [vent.ChannelTriggeredEvent] - mihome:86sw2:158d000255ee87:ch1 triggered SHORT_PRESSED
2018-09-17 18:39:39.185 [vent.ChannelTriggeredEvent] - mihome:86sw2:158d000255ee87:ch1 triggered UNKNOWN_EVENT

Also the dual channel reports twice, which is not so optimal as everything would turn both on and then off again in the same key press.

2018-09-17 21:11:48.564 [vent.ChannelTriggeredEvent] - mihome:86sw2:158d000255ee87:dual_ch triggered SHORT_PRESSED
2018-09-17 21:11:48.572 [vent.ChannelTriggeredEvent] - mihome:86sw2:158d000255ee87:dual_ch triggered SHORT_PRESSED

(Ed) #830

hey guys!
Any news about the Aqara shock / vibration sensors? (i mean, the aqara djt11lm)
Atm the “Xiaomi Mi IO” and the “Xiaomi Mi smart home” bindings still can’t find them!
Thanks in advance :wink:

ps: i know about the guide in the binding page about those sensors, to sniff gateway messagges…but even if i found them i can’t read values and put in sitemap!