Integrating Xiaomi Mi Scale

I switched the device and put a usb wifi board.
I too changed HCI_DEV for hci0 to hci1.
It worked! MQQT Explorer detected Mi Scale Body Composition 2.

Thanks for help me.

1 Like

Somehow I made it work consistently on my RPi and I also spent some time and setup this nice interface in lovalace using Grafana

5 Likes

Giving everyone a heads up.
I’m publishing version 0.2.0 which allows unlimited users. This does however come with a breaking change.

Breaking Changes

Please note that as off 0.2.0, the config is now located in options.json and no longer in the docker-compose / environment. Be sure to check the Doc for more information. This change was necessary to allow for unlimited number of users.

Added

Added BLUEPY_PASSIVE_SCAN Option for Raspberry Pi users experiencing Bluetooth troubles (in case you’re not using the add-on)

I have a problem.
The scale work for me, but it stop working after some time.

I have a notebook + ubuntu + docker + homeassistant container + mi-scale container.

I have 2 bluetooh boards in notebook (native dont work perfectly + usb board working 100%). I set default hci1 (usb bluetooth) and worked for me, however after press EXIT in console (bluetoothctl) and enter again, hci1 isn’t no more default.

1. root@ubuntuserver:/home/vicente/docker-compose# bluetoothctl
2. Agent registered
3. [bluetooth]# list
4. Controller C4:85:08:64:89:C0 ubuntuserver #1 [default]
5. Controller 00:1A:7D:DA:71:13 ubuntuserver
6. [bluetooth]#
7. [bluetooth]# select 00:1A:7D:DA:71:13
8. Controller 00:1A:7D:DA:71:13 ubuntuserver [default]
9. [bluetooth]# agent KeyboardOnly
10. Agent is already registered
11. [bluetooth]# default-agent
12. Default agent request successful
13. [bluetooth]# power on
14. Changing power on succeeded
15. [bluetooth]# list
16. Controller C4:85:08:64:89:C0 ubuntuserver #1
17. Controller 00:1A:7D:DA:71:13 ubuntuserver [default]
18. [bluetooth]# exit
19. root@ubuntuserver:/home/vicente/docker-compose# bluetoothctl
20. Agent registered
21. [bluetooth]# list
22. Controller C4:85:08:64:89:C0 ubuntuserver #1 [default]
23. Controller 00:1A:7D:DA:71:13 ubuntuserver
24. [bluetooth]#

In Line 18, when I exit, the 00:1A:7D:DA:71:13 controller is default (see line 17) but after mysteriously C4:85:08:64:89:C0 turns default (see line 22). I believe that’s the problem.

It doesn’t really matter which one is the default. You can select the hci number in the options.json settings

1 Like

Thanks for the useful integration. Unfortunately I tried installing through Community store but I get the message ’ Repostitory structure for 0.2.0 is not compliant’

Thanks. I didn’t realise the “old” structure meant installs were blocked, as far as I understood it was just deprecated.
I need to update the add-on indeed. Will try and see if I can make time this week

That’s fantastic, thank you so much.

Can you confirm when you get this message?
I’m trying to figure out what I need to change (HACS or HA Add-On side)…

It’s when I pasted your Github address into HACS Community custom repositories. I hit ‘add’ and get this message.

ah OK. I did try it but I guess it kept some info in the cache as it allowed me to re-add it
trying now to remove and reboot to see if it works or not.
Watch this space

[Edit] which URL are you entering? I just managed to add again using https://github.com/lolouk44/hassio-addons

[Edit 2] @dapper2490 Are you trying to add my repo via HACS? If so that won’t work. you need to add the repo URL via the Supervisor > Add-On Store > ⁞ > Repositories

That’s it working through Supervisor. Sorry that I misunderstood how to install and took up some of your time! I must learn not to jump ahead with these things. Thanks again for the great integration.

1 Like

options.json

{
  "options": {
    "MISCALE_MAC": "XX:XX:XX:XX:XX:XX", #hidden
    "MQTT_HOST": "127.0.0.1",
    "USERS": [
      {
        "GT": 60,
        "LT": 80,
        "SEX": "male",
        "NAME": "Bob",
        "HEIGHT": 200,
        "DOB": "1990-01-01"
      }
    ]
  }
}

docker-compose.yml

version: '3'
services:
  mi-scale:
    image: lolouk44/xiaomi-mi-scale:latest
    container_name: mi-scale
    restart: always
    network_mode: host
    privileged: true
    volumes:
      - .docker/mi-scale:/data

Hi, I’m running HA on a RPI Zero W (not recommended I know…) and running the mi-scale container on the same device as per above YAML and JSON files. For the life of me I cannot figure out why I am getting the error on the attached screenshot.
Any help greatly appreciated.

sounds like you’re having issues connecting to your MQTT Broker. Did you forget to add the MQTT Credentials in your options.json?

I must have misunderstood, I thought your package included a MQTT broker so I left all value related to it by default… Could you recommend a MQTT broker or any will just do?

no you need your own broker.
You can either use the HA mosquitto add-on

Thank everything works now.

1 Like

which version of the xioami scale can we buy to work it with unlimited users? There are 2 versions i think on Ali.

Check my repo, I list what it has been reported to be working with…

I hope it’s ok to share this in this topic. BLE monitor now also supports Xiaomi Mi Scales. BLE monitor passively monitors a lot of BLE sensors, and has added the scales recently.