Integrating Xiaomi Mi Scale

If someone can show me how to create an add on I can try and have a go

Just tried this with my neglected MI Scale original (no body composure) (https://hub.docker.com/r/lolouk44/xiaomi-mi-scale), never used it with BLE before yet it worked perfectly.

Really happy considering my Raspberry Pi was already acting as a server and it was 3 stories away, worked a charm .

1 Like

This worked great, however the problem comes when every few minutes I want to run another script that sends data from Xiaomi Temperature Sensor. Also bluetooth, same libraries. Is there a way I can make them coexist?
I am guessing they can’t use bluetooth resources at the same time.

if you’re using the code from the github, I’ve just pushed a change to allow you to set the sleep time and changed the default sleep from 1s to 30 sec
if you’re using the container version, I’ll push a new version once I’ve rebuilt the containers

I really appreciate the quick reply. I have tried running the new script directly but I’m getting an error.

root@yoda:/var/script/xiaomi_mi_scale/src# bash wrapper.sh
  File "/var/script/xiaomi_mi_scale/src/Xiaomi_Scale.py", line 39
    TIME_INTERVAL = int(os.getenv('TIME_INTERVAL, '30'))
                                                    ^
SyntaxError: invalid syntax

In the meantime I change it manually to 30 sec in Xiaomi_Scale.py (time.sleep) so no rush.
It’s working perfect now.

sorry I had committed but not pushed my change. Try again pls

Not a problem, tried it, working, thanks

So many messages on this post :grinning: I followed back but it is very hard to figure out if there is a working solution. Can someone point me in the right direction? Thank you so much!

If you’re asking how to connect try https://hub.docker.com/r/lolouk44/xiaomi-mi-scale

Guys,

Can someone tell me where i can startup? This integration is now in development right?

  • WHat is the best choise to buy a Scale? Mi Scale vers 1 or vers 2 ?
  • I have Zigbee and MQTT working on my Hass. Does this Mi scale have a Zigbee or do i need to implement on my HASS bluetooth and connect the scale via Bluetooth?

This is not an ha native integration. This is something I’ve “created” because nobody else had done it the way I wanted. It only works on Bluetooth and not really reliable of using a raspberry pi built in Bluetooth, much better with a Bluetooth dongle.
Scales v2 also provides body composition data, v2 only provides weight

Do you mean v1 only support weight?

My hass is installed on a PC under Linux. Which bluetooth dongle can i better buy? Do you have a good working tutorial how to install the dongle also?

As far as I know and the way the scale v1 is integrated, only weight is supported with the v1 scale
Pretty much any ble dongle should work though I obviously can’t guarantee it
As for tutorial, just head over to my repo and either select the docker version (probably the easiest) or the manual install

lolouk44 Thanks for your great work. Am I dumb that I am not seeing wrapper.sh anywhere? I am trying to install without docker.

EDIT: No longer on master, I got it out of the first logged release, thanks :slight_smile:

So you are running a docker container on a machine that has bluetooth to connect to your xiaomi smart scale. And then connect to HA from the Docker container via MQTT. Do I understand correctly?

That’s pretty much it

Thank you, lolouk44. I will try it asap

@Tobi0892
I tried to follow you guide from GitHub - Tobi0892/xiaomi_mi_scale: Connector for Xiaomi Mi Scale
I running supervised:

Hostname homeassistant
System HassOS 4.10

when installing the addon I get this error after some time:

Start build local/armv7-addon-xiaomi_mi_scale:0.7
ERROR (SyncWorker_12) [supervisor.docker.addon] Can’t build local/armv7-addon-xiaomi_mi_scale:0.7: The command ‘/bin/ash -o pipefail -c pip3 install -r requirements.txt’ returned a non-zero code: 127

on running hassio on a pi3b+
Can you help?

@Brian_Mollegaard_Ped I am still running 3.13, there it works flawlessly. Maybe I can free up some time during the weekend to update hassOS and test the build process again.

Haven’t been following the thread since some months, but I think there is an updated version of the container from @lolouk44?

As I understand Lolouk44 version is for none-supervised hassio installations. (or whatever the installation is called on a raspberry 3 is call now a days, with the flashing directly to a SD card)