Intregrate new bluetooth Xiaomi Thermosthat with display

Hi,
I’m saw on a blog this new bluetooth xiaomi thermometer and hummidity sensor and i think is ideal for Home Assistant. It’s bluetoth, so you don’t need the gateway to connect to, like the xiaomi plant sensor. And of course is very cool to put on a wall, and very cheap!

Xiaomi Thermometer

It’s nice. It supported in MiHome app via ble-to-wifi Bridge. New bedside lamp acts as a bridge.
So I assume that it can be easily added to xiaomi_aqara once new FW for gw will come out.
That will require a xiaomi hub.

Hubless approach will require some ble module rPi or esp32 and protocol hack.

Has anyone got this working? I got one, but I couldn’t even add it as a new device to the Xiaomi gateway. Maybe I should update the gateway’s firmware first…

It needs a Mijia bluetooth gateway device to read the temperature and humidity data. Now Mijia bluetooth gateway device includes Mijia Bedside Lamp, Mijia Smart IP Camera, and so on

So the thermometer connects over BT to the lamp or camera, which in turn should connect over wifi to the Xiaomi Aqara gateway?
But those Mijia devices are not currently supported in Home Assistant, right?

hi, you can try my custom component that I have created. (https://github.com/dolezsa/Xiaomi_Hygrothermo). let me know if you are satisfaied with it… suggestions are welcome.

5 Likes

Thanks for your code. I now can have it in homeassistant.
For those who have error: ERROR (SyncWorker_12) [custom_components.sensor.xiaomi_hygrothermo] Unexpected error: Failed to connect to peripheral 4C:xx:xx:xx:xx:x, addr type: public

solved it by “sudo apt-get install bluez-hcidump”

Do you plan to integrate your custom component into home-assistant? That would be great!

I’m still getting ERROR (SyncWorker_12) [custom_components.sensor.xiaomi_hygrothermo] Unexpected error: Failed to connect to peripheral. It seems that I have problem with bluepy? I tried reinstall but the problem still re-occurs.

this error regularry appears also for me, i think, you can simply ignore it for now… i plan to implement retry logic and log error only when no one connection succeeded.

maybe when it will be/looks to be stable…

I found that it seems the bluetooth on my homeassistant box was put into sleep mode or something. It coulnd’t get the status of Xiaomi Thermosthat for hours but when I run “sudo hcitool lescan” it can read the status again. During that time, homeassistant doesn’t have that kind of error message. Then some minutes later, the status unavailable…

Thanks @dolezsa,
it looks very good.

Do you know how I would go about using a Pi to read the BT data and then forward it to Home Assistant on another machine?
I gave up running HA on the Pi, but it’s still in use and I could also use it as a kind of BT bridge, if it’s possible.
I have already read the Hygrothermo MAC address with the instructions on your page.

for your purpose try this guy’s bash shell script, which sends measured values through mqtt https://github.com/GSanCap/Xiaomi-Mijia-Hygrometer/blob/master/hygro-poll.sh

1 Like

Great job!
Thanks a lot; it works smoothless.
Monitored conditions are temperature and humidity. Is there a way to show battery level as well?

hi scapman, thank you. battery level is monitored as well, you can find it in detail of your sensor. snip_20180427101907

Thanks… my fault I didn’t see it!

it’s been a year, but I couldn’t find a better alternative. I have one sensor in the bathroom which I’d like to use as a trigger to smart switch in bathroom for heater, but the BT connection is so weak it just doesn’t reach my homeassistant (running on Vero 4K in the living room…). There is a Xiaomi Gateway between them and bluetooth light in the hall, but it doesn’t help as sensor can be read directly through BT I guess. Any chance of reading the data from connected gateway?

Can someone add this device to https://www.home-assistant.io/integrations/xiaomi_aqara/ for those of us with gateway devices it should just appear as another device on the gateway API?

I have a Yeelight in every room so all bluetooth sensors are connected to gateways and relayed back to the hub.

Would anyone be willing to do this for a donation? I have these sensors in multiple rooms and need the data to control other devices.