# Xiaomi BLE Sensor Temperature and Humitity

**URL:** https://discourse.nodered.org/t/xiaomi-ble-sensor-temperature-and-humitity/25860
**Category:** General
**Created:** [1 May 2020 11:58 UTC](https://discourse.nodered.org/t/xiaomi-ble-sensor-temperature-and-humitity/25860 "2020-05-01T11:58:12Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![McRMX](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mcrmx/32/51526_2.png) [@McRMX](https://discourse.nodered.org/u/McRMX)
#### Post date: [1 May 2020 11:58 UTC](https://discourse.nodered.org/t/xiaomi-ble-sensor-temperature-and-humitity/25860/1 "2020-05-01T11:58:12Z")

</div>

Hi,  
I have a raspberry with NODE-RED and Homebridge

Node RED 1.0.6  
NodeJS v14.1.0 (with npm 6.14.4

When I install the node "node-red-contrib-xiaomi-ble"

I try to connect a Xiaomi Mijia Bluetooth Temperature Humidity Sensor

On linux when I search equipement I see the sensor with is address

I have installed libbluetooth-dev

but he always searching in yellow .

So I try to install plugin on homebridge "Homebridge Mi Hygrothermograph" and the sensor is working

But they are install on the same equipement Raspberry

Do you know where is the problem ?

I prefere take all information by node red

If you have any idear

Thanks

---

<div class="post-metadata">

### Author: ![EmilWesselink](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/emilwesselink/32/65829_2.png) [@EmilWesselink](https://discourse.nodered.org/u/EmilWesselink)
#### Post date: [2 May 2020 22:41 UTC](https://discourse.nodered.org/t/xiaomi-ble-sensor-temperature-and-humitity/25860/2 "2020-05-02T22:41:20Z")

</div>

I just finished this challenge ten minutes ago, so here is my solution in Node Red:

i followed this steps to have a running script and bluepy running:  
[https://zsiti.eu/xiaomi-mijia-hygrothermo-v2-sensor-data-on-raspberry-pi/](https://zsiti.eu/xiaomi-mijia-hygrothermo-v2-sensor-data-on-raspberry-pi/)

For the flow down here I used only the string node as extra not basic NR node:

```auto
npm install node-red-contrib-string

```

you put in the mac adress and you get a payload object with all the values.

```auto
[{"id":"91943ebe.8e573","type":"exec","z":"b9081e0f.24bdf","command":"python3 /home/pi/mitemp/demo.py --backend bluepy poll ","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":450,"y":200,"wires":[["a6ad7072.cb01e"],[],[]]},{"id":"3690b70b.4bcc98","type":"inject","z":"b9081e0f.24bdf","name":"","topic":"","payload":"4c:65:a8:d8:81:8f","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":180,"wires":[["91943ebe.8e573"]]},{"id":"1393b642.583e8a","type":"comment","z":"b9081e0f.24bdf","name":"based on","info":"https://zsiti.eu/xiaomi-mijia-hygrothermo-v2-sensor-data-on-raspberry-pi/","x":520,"y":140,"wires":[]},{"id":"a6ad7072.cb01e","type":"switch","z":"b9081e0f.24bdf","name":"","property":"rc.code","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":730,"y":200,"wires":[["a1e5ed4.5ff271"],[]]},{"id":"a1e5ed4.5ff271","type":"split","z":"b9081e0f.24bdf","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":910,"y":200,"wires":[["e44b2ca2.d3a8"]]},{"id":"e44b2ca2.d3a8","type":"switch","z":"b9081e0f.24bdf","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"FW:","vt":"str"},{"t":"cont","v":"Name:","vt":"str"},{"t":"cont","v":"Battery:","vt":"str"},{"t":"cont","v":"Temperature:","vt":"str"},{"t":"cont","v":"Humidity:","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":6,"x":1030,"y":200,"wires":[["105db69a.2f0d89"],["cb21bb4f.6c7098"],["f69c98c8.1c0b48"],["f5d5cf81.2265d"],["efb58042.2986b"],["7858d43c.264eac"]]},{"id":"67e5e451.0d7d1c","type":"debug","z":"b9081e0f.24bdf","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1590,"y":200,"wires":[]},{"id":"105db69a.2f0d89","type":"string","z":"b9081e0f.24bdf","name":"","methods":[{"name":"chompLeft","params":[{"type":"str","value":"FW: "}]}],"prop":"payload","propout":"FW","object":"msg","objectout":"msg","x":1170,"y":160,"wires":[["7858d43c.264eac"]]},{"id":"7858d43c.264eac","type":"join","z":"b9081e0f.24bdf","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":"false","timeout":"","count":"","reduceRight":false,"x":1330,"y":200,"wires":[["85fc7ab.65bdb88"]]},{"id":"cb21bb4f.6c7098","type":"string","z":"b9081e0f.24bdf","name":"","methods":[{"name":"chompLeft","params":[{"type":"str","value":"Name: "}]}],"prop":"payload","propout":"name","object":"msg","objectout":"msg","x":1170,"y":180,"wires":[["7858d43c.264eac"]]},{"id":"f69c98c8.1c0b48","type":"string","z":"b9081e0f.24bdf","name":"","methods":[{"name":"chompLeft","params":[{"type":"str","value":"Battery: "}]}],"prop":"payload","propout":"battery","object":"msg","objectout":"msg","x":1170,"y":200,"wires":[["7858d43c.264eac"]]},{"id":"f5d5cf81.2265d","type":"string","z":"b9081e0f.24bdf","name":"","methods":[{"name":"chompLeft","params":[{"type":"str","value":"Temperature: "}]}],"prop":"payload","propout":"temperature","object":"msg","objectout":"msg","x":1170,"y":220,"wires":[["7858d43c.264eac"]]},{"id":"efb58042.2986b","type":"string","z":"b9081e0f.24bdf","name":"","methods":[{"name":"chompLeft","params":[{"type":"str","value":"Humidity: "}]}],"prop":"payload","propout":"humidity","object":"msg","objectout":"msg","x":1170,"y":240,"wires":[["7858d43c.264eac"]]},{"id":"85fc7ab.65bdb88","type":"template","z":"b9081e0f.24bdf","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"FW\":\"{{FW}}\",\"name\":\"{{name}}\",\"battery\":{{battery}},\"temperature\":{{temperature}},\"humidity\":{{humidity}}}","output":"json","x":1460,"y":200,"wires":[["67e5e451.0d7d1c"]]},{"id":"2dfc59bd.d2bbb6","type":"inject","z":"b9081e0f.24bdf","name":"","topic":"","payload":"4c:65:a8:d8:72:70","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":220,"wires":[["91943ebe.8e573"]]}]

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [1 July 2020 22:41 UTC](https://discourse.nodered.org/t/xiaomi-ble-sensor-temperature-and-humitity/25860/3 "2020-07-01T22:41:25Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
