Cool. you may need to check which version of bluepy you installed. It may be that it’s the one for python 2.7 or other.
Try and run the script with sudo pythonX.XX /miscale.py
where X.XX is the python version matching your install of bluepy and you shouldn’t get that same error message.
Unless you use bluepy somewhere else, you could uninstall it and reinstall it for the correct version of python (e.g. using pip vs pip3 for example)
I had installed bluepy for pip3 only
but running the script with mentioning the python version did worked for me
sudo python3.5 ./miscale.py
it is now showing searching for devices …
I’ll go home put my Mi Scale’s mac id in the script and try to fetch the results.
Thanks
Hi lolouk44
I tried with my Mi Scale’s mac and it did worked, Now my question is how can i get the other matrices like Body fat, water, muscle and all is it possible ??
MQTT connection returned result: Connection Accepted.
Device: f6:xx:xx:xx:xx:xx (random), -84 dBm .
Sent data to topic miscale/weight/kg: 80.6 kg
for now I’ve only computer the BMI based off formulas I’ve found online:
BMI = weight / (height * height)
weight is in Kg, height is i m
Check how i’ve done it here:
I was looking to see if someone could find the formula that Xiaomi uses for its scales. I might use a formula from online sites in the future, but for now I’m only tracking weigtht and BMI
Are you guys thinking into making this an official component? Would be easier to use. Were you able to make it works? Would love to see my data sent to my Home assistant directly instead of having to bring my mobile with me all the time
no idea if anyone is doing this. only thing is that the component would need to know what type/version of scale is being linked. I personally don’t have the knowledge of skill to create a component I’m afraid.
Hi,
If it can help anybody here, I’ve recently created https://github.com/Wingjam/ReverseMiScale mostly a Python port of https://github.com/perillamint/node-xiaomi-scale.
This Python code run perfectly on my Raspberry Pi.
Jonathan
Hi! I was install your add-on. For command sudo python3 example.py
I see this out:
{
“UUID”: “181b”,
“address”: “c6:da:34:3c:ae:cc”,
“isStabilized”: false,
“loadRemoved”: false,
“manufacturerData”: “5701c6da343caecc”,
“rawData”: “02a4e2070b1d152c1dfdff043d”,
“sequence”: 7677,
“unit”: “kg”,
“weight”: 290.1
}
How I can use it for Home Assistant? And my weight is not correct.
Hi,
Currently this project does not support Home Assistant (and is not plan to). If you want to create a port for Home Assistant (let’s say exampleHomeAssistant.py), feel free to do it because i’m not an expert with Home Assistant.
The weight is not correct … that’s strange, my weight is good for me. I will investigate some time in this. Which unit did you choose under the scale (there is a toggle button beside batteries)?
Jonathan
if it helps anyone I’ve loaded a copy of my script here:
https://github.com/lolouk44/xiaomi_mi_scale/blob/master/Xiaomi_Scale.py
Hi,
Is it possible to use Xiaomi Mi scale in Home assistant under Hass.io ?
If I understand correctly, the solutions here required to run sudo with is not supported in Hass.io.
Can anyone help ?
Hi.
Yes, this would be interesting to have an easy integration with hassio.
Thanks.
Hi,
Also very interested in integrating this with Hassio.
Thanks!
If anyone is interested on contributing, please, check my github:
https://github.com/tiagofreire-pt/xiaomi_mi_scale
Regards.
I’m using my gateway for miscale integratoin, and other ble devices: https://github.com/zewelor/bt-mqtt-gateway
Can I just ask how does you miscale communicate with your machine running HA? Surely the bluetooth range between the 2 has to be minimum in order to achieve any connection? Is that correct? And what are the ranges we are talking about?
Can I have my miscale in the bathroom and pi running HA in another room and expect them to talk via bluetooth?
Thanks
It’s Bluetooth si you’re looking at standard 10m / 3 feet I guess. My scale is in the bathroom which happens to be on first floor almost right above the ha server that’s on the ground floor
I’m using raspberry pi zero w, which runs my gateway. My HA server is in the basement so no BLE range from there In your scenario ( bathroom and next room, or 2 rooms next ). Bluetooth on rpi with HA, it should work without any problems.
@Michal_Ciemiega @lolouk44 Right thanks for that. I want to get one from aliexpress do you guys recommend mi scale 1 or 2? And which one would work with HA via the BLE mqtt integration?
Also is there a docker image for the BLE MQTT integration?
Thanks
I got mi scale 1, and it works