Mi(Xiaomi) Smart home bindings?

(Hallo Ween) #630

Can you place the gateway to the first floor and the temp-sensor in the last corner of your cellar?

There maybe is no zigbee connection anymore? And then place the plug in the ground floor and look if it is connecting?

(Hallo Ween) #631

Do you have the “Original Xiaomi Mi Home Smart WiFi Socket” or the “Original Xiaomi Mi Smart WiFi Socket - ZigBee Version” ?

Are there really 2 different Versions or is this all the same?

(Thomas Binder) #632

I guess, there are two versions. I have no ZigBee (at least not aware of) in my outlet. It’s WiFi only.
Perhaps the ZigBee version also functions as a gateway, as the Aqara smart IP cam (https://m.gearbest.com/ip-cameras/pp_978606.html?wid=21) is.

(Teppo Turunen) #633

I have the Xiaomi Mi Smart Socket Plug 2 ZigBee Edition and i can confirm that it works as a repeater. Garage temp sensor was offline last night until i plugged that Smart socket with an Schuko-China adapter to nearby room and it automatically fixed the connection in about 5mins.

Unfortunately IKEA trådfri dimmable bulb didn´t bring this sensor up, i had that bulb switched on for whole night at the same location as that xiaomi smart plug.

(Alon Levy) #634

Having trouble with the motion sensor…
i OH2.2, i added it as thing, and assigned items to Motion and Timer.
i can see the motion updates fine the Item, however i have no visible events in logs, and rules doesn’t apply…
any ideas?

rule "YeeLightMotion Trigger"
    Channel "mihome:sensor_motion:158d0000f41d32:motion" triggered ON
        sendNotiication("l******@gmail.com", "motion trigered")

tried also using the item

rule "YeeLightMotion Trigger"
    Item corridormotion changed
        logInfo("YeeLight.Rules","motion activated")
        sendNotiication("l*******@gmail.com", "motion trigered")

UPDATE: had to change the Item associated to the Motion Sensor from CONTACT to SWITCH - did the trick… getting now updates from the sensor.

(Paul Hansen) #635

Also consider changing sendNotiication to sendNotification

(Thomas Binder) #636

If your motion sensor is placed inside a frequently used room, you’ll get notifications every few minutes.
The sensor itself sends motion ON, waits for a interval (3mins in default, if I remember correctly) - then it’ll trigger OFF. if there’s still movement, it’ll trigger ON again.
I defined a proxy item with an expire-binding value of 10mins. It’ll go OFF if there’s no further ON coming from the sensor. Play around with the expire to suit your needs.

(Thefathefa) #637

Hello Thomas @binderth,

I’d be interested in having examples of how exactly you do the below to detect when an item becomes offline and I’d like to understand if there is a way to make a one generic rule that works for all sensors or if I need systematically a rule per sensor?

Thanks for your help,

(Thomas Binder) #638

at first, try to understand how it works with single configuration:

Number MiWeather_Temperature "Temperatur innen [%.1f C]" <temperature> (xiaomi) { channel="mihome:sensor_weather_v1:34cexxxxxx:158dxxxxxxxxxx:temperature",expire="2h" }

That means, if the item “MiWeather_Temperature” doesn’t get updated within 2h it will “expire” - meaning it’ll change to UNDEF.
That way, you can trigger some action on that:

rule "MiWeather failure"
	Item MiWeather_Temperature changed to UNDEF
	// do something like:
	var String message = "MiWeather Temperature sensor is offline!"
	logInfo("Xiaomi Mi offline", "message: "+message)
	sendNotification("john@deere.com", message)

Now: if you know, how this works - you can put all your Sensors or whatever expiring in one Group and do some action, if the Group goes UNDEF:


Group:Switch:OR(ON, OFF) gXiaomi "Xiaomi Sensors" 

note: the “OR” is key here, that means if one sensor inside the group changes, the whole group changes With AND you’ll only get a UNDEF on the Group if all items within fail.

rule "Xiaomi sensors failure"
	Item gXiaomi changed to UNDEF
	// do something like:
	gXiaomi?.allMembers.filter(s | s.state == UNDEF).forEach[i|
		var String message = "Xiaomi sensor offline: " + i.name
		logInfo("Xiaomi Mi offline", "message: "+message)
		sendNotification("john@deere.com", message)		

this means, you’ll get on every change of the Group gXiaomi a log-entry and a notification of all UNDEF items (presumably only one). If there’s more than one failure, you’ll only get the first one. If you’d like to have multiple notifications and log-entries, you’ll have to rewrite the trigger of the rule to Item gXiaomi received update - and you’ll have to have an IF to ask, if the update was UNDEF. To my Knowledge you can’t have “Item gXiaomi received update to UNDEF”… I hope, you understand, what I mean…

(Ward) #639

Thanks for the explanation! I already used these kind of rules to receive notification about my low batteries, but never used the ‘expire’ binding.
Will test this asap

(Thefathefa) #640

Thank you Thomas, this is great. I’ll put in in place immediately.

(IZ) #641

Gents, I can’t find anywhere the loudness of the gateway.
Can it be used as a siren? Is it loud enough?


(joris) #642

As an alarm to scare someone off I would say no. More like loudly announce presence.

(Leandro Fina) #643

Hello everyone

I am new to openhab and try to set up my smart home. Most of my equipment is from Xiaomi and the subcontractors. Unfortunately, I have a problem and I can’t make any items out of it at the switches. Of course, nothing can be combined in a meaningful way. Anybody got any advice?

(Thomas Binder) #644

yes - read the docs! :wink:
honestly - please read them thoroughly - otherwise we repeat ourselves daily here in the forum.
But please - if you find something difficult to understand in the docs or think something’s missing there - please tell us, so the docs can be improved.
For the time being:

tl;dr> You can’t have items for events like button presses. you have to take the channel in a rule and there you can do something with your pressed button.
but you can have items for “battery level” and “low Battery”

(Kalpesh Patel) #645

Mi Gateway is compulsory for using Mi Sensors. It works on Zigbee Protocol which connects to Mi Gateway and Mi Gateway through wifi connects to your router.

(Thefathefa) #646

Hi again,

I have a strange situation where a Aqara Temp sensor is showing the following:

  • flat on Grafana (stuck at given values since 24 hours)
  • offline in Mihome
  • nice and clean “on-line” in openhab

Did any of you already see this? There must be something wrong in my setup but I’m not sure what?

@binderth, this makes the rules to detect offline etc… not triggering of course :slight_smile:


(Thefathefa) #647

And I have another question, on a different front : Is there a way for me to find in MiHome the id of the sensor that are then used by openhab? I miss this to have a manageable mapping between openhab and mihome for the (rare) cases when I need to go to mihome. I have clicked everywhere in mihome I think and did not find the info.


(Kalpesh Patel) #648


So you are using another Gateway as Zigbee Repeater or directly connected to wifi ?

(Thomas Binder) #649

Unfortunately not. You have to either add them one by one (and write the ID in a list or something) or you have to guess which device by either pressing buttons, checking information or something like that. I don’t see nor a ID or MACadress or something in MiHome for a Aqara-Device.