Xiaomi BLE temperature & humidity sensor

Others (MiLight, Hue, Toon etc...)
Post Reply
freibeuter
Posts: 6
Joined: Saturday 27 January 2018 17:53
Target OS: Raspberry Pi
Domoticz version:
Contact:

Xiaomi BLE temperature & humidity sensor

Post by freibeuter » Saturday 27 January 2018 18:09

Hi guys!

Just started using Domoticz and trying to make my home a bit smarter 8-)
That´s why a bought a couple of Xiaomi´s new cheap temperature and humidity sensors that transfer data via BLE (see http://cleargrass.com/). As a newbie it took me about half a day setting up a python script reading temperature, humidity and battery values from sensor and pass it to Domoticz via JSON URL (if someone else needs it, how can I make it public?). So far so good. I set up a dummy hardware in Domoticz and added my sensors as devices of type "Temp + Humidity". In the devices view I can see data is populated correctly, diagramms are showing history - great!
However when I switch to the temperature section in domoticz, I only see the sensors, but no data directly on those widgets (see attached image).
Am I doing something wrong?
Also I marked them as favorites as you can see when looking at the stars but I can´t see them in the dashboard overview :?:

Thanks for helping!!
BR,
Alex
Attachments
sensors.png
sensors temperature section
sensors.png (52.07 KiB) Viewed 2217 times

freibeuter
Posts: 6
Joined: Saturday 27 January 2018 17:53
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Xiaomi BLE temperature & humidity sensor

Post by freibeuter » Sunday 28 January 2018 11:20

Decided to publish code on GitHub: https://github.com/fr31b3u73r/miThermoHygro
Feel free to test and give me feedback!

Update: Issue is fixed in newest version of script (missed stripping out non Ascii value from received package) - thanks to @PaulFen for pointing it out here: viewtopic.php?f=56&t=20925

Slokoavac
Posts: 14
Joined: Monday 20 November 2017 16:14
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: Balkans
Contact:

Re: Xiaomi BLE temperature & humidity sensor

Post by Slokoavac » Wednesday 07 February 2018 16:54

Cool man! Tnx for script! I am still waiting for it's price to come down and buy one or 2 of em. Still more affordable to use Xiaomi zigbee thermo/hydro meters (8-9$ each) and easier to use with zigbee GW (tho which is 26$) straight to domoticz oob. But that BLE one looks cool too :)

can you pair it with mi home app and BLE on Raspi at same time? Does it allows multiple pairings?


cheers!
Pi 2 (raspbian stretch) w. Conrad VOC USB, Xiaomi PM 2.5 detector , Xiaomi/Philips bulbs, Mi Flora BT, Xiaomi GW (w. temp/humidity/pir)
Pi Zero W (raspbian stretch) w. - Xiaomi GW (temp/hum/door)

Chakkie
Posts: 37
Joined: Wednesday 23 December 2015 12:27
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands
Contact:

Re: Xiaomi BLE temperature & humidity sensor

Post by Chakkie » Sunday 11 March 2018 12:06

freibeuter wrote:
Sunday 28 January 2018 11:20
Decided to publish code on GitHub: https://github.com/fr31b3u73r/miThermoHygro
Feel free to test and give me feedback!

Update: Issue is fixed in newest version of script (missed stripping out non Ascii value from received package) - thanks to @PaulFen for pointing it out here: viewtopic.php?f=56&t=20925
Hi freibeuter

Your script works perfectly but unfortunately I am only able to get the data from the device when the device is in paring mode. So basically I need to press and hold the paring button at the back of the device everytime otherwise I won't get the data readout. Do you know what's the issue here.

My raspberry Pi is still on Wheezy and may be that's the problem

thanks

Hesmink
Posts: 197
Joined: Monday 22 June 2015 10:48
Target OS: Raspberry Pi
Domoticz version:
Location: The Netherlands
Contact:

Re: Xiaomi BLE temperature & humidity sensor

Post by Hesmink » Sunday 08 July 2018 14:59

Hi,

Got your script to work.
The range of BT is surprisingly far, so I'm able to use these sensors anywhere.

Sensors now are pretty cheap (< 9€ at Joybuy).
Where does the battery information go within Domoticz?

Also my experience getting it to work:
- Took me a while to discover I needed Python 2. Why not add "#!/usr/bin/env python2" at the top of the script?
- I needed to install requests and bluepy, bluepy would only install after installing libglib2.0-dev.

After that it immediately worked!

I would also suggest to name the script like 'miThermoHygro.py' so we can store it in ~/Domoticz/scripts/python.

Thanks!

freibeuter
Posts: 6
Joined: Saturday 27 January 2018 17:53
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Xiaomi BLE temperature & humidity sensor

Post by freibeuter » Monday 09 July 2018 9:34

Hesmink wrote:
Sunday 08 July 2018 14:59
- Took me a while to discover I needed Python 2. Why not add "#!/usr/bin/env python2" at the top of the script?
Thanks - added the shebang
Hesmink wrote:
Sunday 08 July 2018 14:59
I would also suggest to name the script like 'miThermoHygro.py' so we can store it in ~/Domoticz/scripts/python.
Done ;)
Hesmink wrote:
Sunday 08 July 2018 14:59
Where does the battery information go within Domoticz?
It's an additional param for the Domoticz API (see https://www.domoticz.com/wiki/Domoticz_ ... y_level.29) - I am not that familiar with Domoticz yet, but you can see it e.g. in the App by pressing long on the device.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests