Mi(Xiaomi) Smart home bindings?


(Benjamin) #508

Is it marked as installed? Do you configured it via addons.cfg?
My PaperUI shows mihome 2.1.0 as not installed and it works like a charm :slight_smile:


(lonce) #509

I think i got it working, my Mi Home devices are discovered with Mihome 2.1.0 being installed.


(Dominic Bonneau) #511

Hey I finally be able to setup my Xiaomi Gateway with my Motion sensor and my Wireless Switch … (manually add them into Xiaomi.things) I didn’t have the time to test the switch yet but for the motion sensor it work like one time on ten… I look in the paper UI and the Motion Switch don’t change even if I’m dancing in front of it

The thing said : Status:Online

EDIT: wireless switch work great !
EDIT2: my motion sensor seams working well too my issue is when it turn one once it loong before he can turn on again …


(Ben Jones) #512

The motion sensors don’t send a CLOSED event - just the OPEN. So you either need to implement a rule/timer to reset your OH item, or use the expire binding.


(lonce) #514

Does anyone have a working sitemap,items, things files for Xiaomi motion sensors and yeelights, for some reason my devices are discovered and active in PaperUI. My textual configurations are not working when I try to add Yeelights.

I’m still a noobie when it comes to OH2 and can’t get anything to work via text configuration any assistance would be much appreciated :slight_smile:


(Josep Xavier Sellart I Gine) #515
/*PIR */  
rule "System started"
when
    System started //or
//    Time cron "0 */2 * * * ?"  // CADA 2 MINUTOS
then
	if(Presencia_Zona1_Teresa.state==NULL)   	Presencia_Zona1_Teresa.sendCommand(OFF)  	Llum_Zona1_Teresa_Sostre.sendCommand(OFF)
	if(Presencia_Zona1_David.state==NULL)  		Presencia_Zona1_David.sendCommand(OFF)		Llum_Zona1_David_Sostre.sendCommand(OFF)
	if(Presencia_Zona1_Pares.state==NULL)  		Presencia_Zona1_Pares.sendCommand(OFF)		Llum_Zona1_Pares_Sostre.sendCommand(OFF)
	if(Presencia_Zona1_Oficina.state==NULL)  	Presencia_Zona1_Oficina.sendCommand(OFF)	Llum_Zona1_Oficina_Sostre.sendCommand(OFF)
	if(Presencia_Zona1_Passadis.state==NULL)	Presencia_Zona1_Passadis.sendCommand(OFF)	Llum_Zona1_Passadis_Sostre.sendCommand(OFF)
	if(Presencia_Zona1_Bany.state==NULL)  		Presencia_Zona1_Bany.sendCommand(OFF)		Llum_Zona1_Bany_Sostre.sendCommand(OFF)
	if(Presencia_Zona2_Menjador.state==NULL)  	Presencia_Zona2_Menjador.sendCommand(OFF)		Llum_Zona2_Menjador.sendCommand(OFF)
	if(Presencia_Zona2_Cuina.state==NULL)  		Presencia_Zona2_Cuina.sendCommand(OFF)			Llum_Zona2_Cuina_Sostre.sendCommand(OFF)
	if(Presencia_Zona2_Lavabo.state==NULL)  		Presencia_Zona2_Lavabo.sendCommand(OFF)		Llum_Zona2_Lavabo_Sostre.sendCommand(OFF)
	if(Presencia_Zona2_Passadis.state==NULL)  		Presencia_Zona2_Passadis.sendCommand(OFF)		Llum_Zona2_Passadis_Sostre.sendCommand(OFF)
	if(Presencia_Zona3_rentador.state==NULL)  		Presencia_Zona3_rentador.sendCommand(OFF)		Llum_Zona3_Passadis_Sostre.sendCommand(OFF)
	
end

/*PIR TERESA--------------------------------------------------------------------------------------*/
rule "Presencia_Zona1_Teresa"
when
    Item Presencia_Zona1_Teresa changed	//TERESA
then
	Thread::sleep(100)
    if(Presencia_Zona1_Teresa.state == ON) {
    	Llum_Zona1_Teresa_Sostre.sendCommand(ON)        
        }
    else {
    	Llum_Zona1_Teresa_Sostre.sendCommand(OFF)    
    }
end

/*PIR DAVID-----------------------------------------------------------------------------------------*/
rule "Presencia_Zona1_David"
when
    Item Presencia_Zona1_David changed	//david
then
	Thread::sleep(100)
    if(Presencia_Zona1_David.state == ON) {
    	Llum_Zona1_David_Sostre.sendCommand(ON)    
        }
    else {
    	Llum_Zona1_David_Sostre.sendCommand(OFF)    
    }
end

/*PIR PARES-----------------------------------------------------------------------------------------*/
rule "Presencia_Zona1_Pares"
when
    Item Presencia_Zona1_Pares changed	//PARES
then
	Thread::sleep(100)
    if(Presencia_Zona1_Pares.state == ON) {
    	Llum_Zona1_Pares_Sostre.sendCommand(ON)      
        }
    else {
    	Llum_Zona1_Pares_Sostre.sendCommand(OFF)  
    }
end

/*PIR OFICINA---------------------------------------------------------------------------------------*/
rule "Presencia_Zona1_Oficina"
when
    Item Presencia_Zona1_Oficina changed	//OFICINA
then
	Thread::sleep(100)
    if(Presencia_Zona1_Oficina.state == ON) {
    	Llum_Zona1_Oficina_Sostre.sendCommand(ON)      
        }
    else {
    	Llum_Zona1_Oficina_Sostre.sendCommand(OFF)  
    }
end

/*PIR PASSADIS--------------------------------------------------------------------------------------*/
rule "Presencia_Zona1_Passadis"
when
    Item Presencia_Zona1_Passadis changed	//PASSADIS
then
	Thread::sleep(100)
    if(Presencia_Zona1_Passadis.state == ON) {
    	Llum_Zona1_Passadis_Sostre.sendCommand(ON)      
        }
    else {
    	Llum_Zona1_Passadis_Sostre.sendCommand(OFF)  
    }
end

/*PIR BANY------------------------------------------------------------------------------------------*/
rule "Presencia_Zona1_Bany changed"
when
    Item Presencia_Zona1_Bany changed	//PASSADIS
then
	Thread::sleep(100)
    if(Presencia_Zona1_Bany.state == ON) {
    	Llum_Zona1_Bany_Sostre.sendCommand(ON) 
    	Persiana_Zona1_Bany.sendCommand(ON)     
        }
    else {
    	Llum_Zona1_Bany_Sostre.sendCommand(OFF) 
    	Persiana_Zona1_Bany.sendCommand(OFF) 
    }
end

/*PIR SALA D'ESTAR------------------------------------------------------------------------------------------*/
rule "Presencia_Zona2_Menjador changed"
when
    Item Presencia_Zona2_Menjador changed	//SALA D'ESTAR
then
	Thread::sleep(100)
    if(Presencia_Zona2_Menjador.state == ON) {
    	Llum_Zona2_Menjador.sendCommand(ON) 
//    	Llum_Zona2_Menjador_Taula.sendCommand(ON)     
        }
    else {
    	Llum_Zona2_Menjador.sendCommand(OFF) 
//    	Llum_Zona2_Menjador_Taula.sendCommand(OFF) 
    }
end

/*PIR CUINA------------------------------------------------------------------------------------------*/
rule "Presencia_Zona2_Cuina changed"
when
    Item Presencia_Zona2_Cuina changed	
then
	Thread::sleep(100)
    if(Presencia_Zona2_Cuina.state == ON) {
    	Llum_Zona2_Cuina_Sostre.sendCommand(ON) 
        }
    else {
    	Llum_Zona2_Cuina_Sostre.sendCommand(OFF) 
    }
end

/*PIR LAVABO------------------------------------------------------------------------------------------*/
rule "Presencia_Zona2_Lavabo changed"
when
    Item Presencia_Zona2_Lavabo changed	
then
	Thread::sleep(100)
    if(Presencia_Zona2_Lavabo.state == ON) {
    	Llum_Zona2_Lavabo_Sostre.sendCommand(ON) 
    	Persiana_Zona2_Lavabo.sendCommand(ON)     
        }
    else {
    	Llum_Zona2_Lavabo_Sostre.sendCommand(OFF) 
    	Persiana_Zona2_Lavabo.sendCommand(OFF) 
    }
end

/*PIR REBEDOR--------------------------------------------------------------------------------------*/
rule "Presencia_rebedor"
when
    Item Presencia_Zona2_Passadis changed
then
	Thread::sleep(100)
    if(Presencia_Zona2_Passadis.state == ON) {
    	Llum_Zona2_Passadis_Sostre.sendCommand(ON)      
        }
    else {
    	Llum_Zona2_Passadis_Sostre.sendCommand(OFF)  
    }
end
/*PIR RENTADOR--------------------------------------------------------------------------------------*/
rule "Presencia_rentador"
when
    Item Presencia_Zona3_rentador changed
then
	Thread::sleep(100)
    if(Presencia_Zona3_rentador.state == ON) {
    	Llum_Zona3_Passadis_Sostre.sendCommand(ON)      
        }
    else {
    	Llum_Zona3_Passadis_Sostre.sendCommand(OFF)  
    }
end

/*PIR MAGATZEM_1--------------------------------------------------------------------------------------*/
rule "Presencia_Magatzem_1"
when
    Item Presencia_Zona3_Magatzem_1 changed
then
	Thread::sleep(100)
    if(Presencia_Zona3_Magatzem_1.state == ON) {
    	Llum_Zona3_Staircase.sendCommand(ON)
		Llum_Zona3_Workshop.sendCommand(ON)      
        }
    else {
    	Llum_Zona3_Staircase.sendCommand(OFF) 
		Llum_Zona3_Workshop.sendCommand(OFF) 
    }
end

/*PIR MAGATZEM_2--------------------------------------------------------------------------------------*/
rule "Presencia_Magatzem_2"
when
    Item Presencia_Zona3_Magatzem_2 changed
then
	Thread::sleep(100)
    if(Presencia_Zona3_Magatzem_2.state == ON) {
    	Llum_Zona3_Staircase.sendCommand(ON)
//		Llum_Zona3_Workshop.sendCommand(ON)      
        }
    else {
    	Llum_Zona3_Staircase.sendCommand(OFF) 
//		Llum_Zona3_Workshop.sendCommand(OFF) 
    }
end

(Eric Zenz-Matzl) #516

Hi guys,

I’m very new to Openhab and come from FHEM.
Openhab is still running on my “test Raspberry”, but since Monday i started to move everything to Openhab.

Yesterday i received my Xiaomi Smart Home Gateway V3, an Aqara Temp Sensor and a Water Leak Sensor.
The integration of the Gateway worked like a charm, also i can control the gateway without problems via the PaperUI.

I had no problem to integrate the Sensors with the Mi Home App, but i can’t find them in the inbox.
I’m running in the 2.1 version of the Binding and 2.1 Openhab.

Should i switch to the 2.2 version of the Binding?
Can i find the ItemID of the Sensors anywhere to add them manually?


(andres_meyer) #517

Yes, Aqara Temp / Water Leak are not in 2.1, only 2.2.


(Eric Zenz-Matzl) #518

You are right, now is everything working fine :smile:
Thank you


(Geri) #519

Hello, can you please tell me where you found the V3? I just found the V2 with my searches. Thank you


(Hallo Ween) #520

Can you show me, how you fix the temp sensors in your place?

I don´t want to glue them onto the wall. If the battery gets empty and i remove the temp sensor from the wall, the glue will be damaged and i need another one. Do you have better ideas for this? Maybe with magnets?

Will the range of the wireless zigbee network increase, if i fix the sensor with a magnet to the wall?


(Dimalo) #521

The motion sensors actually send CLOSED but the binding does have an internal timer, which is started when it receives the OPEN. So no need to implement a timer by yourself… :smile:


(Mr. Yoinkz) #522

@dimalo

But will the MotionTimer be able to get a fixed value, instead of the default one? Right now you the Motion Sensor will switch back to “OFF” after 1 minute or so (default I guess) What if I would like a certain Motion Sensor to be “ON” for 10 minutes?

I guess when the Aqara Motion Detecter says its “ON” then it just sends the command, its not keeping track of any movements or LUX changes until it changes its state back to “OFF”? So it shouldn’t use extra Battery when kept alive.


(Dimalo) #523

sure, have a look in the readme
the Number MotionSensor_MotionTimer <clock> { channel="mihome:sensor_motion:<ID>:motionOffTimer" } is what you are looking for.
change the item value to whatever you want the timer to be. default is 120sec.

only caveat is, that after a restart the item has to be set again (even if it’s persisted), for example by a rule on System started - otherwise it’s back to default again.

having the timer as an item, you can dynamically set it with rules! for example you want the timer to be only a few minutes at night, but for example 10min during the day…

after it has triggered it goes to sleep for one minute and is then able to trigger again on movement. about LUX changes I am not sure, but I guess these are sent not depending on movement but periodically, every 30min for example.

so having the timer set to 10sec will “disable” it for 50sec.


(rb) #524

Hi there,

complete NOOB for OpenHAB here - but with looong Java background, so not afraid :o).

I have a few HA functions running on a Maxim TINI Java board, controlling shutters & lights. TINI is something like a “RaspberryPi for Java”. Even the internet has almost forgotten about it, I think its about 15 years old. Anyway its really asking for retirement.

I will install OH on my QNAP NAS to replace it.
For window sesonrs, smoke detecors and a couple of other things the Xiaomi Aqara components seem to fit the bill for price, quality, reliability, and WAF (Wife’s Acceptance Factor).

I have a few questions that I can’t find definite answers for. Some are openHAB, some are more Xiaomi / Zigbee related.

  1. I understand that currently OH binding uses the gateway’s dev API for talking to the Xiaomi zigbee devices. Is a more direct integration (based on a Zigbee dongle) underway?
  2. My home has brick walls and concrete floors. What is the range of the sensors to the gateway in similar environments?
  3. I read on another HA forum that the Xiaomi socket can act as a repeater for the sensors. Does that require some support from OH or is this a Xiaomi internal thing?
  4. Unfortunately there is no EU socket available. Is there any other Xiaomi devices or dedicated zigbee repeaters that extend Xiaomi’s zigbee range?
  5. what is the maximum number of devices that can be paired with a v2 Gateway?
  6. Are multiple Xiaomi Gateways supported by OH?
  7. Can the smoke sensor’s alarm be activated / deactivated from OH?

Any input is greatly appreciated!
Cheers


(Dimalo) #525

Hi shabbab,

welcome to OH!

  1. unfortunately not. I’m pretty sure the Xiaomi lineup does not use common Zigbee standarts, so there is little chance you will ever get the devices workinig with a 3rd party dongle. but the gateway is just 30 bucks…
  2. zigbee is 2.4GHz - its hard to say, perhaps you can get a basic idea by deriving from 2.4GHz wifi, but then the protocol is still different. personally, I have drywall and one gateway is able to support all the devices I have (one floor, 100sqm). but again - the gateway is just 30 bucks, buy a couple of them :wink:
  3. never heard about that, not sure if this is really the case… but the binding does not support sockets as bridges. so it must be an Xiaomi internat thing, if at all possible.
  4. if you got wifi all over the place, buy more gateways - the sensors will be much more reliable too, means even with my drywalls from time to time I notice that a signal gets lost (e.g. I enter a room and the motion sensor does not trigger)
  5. v3 gateways are avaiable everywhere, why buy an older version? there are users with 30+ devices paired to one gateway…
  6. oh yeah :slight_smile:
  7. do you mean deactivating the sound they make? Do they even make sound? I don’t have any, so I’m not sure. If you mean “ignoring the zigbee alarm signal” - sure with rules you can just do whatever you want with it

(rb) #526

Hi dimalo

and thanks for the info.

Regarding

  1. Direct Communication
    Right now Xiaomi could close the developer API with a simple OTA update to the gateway. Or maybe we just can’t get a replacement gateway in two years if our current gateway dies.
    It seems to be possible to decipher the protocol, see
    articles about sniffing
    and Decrypting
    .
    This guy is just finishing the work on a generic Zigbee gateway. Unfortunately openHAB was not on his list for early developer units.
    .
    Zigbee shepherd can handle Xiaomi as well it seems, see here, here and even here on openHAB.
    .
    So direct communication with Xiaomi zigbee components seems to be possible, but not too easy.

  2. Repeater: There is some talk about the repeater functionality and the problems it has with some other Zigbee components at SmartThings.com

  3. buying a couple of gateway is the easiest solution.

  4. I mean using the smoke detector’s alarm signals (sound / flashing) for other purposes. Intrusion alarm for example.

I just ordered a couple of components to start with. We will see how this evolves. At least I need to retire my old TINI Java SoC. Its been running continuously for almost 15 years now and I doubt it will last much longer. I just realize that it has Sram buffered with a lithium battery.


(Sasha) #527

Hi team,

Need your help!
I’ve recently added Xiaomi Zigbee Plug to my collection of Xiaomi devices.
It works great, can read the power load and consumption, updates the status of the switch but I cannot control the device from OpenHAB.
Is there anything that I’ve done wrong in the config?

Items:

Switch 		Mi_Plug_1_Switch 		"Media Centre Switch [%s]"				<switch> 			{ channel="mihome:sensor_plug:158d0001ded347:power" }
Switch 		Mi_Plug_1_Active 		"Media Centre Active [%s]"			   	<switch> 			{ channel="mihome:sensor_plug:158d0001ded347:inUse" }
Number 		Mi_Plug_1_Power 		"Power Load [%.1f W]"					<energy> 			{ channel="mihome:sensor_plug:158d0001ded347:loadPower" }
Number 		Mi_Plug_1_Consumption	"Power Cunsumed [%.1f kWh]"				<line-incline> 		{ channel="mihome:sensor_plug:158d0001ded347:powerConsumed" }

Sitemap:

		Switch item=Mi_Plug_1_Switch
		Switch item=Mi_Plug_1_Active
		Text item=Mi_Plug_1_Power
		Text item=Mi_Plug_1_Consumption

Logs:

2017-10-27 15:58:00.559 [ItemStateChangedEvent     ] - Mi_Plug_1_Power changed from 46.65 to 46.21
2017-10-27 16:11:24.570 [ItemStateChangedEvent     ] - Mi_Plug_1_Consumption changed from 18.536 to 18.563
2017-10-27 16:11:24.571 [ItemStateChangedEvent     ] - Mi_Plug_1_Power changed from 46.21 to 46.65
2017-10-27 16:45:23.496 [ItemStateChangedEvent     ] - Mi_Plug_1_Power changed from 46.65 to 46.21
2017-10-27 16:45:23.497 [ItemStateChangedEvent     ] - Mi_Plug_1_Consumption changed from 18.563 to 18.591
2017-10-27 16:50:44.487 [ItemStateChangedEvent     ] - Mi_Plug_1_Power changed from 46.21 to 46.65
2017-10-27 16:58:27.481 [ItemStateChangedEvent     ] - Mi_Plug_1_Power changed from 46.65 to 46.21
2017-10-27 17:05:46.469 [ItemStateChangedEvent     ] - Mi_Plug_1_Power changed from 46.21 to 46.65
2017-10-27 17:16:21.455 [ItemStateChangedEvent     ] - Mi_Plug_1_Consumption changed from 18.591 to 18.617
2017-10-27 17:17:44.448 [ItemCommandEvent          ] - Item 'Mi_Plug_1_Switch' received command OFF
2017-10-27 17:17:44.458 [ItemStateChangedEvent     ] - Mi_Plug_1_Switch changed from ON to OFF
2017-10-27 17:17:46.100 [ItemCommandEvent          ] - Item 'Mi_Plug_1_Active' received command OFF
2017-10-27 17:17:46.102 [ItemStateChangedEvent     ] - Mi_Plug_1_Active changed from ON to OFF
2017-10-27 17:17:47.575 [ItemCommandEvent          ] - Item 'Mi_Plug_1_Switch' received command ON

Screenshot from Paper UI (I’ve added things via it):


(Dimalo) #528

Wow didn’t even think of it as being possible!
good chance to get rid of the sniffing servers :slight_smile:

I hope things will evolve, but at the moment it seems like very hacky.

the gateway has sound playing capabilities. I guess writing to the smoke sensor is not possible.

@sasha_jpr: please enter your dev key. seems like youre not able to write but can read. check if the key is working by switiching the light on the gateway or something similar.


(Thefathefa) #529

Hi, thanks for the Xiaomi binding, great stuff.

I have some questions on it:

  1. Several channels seem to be mapped to a Switch type of item while I think they are more a read only info (e.g. LowBattery). Is this intentional or a mistake?

  2. Can things and items definitions directly in the config files coexist with the PaperUI defined ones?

  3. What would be the right way for me to monitor the “reachability” or “aliveness” of a device? I just noticed that one of the Water leak sensors I have is out of reach and so basically is not connected to OH, and nothing mentioned it (it appears nicely “online” in the things list)…

  4. Motion sensors from Xiaomi have also the ability to report illumination or brightness, and I don’t see this info being reported in the available channels for motion sensors? Was it forgotten? Or do I have a problem on my setup?

  5. Same for smoke detectors, I don’t see the channel for battery level and low battery appearing? Do I have a problem with my setup? And I don’t see either the “smoke density” and “ability to see in the smoke” info that are popping up in other plateforms for the same device…

Thanks,