Xiaomi BLE Temperature and Humidity sensor

Try to put sensors really close to rpi. I think it could be poor antennas problem (out of range).

1 Like

same problem for meā€¦ not working even at 2cm from pi

Hi!

I beginer with Home assistant.
I have two BLE sensor.
Mi Plants Flower monitor and Xiaomi BLE Temperature and Humidity sensor.
I use Homeassistant with Synology (Intel) with Docker.
Both BLE sensor works well if I add only one.
But If I add both BLE sensors, home assistant recongizes datas (temperature, humidity and battery ) only second one (Xiaomi LCD sensor in my sample) in configuration.yaml.

My sample code:

Xiaomi Mi plant sensor

sensor:

-platform: miflora
mac: C4:7C:8D:67:3B:XX
name: Flower 1
force_update: false
median: 3
monitored_conditions:
-moisture
-light
-temperature
-conductivity
-battery

Xiaomi LCD sensor living room

sensor:

  • platform: mitemp_bt
    mac: 4C:65:A8:X8:AD:A1
    name: Kids Room Temp
    force_update: false
    median: 3
    monitored_conditions:
    -temperature
    -humidity
    -battery

Ha you got any idea?

Have you tried moving it closer?
the rpi really does have rubbish BT range (i have issues past 4m)

these are the steps i took to get it right:
1 - press button on back of sensor to make it ā€˜discoverableā€™
2 - told my cellphone to find bluetooth devices (you have 30 seconds)
3 - see what cellphone found and it should give the mac of the device, will be listed as MJ_HT_V1
4 - used the following config

  - platform: mitemp_bt
    mac: '4c:65:a8:xx:xx:xx'
    name: Lounge
    force_update: false
    median: 1
    monitored_conditions:
      - temperature
      - humidity
      - battery 

5 - restarted HA

in your overview you should see 3 new badges with hyphens in them
the data will be populated a few minutes later with the next poll (default is 5 mins)

1 Like

I have done the same as you have outlined. I have my temp sensor sitting next to my pi. Is there some way of knowing if the piā€™s bluetooth is activated? Do I have to install the mitemp_bt component? Iā€™m using Hassio.

Ironically I had the same issue a few weeks ago after I was messing around.
I searched the internet high and low and this was the basic result I got - reinstall, it either works on install or not.
Backed up config (not a snapshot)
reinstall hassio with latest image
put config back
hey presto - BT was working again.

So thats my answer - sorry mate, reinstall hassio

Sorry for the hijack, but what is the update frequency like on the bluetooth temperature sensor? Iā€™m using a xiaomi zigbee temperature sensor, but that only updates once an hour, or after a 0.5deg temperature change (whichever happens first).

looking for more frequent updates.

I just tried this, still not working. Even with the sensor sitting next to the Pi. Anyway of knowing if the Piā€™s bluetooth is activated or working? Should the Piā€™s bluetooth be discoverable using a BLE app?

Pi3 and latest hassio should have it on by default, I donā€™t know of a way to test

You can set the frequency to a point using a median of updates
Median set to 1 polls data every 5 minā€™s.
Median 3 will take the average of 3 scans (15mins) and sends that - median is useful to prevent spikes.
You can also set force update to true which sends new values regardless of if they have changed or not.

@Eatoff try the commands mentions here to see if it returns values

I have a strange problem that sensor stops working after several days (around 3-5). After the restart of Pi is works again. Any ideas how to solve it?

P.S. even the restart of Hassio doesnā€™t help only the restart of Pi

1 Like

I donā€™t have any xiaomi BLE sensors, but I have a Bluetooth kettle working with a custom component, and it behaves the same way, loses connection after 3-5 days and needs a full pi reboot. So I believe the problem is in the Bluetooth part of hass.io in general.

1 Like

How do you restart Pi?

I would like to test this, I have two and experience the same issue.

Can restarting Pi be automated?

Did you solve this issue ? I also have this problem. Full restart of PI or from hassio ssh login and systemctl restart bluetooth.

I never resolved it, I bought the square temp and humidity sensor and they work like a charm.

Hi everyone,

Wondering if anyone has had the same issue as I have. I have the MI sensor and have been able to successfully pair the device to home assistant via getting itā€™s mac address but i canā€™t get any data through no matter how long i wait?

Anyone had the same issue and able to resolve it?

just to add seeing this in the logs

2019-07-14 16:45:42 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30 

Could not solve the problem with BLE sensor and did exactly the same as SimonT, bought a square Zig.Bee version - Xiaomi Aqara Atmos

Hi guys,

My setup is raspbian and hassio into a docker container.
Iā€™ve managed to connect to the xiaomi sensor using by default bluetooth from raspberry pi, but iā€™ve got some awkward error and had to unlock the bluetooth using the command rfkill unblock bluetooth.
After iā€™ve inserted the config lines into configuration.yaml file and starting the docker container all is good, but after 4-5 (few) hours, the sensor stop transmitting data and in the logs iā€™ve got only these kind of events

2019-07-16 13:49:51 WARNING (SyncWorker_15) [homeassistant.components.sensor.mitemp_bt] Polling error
2019-07-16 13:49:51 WARNING (SyncWorker_4) [homeassistant.components.sensor.mitemp_bt] Polling error

If iā€™m stopping the container and restarting it, the sensor starts behave normally (i donā€™t want to setup a cronjob to do this)
Does anybody have any clue why is having this behavior?

Iā€™ll still try and troubleshoot this and hope that iā€™ll find the root cause.

I have hass.io running in Docker on my debian server. Iā€™m also having the issue where the it stops getting the data.

I also have normal HA running in a virtual environment on a pi and itā€™s also having the same issue. Seems that something with Home Assistant (doesnā€™t matter is it normal HA or hassio) is causing the issue, or the Xiaomi BLE sensor, but like others have said, a reboot seems to fix it.

Itā€™s kind of annoying as I brought this for the display as where I have it is in a heavy traffic area in my house, otherwise I would have got one of the square zigbee ones like I have elsewhere.