[OBSOLETE] Original & Aqara Xiaomi Zigbee Sensors (contact, temp, motion, button, outlet, leak, etc)

Hi Fido,

The last tile you descdribe records the battery change date, if you go into settings and click the battery changed option and then save this will register todays date.

As for the negative symbol. double tap the button to access this.

Hope that makes sense.

Thanks Foz, in the end i went into the IDE and adjusted the settings from the Devices section, i did try a double tap just as a side note but for me it didnt bring up the - sign ?? no probs though all sorted now

Many thanks for the reply
and the battery date time setting was just me not poking around enough, my bad on that

So you’re still not able to get the negative sign to enter in a negative offset?

Just wondering because if it doesn’t work for all Android users, we can change the device handler allows numbers to be entered (but unfortunately also allows other characters to be entered).

Well, well, well…I received the two Original Xiaomi Smart Human Body Sensor (Not Aqara) yesterday. I already had the DH loaded in IDE. They took a bit of pressing the pairing switch multiple times. They finally showed up as paired. These motion sensors have a pretty good range to them. I think the website says 7 meters. I’d say the range I have one set up at is about 5-6 meters and it seems to be pretty sensitive.

I’m really impressed with the sensor. It took about an hour for the battery to report and show the percentage which is standard for these, I know.
I’m also really impressed with the motion sensitivity and the small package. These things are tiny.

Hats off, yet again to the folks who were/are part of developing the DH and made these work like they do.

One word of caution, if you order through Gearbest, you better pay for the expedited shipping, or not be in any kind of hurry to get them. Delivery took 42 days on the slow boat free shipping.

1 Like

Hi Keith, 100% i tried double tapping and it didnt work… BUT due to your post i have just retried double tap … it freakin worked !!! which is good and saves you messing with any more code but is stupid user error on my part, maybe i just was not paying enough attention when i did it, the - sign is pretty small even on a S7e, perhaps i just didnt recognise it … duno but for whatever reason it DOES work with double tap, my apologies

Next thing i will probably get wrong is changing the temperature colours, at the moment outside it is -1.2 deg C but the main panel is showing a red colour when infact i feel a deep blue would be better, unfortunately the IDE is not letting me edit anything at the mo, must be a server error somewhere there end

Ok using the DH and changing to repository to NON for now just to allow editing, i have deleted the 13 lines and removed the // as mentioned in the code for Celsius colour scheme, bare in mind i am no expert with the code it does appear the lowest value is 0, so i added [value: -6, color: “#58d8e1”], at the beginning of the colour set line, my thoughts were to have a colour from -6 to 0 in colour #58d8e1 but i am still getting an orange colour that has always been the default colour i guess for negative values, definately due to my lack of knowledge my small changes are not working, any pointers just to have negative temp values in a colour other than orange

i think i may have sort of found where the issue lies, the code is set up mainly for Farenheight, -2 Celsius is 28.4 F, 28.4F in the colour set is orange ! so it appears the temperature value is reporting properly but the colours are not honouring Celsius values, the background colours are only honouring Farenheight temperatute to colour

is this line of code to blame
temp = (temperatureScale == “F”) ? ((temp * 1.8) + 32) + offset : temp + offset
there is no mention of Celsius ?? i `m probably wrong though

Yeah, Smarthings IDE farted today, affects git smartapps and DHs… there is a thread over here…

yeah seen it Foz, thats where i read about switching the repository name to none… hopefully it will be sorted soon

I’m sorry to say I didn’t do extensive testing of the alternate color set for Celcius users, but that set and the default set were taken from example code mentioned by the SmartThings Developer Documentation here.

Looking at their suggested colors for Fahrenheit, you could do something like this for Celcius:

0	#153591	(dark blue)
7	#1e9cbb	(medium blue)
14	#90d2a7	(light green)
21	#44b621	(medium green)
28	#f1d801	(yellow)
35	#d04e00	(orange)
38	#bc2323 (red)

It’s possible there is a bug in the SmartThings user interface that uses the wrong colors when temperatures go into negative values. I will have to investigate. However the code you asked about:

temp = (temperatureScale == “F”) ? ((temp * 1.8) + 32) + offset : temp + offset

has nothing to do with any issues you see in the displayed color. That is a ternary operator and is just a short way to write a conditional. It converts the native celcius temperature from the sensor only if the user’s hub is set to display Fahrenheit. A simplified long form would look like this:

(assume temp is the sensor's reported temperature in Celcius)

if (temperatureScale == “F”)					"if hub is set to display Fahrenheit"
   then temp = ((temp * 1.8) + 32) + offset		"then convert value to F, plus offset"	
   else temp = temp + offset					"otherwise add offset to C value"

Announcing: Update to v1.1 for all Xiaomi device handlers
(except ZigBee Outlet & Mijia-Honeywell Fire Sensor)

Available now from the bspranger/Xiaomi repository on GitHub.

• New custom battery tile icon
• New custom humidity tile icon (both Temp/Humidity sensor DTHs only)
• New custom pressure tile icon (Aqara Temp/Humidity sensor DTH only)
• Rearranged order of first three tiles of Aqara Temp/Humidity sensor DTH
• Changed battery event text to “battery at % ( Volts)”


(iOS on left, Android on right)

So, it turns out that it’s not easy at all to create a custom icon for the SmartThings mobile app, because the user interface renders them in very different ways on iOS versus Android. With the help of @foz333 and @tmleafs, we finally found a happy balance of displaying the same icon on both platforms.

Note that for iOS users, the icons don’t show up in the list of events in the “Recently” tab. So the event description now lists the battery percentage in addition to the reported Voltage.


This is all incredible work - who knew that it would be so difficult to get an icon that worked well on both platforms? Congratulations to @veeceeoh, @foz333, and @tmleafs for your tenacity on this…

1 Like

Also - I absolutely love the new pressure and humidity icons - well done!

Great stuff thank you Keith the new icons are much more explanatory, like i said i am a total novice at code, that said the colours for Celcius defo needed a change so what i have done is take a look at the weather tile 2.0 colour set, i have a bit more testing to do but i have taken the colour set from that and added them to your DH

i am going to let the Aqara warm up now for a few hours and see how it looks but as i had no issues with temp to colour in weather tile 2.0 i am not expecting issues, interestingly ish they are also in F values as the temp scale goes from 32 to 98

This is how my colour looks at the moment
[value: 32, color: “#153591”],
[value: 44, color: “#1e9cbb”],
[value: 59, color: “#90d2a7”],
[value: 74, color: “#44b621”],
[value: 84, color: “#f1d801”],
[value: 92, color: “#d04e00”],
[value: 98, color: “#bc2323”]

Just checking my man drawer… been a bit lazy of yet. Xiaomi sensors starting to build up.


OK since you don’t have the time to install, I will take them. Ha, Ha :rofl:

loving “man drawer”!

So I finally got a Temp/Humidity sensor in. Felt like it took a month to get here. I have it paired and the DH set. But I am getting zero reading from it. Nothing. I’ve tried to combo through the several topics and post…but I’m stuck. Any ideas?

Do you have your timezone set on the hub?

Yup. Central Time

Has to be something to do with the paring. I deleted and was going to reinstall, but now its not even showing the catchall message in my logs, as im trying repair

Hold the button for 10 seconds so it resets.