[OBSOLETE] Xiaomi Sensors and Button (beta)

I’ve repeatedly paired a button, motion sensor and door sensor with my V1 hub but the devices have consistently gotten dropped after a few hours. I’ve tried leaving them undisturbed next to the hub after pairing but that has not helped. Any other ideas on making the pairing to persist?

I would like to report a new finding about the Xiaomi contact sensors.
I have 10 of these in case anybody wonder.

The sensor reading will become inaccurate somehow, if you install the magnet too close to the sensor piece it will result in the sensor report “open” event when your door bump a little when it is closing.It is very annoying and cause false alert.

The way to solve this, is try to install the magnet somewhere further when closed, or rotate the magnet 90 degrees, make the exterior side facing the sensor instead of the side with mark on it.

1 Like

Thanks I was having this issue, I will try your suggestions this evening.

1 Like

Yup mine will not work with my V1 hub. Same issue.

Mine use whatever timeout I set in the device settings. I use a different timeout on each.

The Xiaomi motion sensor seemed to be working in such a way that it only send “motion detected” event, then the device handler reset the sensor to “no motion” after the timeout you configured.

But no way you’ll be able to trigger another “motion detected” event from the sensor within 1 minute from last trigger.

The official FAQ explain this is to save power.

If you briefly click “pair/reset” then sensor will be able to report motion more often, then go back to power save mode after certain amount of time. See my post with translation for all FAQ for more info.

1 Like

@a4refillpad
It seems people including myself aren’t able to get these to stay connected to V1 hubs. Can you make a warning in the first post that V1 hubs are having issues with these

Also has anyone with a V1 had success with these staying connected?

3 Likes

If you’re ok with humidity being the main element just on the main part -
Line 115 change main([“temperature2”]) to main([“humidity”])
If you wanted to change the summary part as well that should be do-able without breaking the handler :blush:

@KellyDarren I’m afraid there’s no obvious way in smartthings of displaying different tiles depending on user preferences. Hence people in the community struggling to cater for fahrenheit and celsius colours in the same handler.

There is a “solution” for temperature that I lifted up from DTH by Fibaro Group: (it’s for Z-Wave device but should be able to adapt to zigBee)

you send the event using:

def cmdScale = cmd.scale == 1 ? "F" : "C" //scale sent by the sensor
sendEvent(name: "temperature", unit: getTemperatureScale(), value: convertTemperatureIfNeeded(cmd.scaledSensorValue, cmdScale, cmd.precision), displayed: true)

and the tile looks like that:

	valueTile("temperature", "device.temperature", inactiveLabel: false, width: 2, height: 2) {
		state "temperature", label:'${currentValue}°',
		backgroundColors:[
			[value: 31, color: "#153591"],
			[value: 44, color: "#1e9cbb"],
			[value: 59, color: "#90d2a7"],
			[value: 74, color: "#44b621"],
			[value: 84, color: "#f1d801"],
			[value: 95, color: "#d04e00"],
			[value: 96, color: "#bc2323"]
		]
	}

as you can see the temp ranges are for Fahrenheit, I use temperature in Celsius but it still scales the color properly. I was confused as hell first time I saw this (my temp was 21 degrees but it showed green and according to this tile i should have been blue)

Basically with this combination the app recalculates color ranges given for F temperatures to C temperature if needed. (as soon as you change state parameter of the tile to anything but “temperature” it stops doing that)

getTemperatureScale() and convertTemperatureIfNeeded() are API functions. I believe fist returns the degrees setting from the app, the other one calculates the value automatically so if you just replace the parameters for your devices it should work well.

4 Likes

Fascinating. If I can get it working, I’ll look into incorporating the colour scaling solution into the handler.

3 Likes

Hi,
is it possible to control the Xiaomi Universal IR Remote Controller with ST?

This seems an excelent product to have in my living room to control the AC, TV, TV Box, HiFi, …

Thanks in advance

Stuck a temp/humiddity sensor in the fridge. Wired results. It reads normal cold temp then jumps to hot. Is this a sensor issue or DH?

Could very well be my code. I don’t use fahrenheit so need people to feedback any issues. The device only reports in C natively.

Sorry this thread is only for my handlers covering the sensors and button.

3 Likes

What info would be helpful?
Thank you for your time with this.

Check this out:

1 Like

Could you take off a copy of the live logs for the device when it happens?

fa150396-da31-4ada-98dd-b7665117668b 3:33:45 PM: debug Parse returned T. - Fridge humidity is 50%
fa150396-da31-4ada-98dd-b7665117668b 3:33:45 PM: debug Evencreated: humidity, 50, %
fa150396-da31-4ada-98dd-b7665117668b 3:33:45 PM: debug Parsevalue: 50
fa150396-da31-4ada-98dd-b7665117668b 3:33:45 PM: debug Parsename: humidity
fa150396-da31-4ada-98dd-b7665117668b 3:33:45 PM: debug RAW: humidity: 49.57%
fa150396-da31-4ada-98dd-b7665117668b 3:33:45 PM: debug Parse returned T. - Fridge temperature is 33.5°F
fa150396-da31-4ada-98dd-b7665117668b 3:33:45 PM: debug Evencreated: temperature, 33.5, F
fa150396-da31-4ada-98dd-b7665117668b 3:33:45 PM: debug Parsevalue: 33.5
fa150396-da31-4ada-98dd-b7665117668b 3:33:45 PM: debug Parsename: temperature
fa150396-da31-4ada-98dd-b7665117668b 3:33:45 PM: debug RAW: temperature: 0.82
fa150396-da31-4ada-98dd-b7665117668b 3:29:38 PM: debug Parse returned T. - Fridge humidity is 47%
fa150396-da31-4ada-98dd-b7665117668b 3:29:38 PM: debug Evencreated: humidity, 47, %
fa150396-da31-4ada-98dd-b7665117668b 3:29:38 PM: debug Parsevalue: 47
fa150396-da31-4ada-98dd-b7665117668b 3:29:38 PM: debug Parsename: humidity
fa150396-da31-4ada-98dd-b7665117668b 3:29:38 PM: debug RAW: humidity: 46.95%
fa150396-da31-4ada-98dd-b7665117668b 3:29:38 PM: debug Parse returned T. - Fridge temperature is 32.5°F
fa150396-da31-4ada-98dd-b7665117668b 3:29:38 PM: debug Evencreated: temperature, 32.5, F
fa150396-da31-4ada-98dd-b7665117668b 3:29:38 PM: debug Parsevalue: 32.5
fa150396-da31-4ada-98dd-b7665117668b 3:29:38 PM: debug Parsename: temperature
fa150396-da31-4ada-98dd-b7665117668b 3:29:38 PM: debug RAW: temperature: 0.30
fa150396-da31-4ada-98dd-b7665117668b 3:25:57 PM: debug Parse returned T. - Fridge humidity is 44%
fa150396-da31-4ada-98dd-b7665117668b 3:25:57 PM: debug Evencreated: humidity, 44, %
fa150396-da31-4ada-98dd-b7665117668b 3:25:57 PM: debug Parsevalue: 44
fa150396-da31-4ada-98dd-b7665117668b 3:25:57 PM: debug Parsename: humidity
fa150396-da31-4ada-98dd-b7665117668b 3:25:57 PM: debug RAW: humidity: 44.24%
fa150396-da31-4ada-98dd-b7665117668b 3:25:57 PM: debug Parse returned T. - Fridge temperature is 212.4°F
fa150396-da31-4ada-98dd-b7665117668b 3:25:57 PM: debug Evencreated: temperature, 212.4, F
fa150396-da31-4ada-98dd-b7665117668b 3:25:57 PM: debug Parsevalue: 212.4
fa150396-da31-4ada-98dd-b7665117668b 3:25:57 PM: debug Parsename: temperature
fa150396-da31-4ada-98dd-b7665117668b 3:25:57 PM: debug RAW: temperature: 100.23
fa150396-da31-4ada-98dd-b7665117668b 3:23:31 PM: debug Sending enroll response
fa150396-da31-4ada-98dd-b7665117668b 3:23:31 PM: debug refresh called
fa150396-da31-4ada-98dd-b7665117668b 3:22:43 PM: debug Sending enroll response
fa150396-da31-4ada-98dd-b7665117668b 3:22:43 PM: debug refresh called
fa150396-da31-4ada-98dd-b7665117668b 3:22:35 PM: debug Parse returned T. - Fridge humidity is 39%
fa150396-da31-4ada-98dd-b7665117668b 3:22:35 PM: debug Evencreated: humidity, 39, %
fa150396-da31-4ada-98dd-b7665117668b 3:22:35 PM: debug Parsevalue: 39
fa150396-da31-4ada-98dd-b7665117668b 3:22:35 PM: debug Parsename: humidity
fa150396-da31-4ada-98dd-b7665117668b 3:22:35 PM: debug RAW: humidity: 39.21%
fa150396-da31-4ada-98dd-b7665117668b 3:22:35 PM: debug Parse returned T. - Fridge temperature is 213.3°F
fa150396-da31-4ada-98dd-b7665117668b 3:22:35 PM: debug Evencreated: temperature, 213.3, F
fa150396-da31-4ada-98dd-b7665117668b 3:22:35 PM: debug Parsevalue: 213.3
fa150396-da31-4ada-98dd-b7665117668b 3:22:35 PM: debug Parsename: temperature
fa150396-da31-4ada-98dd-b7665117668b 3:22:35 PM: debug RAW: temperature: 100.74

Indeed it does look like the device doesn’t like freezing temperatures. The raw value coming from the device is over a hundred Celsius which is converting correctly to the Fahrenheit value.